How to use OpenGL shader language from RapidQ and FreeBasic DLL.

Thanks to DJ Peters for the code. His code is adapted to RapidQ2
https://www.freebasic.net/forum/viewtopic.php?f=8&t=28001

The binary versions are included if you are too lazy to compile. 

Run GLSL_Demo.exe
Open a GLSL file (you can also drag and drop samples onto form)
Open a Texture file if needed (you can also drag and drop samples onto form)
Use F5 key to reload, and open Texture file dialog, select textures, then OK
Space bar toggles rendering loop
The form loses focus to the FB screen (the other widow is hiden) so click the form again to respond.

Details:
OpenGL shader language (GLSL) is a very powerful C like language with some object oriented features.
They are text files that are compiled at run time. You can modify the code by clicking the "code" menu. Changes are not saved.
GLSL uses all the GPU processing power of the computer. This provides parallel computing for very fast rendering and raytracing for realistic 3D images. Now RapidQ has access to massive parallel computing. You have to figure out C coding.
This can be used to do very fast computations if you know how to work it.


How it works:

RapidQ initiates the Freebasic OpenGL engine with ARB extensions (RQ does not support ARB)
All of the important parameters are sent to FreeBasic by a TYPE Structure.
The OpenGL image is transfered back to RapidQ by a QBitmapEx.
The offset is so you can provide mouse coordinate offsets. Just click the form.

Some of my favorites 
Generators
Flux_core
Neptune_Racing  (must load 2 textures too)
Skyline
Planet_ShaderToy
Where_the_River_goes (must load 2 textures too)
Oceanic (must load 1 texture too)


For more examples, see https://www.shadertoy.com/


Issues:
1) Code from ShaderToy may need to modify texture commands for older versions. 
For example, this statement:
finalColor += saturate(texture(iChannel0, ref).xyz-0.35)*0.15*max(0.2,sunShadow);

becomes:
finalColor += saturate(texture2D(iChannel0, ref.xy).xyz - 0.35)*0.15*max(0.2,sunShadow);

2) The software does not support Buffers. If the shaderToy screen has "Buffer A" then the code will not work.

3) The height and width of the QForm affects the view. You may need to modify the code to make the mouse work the way you want. That is why I allow the offsets!

4) Careful with overflow if saving to AVI files. If the screen size is large, decrease MaxAVIFrames.

Enjoy!


