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

Author Topic: sf::RenderTarget::draw( ... ) and sf:VertexArray. Are they compatible?  (Read 1091 times)

0 Members and 1 Guest are viewing this topic.

Critkeeper

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
RenderTarget specifies that it requires a const Vertex*

VertexArray doesn't specify whether it can (or even should) be type cast to that.

Not that you would ever have to.

You could just use vertexArray.draw( ... ) rather than renderTarget.draw( ... ) since VertexArray does inhert from drawable.

But the syntax is nicer the other way. Just wondering.
if(CritKeeper.askQuestion()){return question.why();}

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
What's the question? Whether you can draw vertex arrays?

VertexArray doesn't specify whether it can (or even should) be type cast to that.
Yes, it's written in the documentation. You can access a pointer to a contiguous array using the index operator.

But it's easier to just use the
void RenderTarget::draw(const sf::Drawable&, sf::RenderStates)
overload. There's a code example for exactly that, and the tutorial is even more verbose about it...
« Last Edit: May 25, 2015, 11:52:06 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything