Sign in to follow this  
MARS_999

VBO's and unsigned short with large meshes

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

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