2 Attachment(s)
Basic example on passing value from ThinBASIC to shader
GLSL shaders are indeed very useful tool for creating unusual graphic output.
Sometimes you need to change shader behavior after compilation dynamically.
There is interesting mechanism, which allows change shader variable values according to your ThinBASIC variables.
The magic OpenGL commands to achieve this are two:
glGetUniformLocationARB - to retrieve "pointer" to shader variable
glUniform1fARB - to change variable located at "pointer" to other floating point value
The attached script demonstrates this technique in the easiest way. Just use slider to modify the variable value and watch the impact on shader in realtime.
Note: As this script demonstrates advanced technique, your card must be GLSL compatible. That means ideally support for OpenGL 2.0 or OpenGL 1.5 with extensions. Tested on GeForce 9500GT.
Re: Basic example on passing value from ThinBASIC to shader
Re: Basic example on passing value from ThinBASIC to shader
Smart, elegant, flicker free, fast, interpreted and ... just 200 lines of code.
:D
Re: Basic example on passing value from ThinBASIC to shader
Petr, when do you find the time? I know how busy you are and yet you throw us surprises often. I guess just like Eros and Mike you guys find a way!
Re: Basic example on passing value from ThinBASIC to shader
Hi Kent,
nice to see you here after while!
I have less free time comparing to past years, but the passion still moves things forward.
Eros, thanks :) Did you tested it on ATi?
Re: Basic example on passing value from ThinBASIC to shader
Quote:
Originally Posted by Petr Schreiber
Eros, thanks :) Did you tested it on ATi?
Yes. On "ATI Radeon Mobility X1600 512Mb"
Re: Basic example on passing value from ThinBASIC to shader
Thanks,
great to know GLSL works reliably there!