Welcome, Guest. Please login or register. Did you miss your activation email?

### Author Topic: How to color the lines of a Vertex Array  (Read 1121 times)

0 Members and 1 Guest are viewing this topic.

#### Aqua_coder

• Newbie
• Posts: 3
##### How to color the lines of a Vertex Array
« on: March 03, 2022, 10:13:04 am »
Recently I was making a Maths Plotter on SFML, and I have done the basic core features like Drawing the animations and input.

But I wanted to know if I can change the color of a vertex array.
Here is the code for reference

void drawFunction(sf::RenderWindow &window)
{
while(x < 30 && drawing == true)
{
aq::sleep(0.01);
x += 0.1;
std::cout << x << std::endl;
window.clear();
curve.setPosition(sf::Vector2f(x*20.f + window.getSize().x/2,
-1*(sin(x))*20.f + window.getSize().y/2));
function.append(
sf::Vertex(curve.getPosition()));

window.draw(function);
window.draw(curve);
window.draw(sprite);
window.draw(x_axis);
window.draw(y_axis);
window.display();
}
if(x > 15 || drawing == false || (x > 15 && drawing == false))
{
drawing = false;
window.clear();
window.draw(function);
window.draw(sprite);
window.draw(x_axis);
window.draw(y_axis);
window.display();
}
}
« Last Edit: March 03, 2022, 01:34:10 pm by eXpl0it3r »

#### fallahn

• Sr. Member
• Posts: 464
• Buns.
##### Re: How to color the lines of a Vertex Array
« Reply #1 on: March 03, 2022, 10:39:47 am »