specific project VBO, DL mode advice request

Started by mireazma, February 17, 2014, 12:33:41

Previous topic - Next topic

mireazma

Hello.
I'm starting a little LWJGL project, like a 3D modeller and I want to know which mode is better to use.
From various digging I understood that VBO is the fastest, still not-deprecated and allows editing the model on-the-fly.
On the other hand, I tend to use DL even if deprecated (for older HW compatibility) and for efficiency and for simplicity. I haven't considered other modes yet but neither excluded them.
I want to know your personal opinions and advices in my particular case.
So, the model should render fast for as many triangles as possible, and for adding/removing vertices as well as of course, translating them by user.
About "dynamically" editing the model I didn't get quite it: is it that when you add a vertex to a model, with VBO's you don't have to recreate the whole model over whereas with DL's you have to?

In the case that VBO is adviced, what usage constants should I use?
One other thing to consider is that i want to draw a 2D GUI over the scene, if it matters.

Thank you in advance.

Mickelukas

Hi,

Display lists
Pro:
Compatibility with very old hardware
Performs very good on Nvidia hardware (Par with VBOs in regards to FPS)
Very easy to learn if you already know glvertex3f/glnormal3f and so on
Con:
Slow to build, if the model needs to change it will need to recreate the display list, causing jittery frames per second
Performs worse than VBOs on ATI/Intel hardware
Has limitations if you want to migrate the code to the programmable pipeline

VBO
Pro:
Fast to create
Very fast to update (for example moving an arm/wheel/something in your model)
Consistent FPS on all hardware
Can be prepared on a different thread to increase the fluency of your FPS
Con:
Requires a bit newer hardware
Takes longer to learn if you only know the fixed pipeline

Either is fine to use together with a 2D overlay.

For generic OpenGL questions I recommend posting it on http://www.java-gaming.org instead of here.

Mike

mireazma

Thanks for replying. So can display lists be used with shaders? And I understand that VBO's are fast in the case of moving models but I need to know specifically whether they must be "rebuilt" for adding/removing vertices.
And I know (not for sure) that VOB's are compatible with no older than OpenGL 2.0 / OpenGL ES 2.0 and up.

Cornix

VBO's are compatible with at least 1.5 since they have been added officially at 1.5.
You never "rebuild" VBO's. You can imagine a VBO like an array of floats. You create it once, you give it a fixed size, and then you read/write data to arbitrary positions in the VBO.
When drawing stuff with VBO's you just tell the graphics card which parts of your VBO should be interpreted in which way.

The best part is that the VBO is usually stored on the graphics cards memory and thus is incredibly fast to read by the graphics card. It is the standard way of rendering; its the fastest way and the most flexible and recommended. And they are actually pretty old. Even 10 year old laptops (at least the once I tested with) and older get along with it just fine.

There is really no reason not to use VBO's.

mireazma

I'm convinced that VBO's are the way to go except for that whole code I have to execute every time the number of vertices for the model changes since the buffer is fixed size.
I mean creating the buffers for all vertices and binding them over again for the whole model for a newly added vertex.

But then again, correct me if I'm wrong and confirm if I'm right, I still have to re-create the model from 0 with any of the other modes and even if I don't have to code that many lines again and again (like with much simpler DL) the render process is still faster.
I'm dwelling on this because I can't find the information anywhere else and I'm interested in this particular case with varying number of verts.

Cornix

Look, even if you upload the entire VBO every frame, you are still going to be faster then immediate mode.
The amount of data would be the same! Its just that with VBO's you can transport this data in a bulk instead of splitting it up across several function calls.

Transferring data to the VBO is nothing but a memcopy from your RAM to your VRAM (in most cases). Its fast and its reliable.


Furthermore, if you know that your number of vertices is going to grow, simply allocate a bigger VBO right from the start. You do not need to use all of the VBO for drawing. Again, its just like an array. You can simply have it sit there without being used most of the time, and you always use just as much as you currently need. Then you wont have to do any resizing or anything.

mireazma

Thanks. You made it clear. I'll go with VBO's.