Issues with displaying dynamic OpenGL VBO -


i have been working vbos in opengl, , apparently don't understand i'm doing wrong here. want display vbo text in updated each frame. goal time fps counter, other applications viable.

down actual code: can work fine if set vbos in initialization function , draw in rendering function. if try , edit in draw function, however, nothing displays. while debugging have found of vectors containing data correct (i updated vbo same text , vectors indeed identical), issue must handling of vbos, , not data inside of them.

here initialization/rendering commands:

glgenbuffers(1, &pntvbo); glbindbuffer(gl_array_buffer, pntvbo); glbufferdata(gl_array_buffer, newpoints.size() * sizeof(vec3f), &newpoints[0], gl_stream_draw);   glgenbuffers(1, &indvbo); glbindbuffer(gl_element_array_buffer, indvbo); glbufferdata(gl_element_array_buffer, newindex.size() * sizeof(unsigned int), &newindex[0], gl_stream_draw); 

i tried this, no success:

glbindbuffer(gl_array_buffer, pntvbo); glbufferdata(gl_array_buffer, newpoints.size() * sizeof(vec3f), null, gl_stream_draw); glbuffersubdata(gl_array_buffer, 0, newpoints.size() * sizeof(vec3f), &newpoints[0]);  glbindbuffer(gl_element_array_buffer, indvbo); glbufferdata(gl_element_array_buffer, newindex.size() * sizeof(unsigned int), null, gl_stream_draw); glbuffersubdata(gl_element_array_buffer,0, newindex.size() * sizeof(unsigned int), &newindex[0]); 

and draw command itself:

glclientactivetexture(gl_texture5); glenable(gl_texture_coord_array); gltexcoordpointer(2, gl_float, 0, &newtexts[0]); glbindbuffer(gl_array_buffer, pntvbo); glbindbuffer(gl_element_array_buffer, indvbo); glenableclientstate(gl_vertex_array); glvertexpointer(3,gl_float,sizeof(vec3f),0);      gldrawelements(gl_triangles, newindex.size() , gl_unsigned_int, 0);  gldisableclientstate(gl_vertex_array); gldisableclientstate(gl_texture_coord_array); glbindbuffer(gl_array_buffer, 0); glbindbuffer(gl_element_array_buffer, 0); 

i'm sure i'm doing wrong here, can't figure out life of me is. said, works out fine if initialize or edit vbo in initialization function of program, once same functions put rendering function nothing displays. appreciated.


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -