so these Vertex Arrays give access to the CPU as well I take it and that's why they would be manipulated alot easier?
Their vertex data is just stored in RAM like any dynamic array (in fact,
sf::VertexArray stores a
std::vector<sf::Vertex>). When the vertices are drawn, the whole vertex data is uploaded to the graphics card. The corresponding code can be found
here. The functions
glVertexPointer,
glColorPointer and
glTexCoordPointer specify where the data for vertex positions, vertex colors and texture coordinates lies. Upon calling
glDrawArrays, this data is loaded from the RAM to the graphics card's memory.
Any resource you could give me that might clarify the difference?
You could have a look at the documentation of the above-mentioned functions on
www.opengl.org, for example
https://www.opengl.org/sdk/docs/man/html/glDrawArrays.xhtml. Or
https://www.opengl.org/wiki/Vertex_Specification. Don't confuse this technique with Vertex Array Objects (VAOs) -- it's merely a way of passing all the data to the graphics card at once, instead of once for each attribute in each primitive (old-school
glBegin/
glEnd rendering).
Also, someone on another forum suggested I map the textures on to small 3d cube primitives by unwrapping them in a isometric style orthographic projection, but I am unclear on some of the details on that.
Why would you need a cube for 2D rendering? I don't know what he meant.
And about the benchmark. I'm reading on the SFML clock class right now. Would I do a benchmark measuring the framerate with that or are you just talking in general?
Don't measure frame rates, they're not expressive. Measure times. Yes, you can use
sf::Clock for that.
But keep in mind that a proper benchmark must fulfill the following conditions:
- The operation to measure must take up most of the time while measuring
- The operation must be repeated a sufficient number of times (you can't measure a single function call)
- Make sure the order of operation doesn't affect the result, randomize where necessary
- Compile in release mode, and without running debugger, and with full optimizations
And to be honest, I think you should invest your time better than deciding between quads and triangles. First, there are most likely other performance bottlenecks in your application. Second, if you find out that this should be a real issue, you can still change it within minutes. Of course, that requires you to build a reasonable abstraction so that you don't deal with raw
sf::VertexArrays in hundreds of places, but separating graphics from the game logic is a good idea anyway.