Game Development Reference
In-Depth Information
Geometry Shaders
Geometry shaders can add and remove vertices from a mesh. They are used to generate
geometry or to add volumetric detail to existing meshes that would be too costly to process
on the CPU.
GLSL
GLSL is the OpenGL ES 3.1 Shading Language for programming vertex and fragment
shaders that has been adapted for embedded platforms. It is meant to work together with
OpenGL ES 1.1 to minimize the cost and power consumption of embedded devices like
smartphones.
Tip OpenGL ES 3.1 removes fixed-point functionality commonly used in desktop OpenGL and
replaces it with shader for power savings critical on smartphones and other embedded systems.
At the implementation level, GLSL is actually two closely related languages: vertex shader
and fragment shader.
Vertex Shader Language (VSL)
At its simplest, VSL is a C-style program to manipulate the attributes of a vertex. The
following fragment defines a simple vertex shader to set the rendering position to the
position of the current vertex:
void main(void)
{
// This is a C++ style comment
/* This is a C style comment */
gl_Position = gl_Vertex;
}
As you can see, the shader has a C-style syntax with main function where you simply
declare GLSL instructions. In this case, you use two built-in variables:
gl_Position : Sets the position of the vertex to be rendered.
gl_Vertex : Contains the position of the current vertex being processed.
 
 
Search WWH ::




Custom Search