Tag Archives: shader

How to Use a GLSL Program

Let’s suppose you just found this cool GLSL program somewhere on the Net: Vertex shader: #version 120 void main() { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; } Pixel shader: #version 120 void main() { gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); } Now, let’s suppose you want to test it with a mesh torus. The first thing to do is to create a XML node for the GLSL program in the main XML file.