Skip to main content
gamedev.net
🔒 Locked

Vertexbuffer and dynamic mesh rendering

Started by plotark Jul 13, 2004 at 8:51 AM 0 replies 650+ views
Original Post
plotark
plotark
I have to render several meshes of which the number of vertices can change during run time. For efficiency i want to use the vertexbuffer object extension. I have thought of two algorithms. 1/ For each mesh create a vertexbuffer (GL_DYNAMIC_DRAW_ARB). If the number of vertices change, then destroy the vertexbuffer and recreate one of the correct size and fill it. 2/ Use a single vertexbuffer (GL_STREAM_DRAW_ARB) and the following algorithm (come from the dx sdk) bind the vertexbuffer For each mesh step 1: Test if there is enough space in the vertexbuffer to store the vertices step 2: If not discard the whole buffer step 4: Fill the vertexbuffer with the data (after the previous one) step 3: Render the mesh End I tend to prefer the second algorithm because i read that a glVertexPointer call is costly. What do you prefer? Is there other algorithms? I want also support cards that don't support vertexbuffer. In this case i use vertex arrays. Can i still use the second algorithm?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.