Some simple code to accelerate your OpenGL program

BlitzMax Forums/BlitzMax Programming/Some simple code to accelerate your OpenGL program

JoshK(Posted 2007) [#1]
I'd be interested in hearing what results you get with this. My renderer already does a pretty good job of minimizing texture switches, but if you are just chucking textures at the GPU, this could make a big difference:
http://blitzmax.com/codearcs/codearcs.php?code=2147


Derron(Posted 2007) [#2]
Ok, this seems just to be useful if using this 2 commands.

I'm not at home now to check wether I could change all occourencies of the commands in glmax2d.bmx. Would OpenGL in Bmax benefit from it at all?


bye
MB


JoshK(Posted 2007) [#3]
My guess is it will probably depend on the driver.


Dreamora(Posted 2007) [#4]
BM only switches the texture currently if it is already different from the one bound.
thats the reason that batching does not make any serious difference as well.


JoshK(Posted 2007) [#5]
Batching will still make a serious difference regardless.


ImaginaryHuman(Posted 2007) [#6]
It looks like all your code is doing is keeping a list of texture references and making sure not to do a bind texture if the texture is already bound. Does this really have any significant improvement, and are you trying to have this do something else that I didn't figure out?


JoshK(Posted 2007) [#7]
Yes, that's it.

I saw a very slight improvement in speed, but my renderer already avoids redundant texture switches.

I have heard that OpenGL doesn't do any checking of the currently bound texture...it just does exactly what you tell it to do. However, that could vary with the driver.

This would make the most difference in a situation where you have a lot of textures being displayed in no particular order.


ImaginaryHuman(Posted 2007) [#8]
Ahh yea,

Another good solution would be to craft your game or whatever's pipeline to draw things in a good order for optimal performance.