SFML community forums
Help => Graphics => Topic started by: Vovosunt on November 11, 2012, 01:18:48 pm
-
I'm currently using a vertexArray for the tile map in my game.
However it is very bothersome and confusing to calculate the offsets in the array (it's basically a 4d array).
I've tried using nested vectors (vector<vector<vector<Vertex> > > verts) and dynamically allocated array (starting with Vector*** verts and so on) but when I pass either into the draw function like this
((Vertex*)&verts[0],*number of vertexes*, sf::Quads) my app crashes...
I'm pretty sure it's due to the fact that vectors/allocated arrays are not contiguous... can I do this in some other way? :(
-
4D? What does it represent??
You have to use a one-dimensional array if you want the data to be contiguous, yes. If calculating the offsets is not trivial, then write it in a reusable function so that you just have to do it once. Or even better: wrap your 4D array in a class with operator overloading.