What is a right datatype in C++ for OpenGL scene representation with use of GLSL

Posted by Rarach on Game Development See other posts from Game Development or by Rarach
Published on 2012-01-04T01:45:54Z Indexed on 2012/09/23 21:51 UTC
Read the original article Hit count: 198

Filed under:
|
|
|

I am programming in C++ OpenGl with GLSL. Until now I have been using a data structure that is composed of std::vector filled with structures of vertexes and with their parameters (position , normal, color ...) as a global variable for all the code. My question is, as I am using VBOs for drawing - is this a good approach to this problem?

I am asking because I happen to have a lot of memory related trouble with this structure. I am trying to generate a terrain with a lot of vertices - more than 1 million. This seems to work, but as I refill the buffer I get memory related issues (crushes that occur, more or less randomly).

So again the question is, is this a good data structure to use / and look for the faults in my code, or should I change to something else? Or what data structure would be advisable?

© Game Development or respective owner

Related posts about opengl

Related posts about c++