Looks nice!
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.
Last edited by Petr Schreiber; 19-05-2013 at 15:30.
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Looks nice!
Smart, elegant, flicker free, fast, interpreted and ... just 200 lines of code.
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
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!
Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server
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?
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Yes. On "ATI Radeon Mobility X1600 512Mb"Originally Posted by Petr Schreiber
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Thanks,
great to know GLSL works reliably there!
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Nice tiny shader variable exampler good job.
There is only one mistake in sub Car_Render()
Looks like on code line 212 there are one tbgl_PopMatrix() without a tbgl_PushMatrix() in front.
Internal it would be end in an OpenGL error "matrix stack underrun".
(more harmless as an stack overrun)
Joshy
(Sorry about my bad English.)
Good catch, fixed.
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Bookmarks