GLSL framework for BlitzMax

BlitzMax Forums/OpenGL Module/GLSL framework for BlitzMax

taumel(Posted 2011) [#1]
I have to do some image heavy stuff and after trying it out in BlitzMax directly (single as well as threaded) i got frustrated by the speed results, so the only option was to use the GPU.

Now after i got it running i was wondering if there also exists some lightweight framework for GLSL usage in BlitzMax.

I know that there exists glsl.bmx. As the copyright is unknown, can you use this without any problems and does there exist some more information/docs about it beside of comment fields in the code?


xlsior(Posted 2011) [#2]
duct.mod/protog2d.mod has a bunch of shader routines for Blitzmax:

https://github.com/komiga/duct-max


Noobody(Posted 2011) [#3]
Here's a TShader class I always use in GLSL experiments, with a small GLSL Mandelbrot example:



It supports the basic operations, such as loading from strings or files, compiler/linker error handling, compatibility checks and enabling/disabling the shader.


ImaginaryHuman(Posted 2011) [#4]
Cool, thanks for sharing. this'll come in handy.


taumel(Posted 2011) [#5]
Thanks @xlsior and @Noobody as well.

I also tested my Julia code i did once and it's just a shame how slow it is compared to the GPU version, same with a less intensive copper plasma, it all was about 20x faster than the CPU threaded versions.

Actually it would be interesting using the GPU shaders for visualising and calculating a 2D game. With a proper GPU this should enable a new interesting gameplay.

@Noobody
I just tried your example, got some freaky mandbrot set, and after some zooming it boomed my machine.

Last edited 2011


ImaginaryHuman(Posted 2011) [#6]
It works fine for me. The coloring isn't what I typically see for mandelbrodts but kinda funky. Works pretty fast for me, mostly 60fpsish. And your framework is pretty handy for setting up the shaders.

Last edited 2011


Noobody(Posted 2011) [#7]
I just tried your example, got some freaky mandbrot set, and after some zooming it boomed my machine.

If you have an old graphics card, it is possible that it isn't fast enough to execute the inner loop inside the shader for real-time rendering. Depending on your drivers, this can have different outcomes - either your driver resets or the machine freezes (operating systems really don't like it if one application hogs the graphics card). I'm interested in your machine though, since even my shitty 3 year old laptop with Intel GMA is able to render it at 30-60fps :)

So basically, it's more of a problem with the shader, not the framework.

The coloring isn't what I typically see for mandelbrodts but kinda funky.

Regular mandelbrot coloring is a bit boring, so I added in a few simple orbit traps to mix it up a little. If you're interested, I talked a bit about them in this blog post. The color gradients are admittedly not very pretty, it was just something I still had lying around.


taumel(Posted 2011) [#8]
MacBookPro 2.53GHz, 4GB RAM, GT330M, OSX 10.6.8.

I had no crashes so far with the things i did, also tesuje's shaderexamples work fine here. The only other thing which freezes a part of my machine is returning from fullscreen to windowed mode with Unity's webplayer whilst certain new image effects are enabled.