Performance Issues

BlitzMax Forums/OpenGL Module/Performance Issues

StormK(Posted 2011) [#1]
I am not sure what BlitzMax does when calls to DrawImage are made, but from what I have heard using Vertex Buffer Objects to create some sort of sprite batch is the solution to most performance issues. Does anyone here have any experience with doing this in BlitzMax?


Noobody(Posted 2011) [#2]
Max2D uses the immediate mode in OpenGL, which is, while very intuitive to use, considerably slower compared to the other methods available. Nevertheless I wouldn't suggest writing your own implementation unless you're really having performance problems. I found VBOs to be quite hard to get into, and you'll lose the DirectX driver, which is quite useful to keep for compatibility and performance reasons.

Also, if you draw mostly unique images, VBOs won't make a huge difference in performance. Using an image (or parts of it) multiple times, in tilemaps for example, will take quite a toll on the performance with immediate mode though, so if you use that a lot, taking a look at VBOs would be worth considering.

Other than that, implementing VBOs in BMax is no different to any other language. In fact, BMax makes it very easy thanks to GLGraphics which takes care of window initialization for you; all the necessary functions are also already wrapped in Pub.opengl. I don't have any experience as to making your own draw calls work in conjunction with Max2D, but from what I've seen this shouldn't be much of a problem.

If you're interested, I could post the wrapper class for VBOs I've been using so far in my projects. Unfortunately, it's part of a framework I've been using as a replacement for Max2D, so using it out of context may be be a little confusing.