PDA

View Full Version : Vbo map & unmap dumps garbage when using new?



th3w1zard
09-19-2010, 05:14 AM
hello everyone,


i am currently working on a opengl project and the weirdest thing is happening while using vbo. This has never happend to me before and maybe someone can help me figuring out the reason why this is happening....

Imagin you have a class where you organaze all your geometry of the scene, basicly that class menages all the data including the managing of the VBO as well. (iīm pretty sure you have all done the same sometime)

Inside of that class, i have a structure (like everyone else) that hold the data fo the vertex.

This works fine while declaring the structure as an array...like this:

Vertex vertices[TOTAL_VERTICES];

Now my Vertices are going to be built dymanicly using the operator new...when i declare this:

Vertex *vertices;
vertices = new Vertex[TOTAL_VERTICES];


The map of the Vbo is telling that dumps gargabe, only the first value is good the rest are just crazy ....

Has this happend to someone before...?? can you point out some reason why this could be happening???
I have tried to debug the code but itīs all good until me map of the buffer....that tells it does not have the right info...
i found this very strange...maybe iīm doing something wrong...then again why it it working, when i donīt use the operator new in my structure.....weired...i would love to listen to your thoughts....

Many Thanks
Best Regards

th3w1zard
09-19-2010, 06:34 AM
i have found and error retured by opengl just before i verify the values in the vbo after i have bound then and it says:

stack underflow...just before i map the values stored in it..


edit: sorted the opengl inside error...
edit: sorted the vbo problem