: in the following article, words GLSL Hacker
are swappable! They represent the same software with a different name…
Today we are going to see how to build and render a simple scene that includes a camera, a triangle, a reference grid and a GPU program (in GLSL). GLSL Hacker supports both Lua and Python programming languages. We will use Lua for this article. So let’s go!
GLSL Hacker has a handy object called a grid. A grid is more or less just a collection of lines but that info is not really important. You can use a grid as a reference object when there’s no ground plane in the scene.
To render an image, we need an orthographic camera, a texture GPU program, a quad and the image (a texture).
Let’s suppose you just found this cool GLSL program somewhere on the Net:
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
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.