Archived

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

Sharing vertex buffers

This topic is 5091 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

I am trying to create a graphics API independent rendering system, and have come up with a problem. The system works like this: A CWindow class creates a window, and with a call to the CreateViewport() method of it, it creates and returns a pointer to a viewport object which is inherited by either CGLRenderer or CD3D9Renderer, whichever you decide to choose. So that way, the viewport can work in either OpenGL or Direct3D, whichever the viewport class points to. This also lets you have multiple viewports on the window. Now, say I have 2 viewports on the window, one in OpenGL and one in Direct3D. There is vertex data I want both viewports to share (models, etc.) which is allocated with ARB_vertex_buffer_object in OpenGL and in D3D with device->CreateVertexBuffer(). Would there be any way to share this cached data on the card without having to create a separate copy of it for both OpenGL and Direct3D viewports (this seems like a real waste of memory)? Or is that not possible to gain something like a pointer to the data when using vertex data allocated in AGP memory? Google has turned up nothing, so thought I would see if anyone knew here. If that is not possible any suggestions on how you would solve this problem in a more efficient way are appreciated. Thought about having the vertex buffers be local to each viewport, but again, that lends itself to duplicate data when you are rendering a scene on each viewport (one viewport with OpenGL, and the other with Direct3D) that both use the same models. Also thought about just passing storing the vertex data in local memory, but that is very slow and I want to avoid that. Thanks

Share this post


Link to post
Share on other sites