Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Situation

I've got a large map divided into 16*16 parts (comparable to Minecraft) for x and z. For every part a VBO is generated and stored using GL_STATIC_DRAW.

Problem

The technique described above works fine and with good performance, however it restricts (due to the nature of GL_STATIC_DRAW) modifications that may happen frequently, especially texture animations (that is incrementing texture coordinates to select another sub rectangle in the texture).

Now I'm asking myself how to solve that problem. Switching to GL_DYNAMIC_DRAW seems like an overkill to me, since most of the geometry is static, thus better placed in GPU's memory.

Generating a separate VBO (or even a vertex array?) is an option that came into my mind, however this would greatly increase complexity. Any ideas?

share|improve this question
    
Any reason you can't change the texture coords in a shader? –  James Mar 30 '11 at 16:57
    
What is the max number of states and blocks 16x16x? –  ChrisE Mar 30 '11 at 17:21
1  
With GL_STREAM_DRAW your VBO will function pretty much like regular "vertex arrays". –  c0d3rguy Mar 30 '11 at 18:07
    
@James: Not a single reason. :) I'm just not experienced much with shaders. Any hints for that? @ChrisE: Maximum is 16*16*16. Do you think of allocating the space completely before? @c0d3rguy: Does that imply uploading the data to the GPU every frame? I'm currently very happy with the performance the VBOs give, so if GL_STREAM_DRAW would impact it, that won't be an option. –  Tank Mar 30 '11 at 22:46
1  
@Tank: Well, if you have access to VBO's, you have access to some version of the GLSL shading lang. A vertex shader for manipulating texture coordinates would do what you are asking with minimal performance impact, but it might require a significant change in your rendering system if you are currently using the fixed-function pipeline. –  James Mar 31 '11 at 15:06
show 3 more comments

1 Answer

up vote 1 down vote accepted

Well, if you have access to VBO's, you have access to some version of the GLSL shading lang. A vertex shader for manipulating texture coordinates would do what you are asking with minimal performance impact, but it might require a significant change in your rendering system if you are currently using the fixed-function pipeline.

I would go with c0d3rguy's suggestion and try using the VBO that might be updated as a GL_STREAM_DRAW or GL_DYNAMIC_DRAW and see what the performance impact is. It might prove to work just fine

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.