Jump to content
  • Advertisement
Sign in to follow this  
jmakitalo

Optimizing state changes in terrain renderer

This topic is 2604 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'm using VBO to render my terrain, which is divided into smaller square chunks. Each chunk has an associated index buffer and all the vertex data of the terrain is located in a single buffer. A chunk may have multiple textures, which are blended together in multipass.

My question is, should I minimize calls to glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, chunkId) or calls to glBindTexture(GL_TEXTURE_2D, textureId) ?
Currently I'm looping through all visible chunks, binding an element buffer, then looping through associated textures to render in multipass.

Should I rather take the outer loop through all the textures that are used in the terrain and only bind a texture once, and then loop through chunks that have the texture? This would result in binding element buffers multiple times.

Share this post


Link to post
Share on other sites
Advertisement
always sort for texture changes first, they are normally the most costly state changes.

also, why don't u use only one index buffer
and then render all part of it (is it draw elements rage?)

then u can render all the chunks which lies in a row with one draw call

Share this post


Link to post
Share on other sites

always sort for texture changes first, they are normally the most costly state changes.

also, why don't u use only one index buffer
and then render all part of it (is it draw elements rage?)

then u can render all the chunks which lies in a row with one draw call


Thanks. I will consider using also glDrawRangeElements.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!