Sign in to follow this  
baldacim

VBO with few vertices

Recommended Posts

baldacim    100
[font=arial, sans-serif][size=2]Hi,

I read somewhere that should not create VBOs with few vertices, since this is getting worse performance than the direct rendering mode. Is this true?

I was creating a VBO for each part of the wall (100x100) of the scene. So that I could implement frustum culling efficiently. But this would imply having several VBOs with only 4 vertices and texture.

But also I thought of joining all vertices of a region of the wall in a single object, so theVBO would not be so small, but that would not be draw on the screen. This approachwould also get the code less intuitive, since the moment I have a class that representsa squared which is part of the wall (receiving as parameter in the constructor when creating the instance the overall position of four vertices).[/size][/font]
[font=arial, sans-serif][size=2]
[/size][/font]
[font=arial, sans-serif][size=2]I'm confused on how to organize my[/size][/font][font=arial, sans-serif][size=2] basic[/size][/font][font=arial, sans-serif][size=2] classes to have a good performance.[/size][/font]
[font=arial, sans-serif][size=2]
Thanks[/size][/font]

Share this post


Link to post
Share on other sites
bluntman    255
Firstly direct rendering is deprecated now as far as I know, and all rendering should use VBOs, IBOs and/or VAOs.
Secondly you should break your geometry up using IndexBufferObjects NOT VertexBufferObjects. My advice would be to pack up to 2**16 verts into a single VBO and then use a few IBOs to draw parts of it. e.g. you could put a few rooms all into a single VBO and then use an IBO for each wall section, door, ceiling, floor sections etc.

But, you probably don't want to cull down to single quads. It is more efficient generally to give the graphics card more work to do rather than to give the CPU more work to do. This is a very simplified statement, obviously there are exceptions, and profiling is the only way to be sure, and even then you are only sure on your own hardware. My advice would be don't cull until you need to. i.e. just render everything and see how fast it is. Chances are it is fast enough. If it isn't then break your geometry into rooms, and do manual PVS (potentially visible sets) and frustum culling. If this is still too slow then you may have a problem which more culling won't solve.

Share this post


Link to post
Share on other sites
V-man    813
[quote name='MidGarD' timestamp='1305772777' post='4812854']
[font="arial, sans-serif"][size="2"]I read somewhere that should not create VBOs with few vertices, since this is getting worse performance than the direct rendering mode. Is this true?
[/size][/font][/quote]

I doubt it.
If you don't optimize your code, then yes, you lose a lot of performance.
Pack a lot of objects into 1 VBO.

Here you go
http://www.opengl.org/wiki/VBO_-_more#Size_of_a_VBO.2FIBO

and also
http://www.opengl.org/wiki/Buffer_Objects
http://www.opengl.org/wiki/General_OpenGL

Share this post


Link to post
Share on other sites
baldacim    100
[color=#888888][font=arial, sans-serif][size=2][color=#000000][size=2]Thanks for the replies. I'll try to use vertex arrays and VBO then to compareperformance, but it's hard to find tutorials for JOGL (I do not understand c + + very well).

I need to create an array of colors if I use texture? Is there any other kind of array formaterials?

My other doubt is about how to use simultaneously more than one texture?? Cause Iwant to do bump mapping, have a texture and other image with the normal, how do Iget to send two images to the GLSL?[/size][/color]

[/size][/font][/color]

Share this post


Link to post
Share on other sites
bluntman    255
[quote name='MidGarD' timestamp='1305909808' post='4813528']
[color="#888888"][font="arial, sans-serif"][size="2"][color="#000000"][size="2"]but it's hard to find tutorials for JOGL (I do not understand c + + very well).[/size][/color][/size][/font][/color]
[/quote]

If you understand Java well, then you should understand the C++ examples well enough to implement them in Java. If you don't understand Java well then I would start there before trying to write complex programs like 3D games.
You should read the GL/GLSL API documentation to find out about binding parameters (including textures) and then come back if you don't understand it or can't get it to work.
This should get you going:
[url="http://www.opengl.org/wiki/GLSL_Sampler#Binding_textures_to_samplers"]http://www.opengl.org/wiki/GLSL_Sampler#Binding_textures_to_samplers[/url]

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