VBOs (VAO, UBOs, SSBOs, TBOs.... ) for GLSL-shaders in the bge


since some time I take a look into the “GLSl-world” and figure out how to write shaders and how to use them in the bge…
Now after I have some basic knowledge and experience (more or less:D) I think it would be nice if we could use Vertex Buffer Objects and similar methods to store data to the GPU memory in the bge to save transfer time for data that don’t must pass to the gpu every frame (or other advantages).

But by default it’s not possible to do this in the bge (so far I know).
I think it could be possible to create and bind VBOs with bgl or OpenGl (pyOpenGL) like hg1 it use for some other features that are not available in the bge by default.

But before I spend much time to figure out how to do that I want to know what you think about that. Do you think it’s works and it’s possible to use VBOs (and the other things) in shaders in the bge or will it not work even with this trick in the bge at the moment ?


Maujoe :wink:

It is hard to say if the BGE uses VBOs or not. If it does, that code would reside in the C++ render pipeline. Have you audited the C++ source to see if it is using VBO’s or not?

The BGE was using a fairly old version of OpenGL to support older hardware that don’t have GPUs. I think that is the biggest stumbling block you will have with trying to take advantage of these features.

I do agree that if these buffers are not being used, then taking advantage of them would probably bring a good speed-up. That is why they were added to the spec, after all.

If you’re building Blender from source, change this #if 0 to an #if 1 to enable the VBO option for raster storage:
[https://developer.blender.org/diffusion/B/browse/master/source/blender/makesrna/intern/rna_scene.c;ec64bf17e37122d67094f3ba8c9af0d48a856d0c$3772](http://VBOS are currently disabled since they cannot beat vertex array with display lists in performance.)

As to why they are disabled, there is this comment:

VBOS are currently disabled since they cannot beat vertex array with display lists in performance.

Is it true though?

can use a vertex array and display list for instancing? tessellation ? etc?

nvidia loves display list (from what I have read) even though they are being depreciated ?

ATI hates them?

Okay, thanks for the informations.
I’ve nerver looked into the blender/bge source, but I will try to take a look in the source to know what’s going on.

But Moguri I don’t know what you want to show me with the link because for me your link don’t work and when I copy it into the searchbar I come to the website but I only get this:

Unhandled Exception (“Exception”)
Unexpected object type from git cat-file: ec64bf17e37122d67094f3ba8c9af0d48a856d 0c missing

Okay and I have another qestion because the first reason why I want to use these features is that I try to make a particel system in the bge with glsl so that the most work will move to the gpu. But I think it makes not really sense to do that without storing some data on the gpu because otherwise I must calculate the movement of the particels on the cpu for every frame and transper it to the gpu and that cost to much performance and produce to much transfer between cpu and gpu or not?

Therefore, my question is whether there is a way to make a simple particel system with glsl, maybe with some tricky ways with sine curves or something like that, if I don’t get it work to save data on gpu?