glfx syntax

A glfx file is just a plain text file that consists of variables, techniques and comments. A comment starts with // and goes to the end of the line. Anything withing a comment is ignored. Note that all names and identifiers are case-sensitive. You may also check the glfx grammar.

Defining variables

A variable is identified by its name, which may consit of characters, digits (not at the begining) and _. Variables may have following types:

You may specify param before the definition of a variable. This causes the variable to be accessible through effect programming interface (it is called effect parameter then). Note that param modifier is currently not allowed on vertex_shader, fragment_shader and program types.

You may specify a variables value: explicitly (for float, vec2, vec3, vec4) or by calling one of the following functions:

A ; is required at the end of each definition.

Examples of variable definition:

texture2d texBrick = load_texture2d("brick.jpg");
param float time = 0;
vec3 v = (2, 3.5, 1);
param vec4 lightDir;
fragment_shader fs3 = load_fragment_shader("test.frag");
program prog3 = link_program(vs3, fs3, bind_uniform(time, "time"));

Defining techniques

A technique is identified with its name, which has to obey the same rules as a variable. A technique consists of one or more render passes. Each pass is a collection of render states, which may either have explicit value, or reference a variable. Check the glfx render states reference for more information. Referencing a variable has the following form <varName>.

Examples of techniques:

technique Tec0
		FrontPolygonMode = LINE;
		BackPolygonMode = LINE;
		CullFace = NONE;

technique Tec3
		Program = <prog3>;
} Logo