OpenGL Programming

OpenGL ranting…

As I said before on an other post, I’m a big bug stumbler. I’m attracted by them. So you can imagine what was my experience with beta OpenGL drivers. Hell. Things working on my machine, not working on others, things not working at all, blue screens, hitting unoptimized paths with low performance… and the list can go on and on. Its ok it was beta features, no hard feelings (even if for D3D is was standar). My problem is that even now things are not that good. Yes there is GLSL finaly. It doesn’t work good (or the same) on all video cards, but it is very well designed. Some day it will be stable.

When VBO came close to being a feature I tried to implement them in Sylphis3D. I used a GF3 video card back then and the implementation when smooth. I found mapping buffers very handy and used that for updateing the buffers. Sylphis3D shows some kind of fps gains and I am happy. Later on my GF3 literally explodes (no relation to VBO hopefully) so I buy an ATI Radeon 9600 and I am happy again. Unfortunately only until I run Sylphis3D. The engine was running at 1fps! Profiling revealed the problem was the code writting to mapped memory. It turns out ATI didn’t like maped access to the buffers. So little Harry had to rewrite major parts of the engine to use glBufferData() – a function to upload chunks of data to a buffer. Anyway I can see that positively as most of the times I rewrite something I write it better, so thanks to OpenGL, Sylphis3D is a far better engine now. To get back to the subject, I never found the updated VBOs to be any faster than regular in RAM buffers. Static VBOs are very fast but dynamic have no gain. Actually I have witnessed cases where it is actually slower. To me this is unacceptable! It always have to be faster. I mean in one case you suddenly and out of the blue issue a glDrawElements() and in the other the driver has the data handed to it way before, with known size, with time to upload it while the CPU does other work. But you learn to accept things like that, as long as you at least have no loss.

The thing that boiled over the pot was element array buffer. Until now I didn’t use element VBO so yesterday I went on to use it, to get some extra boost. Crap. I didn’t benchmark static element VBO, as I suppose that is faster. But dynamic element VBO has serius problems. And we are not talking about updating with memory mapping that we now know ATI does not like. I use glBufferSubData(). The performance when using element VBO drops to 1fps. I’m hitting a software path again! Yes I know I might be doing something wrong, but don’t bet your money on that. After all it is not rocket science. I’m calling 2 functions, how wrong can that be done? And it is not that I didn’t check it closesly. I spend some hours on it. I even put DOOM3 under OpenGL interception to see how it uses element VBO. Guess what : DOOM 3 does not use element VBO!!! To me this is ridiculous. This is an implementation fault and it is not that VBO came out yesterday.

It is true and anyone can see that OpenGL got where it is feature wise because of Quake engines and John Carmack. Yes OpenGL is used in more than games. But games require the latest features of the hardware to be exposed and want it now. And all of this time OpenGL was lagging behind, even with DOOM 3 pushing it hard forward. 99% of OpenGL applications outside games use OpenGL 1.1, immediate mode. Why should nVidia and ATI further support OpenGL when DOOM 3 can run in Direct 3D? For the scientific projects that use OpenGL? I’m sure they can live without decent render-to-texture.

And Carmack comes out and says that D3D will be his primary development platform! While on the other hand says, “ATI and Nvidia both still like the idea of being able to do more focused optimization work in OpenGL”. Come on! What focused optimization?! I think that he is just trying to pull our leg while swiching bigtime to D3D. And there is no wrong in that, but don’t say that with OpenGL you will be able to get access to hardware features early through extensions.. bla.. bla.. bla.. We don’t have stable GLSL, FBO and good VBO yet!

The only hope for survival of OpenGL is the PlayStation 3, and that only if we are talking about a standar OpenGL implementation, not some kind of OpenGL, full of vendor specific wierd extensions.

And to all that add that Microsoft says that Windows Vista will run OpenGL in emulation… ahhh.. I better check if the D3D tutorials downloaded…