Archived

This topic is now archived and is closed to further replies.

McZ

VertexBufferStack

Recommended Posts

at the moment I have a "VertexBuffer"-class for each object in scene, they store the vertexData to be rendered(updated if the mesh is animated) now I was thinking of a VertexBufferStack in my rendersystem that stores the last used VertexBuffer''s in that stack.. now I want to know if I can create a single big VertexBuffer using the VBO extension for OpenGL and then create some push function to upload the VertexBuffer to memory if needed. example:
 int iVBSize; // Size of vertexBuffer

 void *pBuffer; // don''t know what pointer to use for VBO. 

 for( o = object in renderqueue )
 {
  // Push the vertexBuffer on to my stack and return a pointer

  pBuffer = VertexBufferStack->Push( o->VertexBuffer );
  
  // Get the VB size

  iVBSize = o->VertexBuffer->GetSize();

  // Draw the stuff in the buffer

  ...
 }

// VertexBufferStack

void *cVertexBufferStack::Push(cVertexBuffer *vb)
{
 if( [vb->ID doesn''t exist in list of last used buffers] )
 {
  // Upload the VB to the VBO memory.

 }

 // Set the vb->ID to be last in the last-used-buffer-list

 // then return the pointer for the buffer

 return bufferPtr;
}

Share this post


Link to post
Share on other sites