1
\$\begingroup\$

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?

\$\endgroup\$
7
  • \$\begingroup\$ Any reason you can't change the texture coords in a shader? \$\endgroup\$
    – James
    Mar 30, 2011 at 16:57
  • \$\begingroup\$ What is the max number of states and blocks 16x16x? \$\endgroup\$
    – ChrisE
    Mar 30, 2011 at 17:21
  • 1
    \$\begingroup\$ With GL_STREAM_DRAW your VBO will function pretty much like regular "vertex arrays". \$\endgroup\$
    – c0d3rguy
    Mar 30, 2011 at 18:07
  • \$\begingroup\$ @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. \$\endgroup\$ Mar 30, 2011 at 22:46
  • 1
    \$\begingroup\$ @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. \$\endgroup\$
    – James
    Mar 31, 2011 at 15:06

1 Answer 1

1
\$\begingroup\$

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

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .