Jump to content
  • Advertisement

Archived

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

McZ

VertexBufferStack

This topic is 5369 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!