Upgrading the VBOs

So, I decided to fix this thing with only static VBOs. I have never modded an engine before, so I want some help here. I think I can do it, and I have an idea how. I went to the LWJGLRenderer.java and found the OpenGL function that draws it… I think I know how to fix it. I am gonna give it a shot, so if anyone was gonna do it, please give me a shot. Here is my question(specifically to those who know the JME source): should only the vertex buffer be changed or should I change the other parts(i.e. normals, indices, etc.) to have the choice of setting from static to dynamic too?

You have to know when a certain VBO was changed in order to know to update it. That's the issue. You may have "dirtyFlags" on geometry, which will allow you to set flags to update certain VBOs while leave others untouched. The renderer will then check those flags before drawing VBOs and if needed, update the copy on the GPU.

The other part of it is to be able to specify other modes than STATIC_DRAW, this should also go per-buffer, rather than per-mesh. So you need to be able to specify which buffers are likely to be updated and which are not.



You can simplify it if you combine the "dirtyFlags" and usage, then the user can simply say that buffer so and so is updated every frame, and the renderer automatically assumes the data was changed in that buffer.



Anyway I think some more discussion should go about this before actually doing anything. Also I think a cool thing would be if you combine the lock() call (DisplayLists) with the VBO so that the user has a single API to do mesh locking.

Momoko_Fan said:

Anyway I think some more discussion should go about this before actually doing anything.

I second that. jedimace1, at the very least you should share the details of what exactly you are planning to do and how you will achieve it, and how it will be used, to allow for some discussion.

OK, no problem. That’s why I bring this stuff up. This can be a place for discussion. Momko_Fan, I like that idea, it makes it easier for the user to make his game run faster. I wanted to implement some of the ideas in the jME2.1 design document, I like how he does VBO’s there. I was thinking that we would only need to update the vertices and normals, those seem to be the two that change with animation, stuff like colors and texture coordinates don’t change as much I think.

Also, there is no reason someone would not need to use the VBOs. All it does is speed up your application, and it can be static or animated. I see no reason to have it separated from the actual draw functions.

I suggest that you create a benchmark so you can measure the differences. I'm not convinced that changing everything to use VBOs will make things faster. I've found that the extra overhead with VBOs reduces speed.

I am very happy to see this post.  :lol:



According to my experience, Current VBO mode (STATIC_DRAW) with animated object degrades performace.



But other VBO mode can make difference. I think.