VBO's and unsigned short with large meshes

Started by
4 comments, last by rick_appleton 17 years, 8 months ago
I am trying to get my terrain mesh to render with unsigned short instead of unsigned long for my index buffer. Problem is I want to render 513x513 or larger meshes. I am using culling to eliminate polygons not in view. Issue is with a unsigned short you can only hold values up to 65k. I been told you can use the same IBO to render the whole terrain? Well only way I see that is using many VBO's to hold the terrain data broken down into x amount of patches I have for my mesh? Unless I am seeing this incorrectly please advise. Thanks
Advertisement
Well, if the patches have the same layout (which I assume they do) then you can add them after each other into the same VBO, and then make separate drawcalls with the same IBO, but with an offset in the VBO to get to whatever patch you're wanting to render.
Quote:Original post by rick_appleton
Well, if the patches have the same layout (which I assume they do) then you can add them after each other into the same VBO, and then make separate drawcalls with the same IBO, but with an offset in the VBO to get to whatever patch you're wanting to render.


If you mean layout as in vertex data e.g. pos, normal, texcoord ect... yes they are all the same. Now my VBO I just loop through all my vetices and assign the data I need, then I dump that data into my VBO with a glBufferData() call. I am doing this already. So are we on the same page still so far?

This is where I think I need to change my layout.

Then I have my patches I loop through and each patch has its own IBO and assign the index order for each patch which so far is e.g. 513x513 alot.


As of now my patch size is 33x33. So with one IBO you would loop through the patches and create a IBO based on that 33x33 patch and only use that one IBO correct? Then you would use an offset in the BUFFER_OFFSET() macro? Excuse me for I have been up for two days straight...
That's not quite what I meant.

I assumed (since your talking terrains) that the patches are regular grids. Hence the IB for one patch would be similar to that of any other with an offset). If you dump the visible patches to VBO, and they all have the same IB+offset then you can use a single IB and put the offset directly into the glVertexPointer/glNormalPointer calls.
Quote:Original post by rick_appleton
That's not quite what I meant.

I assumed (since your talking terrains) that the patches are regular grids. Hence the IB for one patch would be similar to that of any other with an offset). If you dump the visible patches to VBO, and they all have the same IB+offset then you can use a single IB and put the offset directly into the glVertexPointer/glNormalPointer calls.


Hmm I am still not 100% sure on this, but if you are saying call the glPointer*() every frame as many times as I have patches this has got to be expensive?? so in the rendering loop lets say you have 256 loop iterations to loop through to do a complete mesh, but with view frutsum culling this may only be 64, this still seems expensive to call the pointer functions that often vs. just staying with unsigned int?
Well, I'm not sure. 33x33 is pretty small, so you could probably increase that quite a bit. Even then calling it 64 times doesn't sound too bad to me.

This topic is closed to new replies.

Advertisement