GLSL
From GPWiki
The wiki is now hosted by GameDev.NET at wiki.gamedev.net. All gpwiki.org content has been moved to the new server. However, the GPWiki forums are still active! Come say hello. This page is far from complete, go ahead and write some more!
You can extend this page by editing it.
[edit] IntroductionGLSL (a.k.a. glslang) is the OpenGL Shading Language. It's a C-like hi-level language to create OpenGL fragment (pixel) and vertex shaders. To make it simple, a shader is a program that is loaded on the GPU and called for every vertex or pixel: this gives programmers the possibility to implement techniques and visual effects and execute them faster. In modern games lots of shaders are used: lights, water, skinning, reflections and much more. To really understand shaders, you should have a knowledge about the rendering pipeline; this helps to understand where and when the shaders act in the rendering process. In general, you must know that vertex are collected, processed by vertex shaders, primitives are built, then are applied colors, textures and are also called fragment shaders; finally it comes to the rasterization and the frame is put on the buffer. [edit] Language SyntaxThe GLSL has a C-Like syntax. It introduces new types and keywords. To get a detailed view of the language, I suggest the reading of the GLSL specification you can find on OpenGL Shading Language website. [edit] Using a shaderA shader is a program, to be run it must be loaded, compiled and linked. Actually each vertex and fragment shader must have one entry point (the main function) each, but you can create and link more shaders. [edit] Vertex ShaderTODO [edit] Fragment ShaderTODO [edit] See also |


