Post by DJLinux on Dec 19, 2008 20:42:05 GMT -5
Obsolete: use the newer GL Shader Language Plugin
you can get it here
only a test for shader language support in Basic4GL
(the final plug in will get it's own Forum thread)
tutorial:
www.lighthouse3d.com/opengl/glsl/
specification:
shader_objects.txt
vertex_shader.txt
fragment_shader.txt
shading_language_100.txt
first i can't teach you in writing cool shaders it's totally new for me too
but I'm sure we all can make a large collection of FREE shader codes
Download: ARBShaderPlugin.zip
tips for beginners like me
don't use this killer main loop
init_your_shader()
while TRUE
...
use_your_shader()
...
wend
free_your_shader()
if you press [ESCAPE] the IDE stops your code and the part
"free_your_shader()" will never be called
one solution is use this options inside the IDE
NOTE 1:
you can create fragment shaders too
hShader=glCreateShaderObjectARB(GL_FRAGMENT_SHADER)
or both together
hFragment=glCreateShaderObjectARB(GL_FRAGMENT_SHADER)
hVertex=glCreateShaderObjectARB(GL_VERTEX_SHADER)
'
glShaderSourceARB(hFragment,FragmentCode$)
glShaderSourceARB(hVertex,VertexCode$)
'
glCompileShaderARB(hFragment)
glCompileShaderARB(hVertex)
'
hProgram=glCreateProgramObject()
'
glAttachObjectsARB(hProgram,hVertex)
glAttachObjectsARB(hProgram,hFragment)
'
' link both shaders
glLinkProgramObjectARB(hProgram)
'
' use both shaders
glUseProgramObjectARB(hPrograms)
...
NOTE 2:
you need to create the shader and program object only once
you can set new code and compile it on the fly again and again
happy coding and thanx for testing
Joshy
you can get it here
only a test for shader language support in Basic4GL
(the final plug in will get it's own Forum thread)
tutorial:
www.lighthouse3d.com/opengl/glsl/
specification:
shader_objects.txt
vertex_shader.txt
fragment_shader.txt
shading_language_100.txt
first i can't teach you in writing cool shaders it's totally new for me too
but I'm sure we all can make a large collection of FREE shader codes
Download: ARBShaderPlugin.zip
tips for beginners like me
don't use this killer main loop
init_your_shader()
while TRUE
...
use_your_shader()
...
wend
free_your_shader()
if you press [ESCAPE] the IDE stops your code and the part
"free_your_shader()" will never be called
one solution is use this options inside the IDE
' here are the steps to create and compile a shader:
dim hShader=glCreateShaderObjectARB(GL_VERTEX_SHADER)
glShaderSourceARB(hShader,Code$)
glCompileShaderARB(hShader)
'
' here are the steps to create and link a program:
dim hProgram=glCreateProgramObjectARB()
glAttachObjectARB(hProgram,hShader)
glLinkProgramARB(hProgram)
glUseProgramObjectARB(hProgram)
NOTE 1:
you can create fragment shaders too
hShader=glCreateShaderObjectARB(GL_FRAGMENT_SHADER)
or both together
hFragment=glCreateShaderObjectARB(GL_FRAGMENT_SHADER)
hVertex=glCreateShaderObjectARB(GL_VERTEX_SHADER)
'
glShaderSourceARB(hFragment,FragmentCode$)
glShaderSourceARB(hVertex,VertexCode$)
'
glCompileShaderARB(hFragment)
glCompileShaderARB(hVertex)
'
hProgram=glCreateProgramObject()
'
glAttachObjectsARB(hProgram,hVertex)
glAttachObjectsARB(hProgram,hFragment)
'
' link both shaders
glLinkProgramObjectARB(hProgram)
'
' use both shaders
glUseProgramObjectARB(hPrograms)
...
NOTE 2:
you need to create the shader and program object only once
you can set new code and compile it on the fly again and again
happy coding and thanx for testing
Joshy