GLeffect! Documentation

Note: GLeffect! was originally called GLfx but has been renamed not to cause conflits with glFX API standard developed by the Khronos Group. GLfx name still may appear in the source or documentation.

GLeffect! is a set of components that simplify writing OpenGL demos and applications. Currently it has the following features:

Download

You can get the latest release from SourceForge.net project page. Supported build environments include Visual Studion 2003 and Linux.
The OpenGL Extension Wrangler Library is used internaly to handle OpenGL extensions and FreeType 2 library is used for text rendering.
To compile the sample applications you may require GLUT and DevIL or FreeImage library.

Documentation

This is the documentation ;-) The related pages are a source of useful information.

Getting started

screenshot.jpg

The following source code generated the above image:

texturecube texEnv = load_texturecube("terrain.jpg");
texture2d texNoise = load_texture2d("noise.jpg");

vertex_shader vs5 = compile_vertex_shader("
	varying vec3 normal;
	varying vec3 position;
	void main() {
		gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
		position = gl_ModelViewMatrix * gl_Vertex;
		normal = vec3(gl_ModelViewMatrix * vec4(gl_Normal, 0.0));
		gl_TexCoord[0] = gl_MultiTexCoord0;
	}
");

fragment_shader fs5 = compile_fragment_shader("
	uniform samplerCube texEnv;
	uniform sampler2D texNoise;
	varying vec3 normal;
	varying vec3 position;
	void main() {
		vec3 n = normal + 0.1 * texture2D(texNoise, gl_TexCoord[0].xy).xyz;
		n = normalize(n);
		vec3 p = normalize(position);
		gl_FragColor = textureCube(texEnv, reflect(p, n));
	}
");

program prog5 = link_program(vs5, fs5, bind_sampler(0, "texEnv"), bind_sampler(1, "texNoise"));

technique Tec5
{
	pass
	{
		Program = <prog5>;
		Texture[0] = <texEnv>;
		Texture[1] = <texNoise>;
	}
}

The inteface to this library is extremly simple so you shouldn't have problems getting started just by browsing class documentation. A few simple demo applications are also provided with this distribution.


SourceForge.net Logo