Sign in to follow this  
JohnHurt

Batching

Recommended Posts

JohnHurt    334
Say I have a load of geometry in the node of a quadtree, not all peices of geometry shares the same texture. What i want to do is send this geometry to the renderer, sorted by material. What is the best way to impliment a vertex buffer in this situation? Do you build the buffer each frame? BTW: this is in OpenGL.

Share this post


Link to post
Share on other sites
CRACK123    235
Why would you want to do it each frame ? You build it once only. If you plan on updating the texture you could use glTexSubImage2D for it. Anyway building it each frame would lose its purpose.



Share this post


Link to post
Share on other sites
JohnHurt    334
ok, after you've built the vertex array, how do you switch textures? say, i put all the peices into 1 array, how would you know when to change the current texture?

Share this post


Link to post
Share on other sites
CRACK123    235
You batch it based on material. Your material info will have the texture id/key or the bound texture ID itself with which you access your texture from your texture manager. So your structure will go something like this


MaterialInfo
FaceList
MatrixInfo



Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this