OpenGL

From DaphneWiki

(Difference between revisions)
Jump to: navigation, search
(started opengl page)
(Texture Map Readers)
Line 19: Line 19:
====Texture Map Readers====
====Texture Map Readers====
sampler1D for 1D texture map, sampler2D for 2D texture map, higher dimensions are apparently supported.
sampler1D for 1D texture map, sampler2D for 2D texture map, higher dimensions are apparently supported.
 +
Samplers cannot be modified by the shader!
 +
Samplers are read using the texture lookup functions texture1D, texture2D, etc.

Revision as of 06:30, 19 November 2007

Contents

OpenGL Shading Language Reference

Variable Qualifiers

attribute

frequently changing values from application to vertex shader

uniform

infrequently changing values from application to any shader (vertex or fragment)

varying

interpolated variables from vertex shader to fragment shader

Built-In Variables

If it begins with "gl_" it is a built-in variable. Example is gl_FragColor.

Variable Types

Scalars (regular C-styled variables)

float, int, bool are all supported. Integers are fairly limited and don't behave like they do in C. See orange book, page 66.

Vectors

vec2, vec3, or vec4 (all floating point)

Matrices

mat2, mat3, mat4 (2x2, 3x3, 4x4 matrix respectively)

Texture Map Readers

sampler1D for 1D texture map, sampler2D for 2D texture map, higher dimensions are apparently supported. Samplers cannot be modified by the shader! Samplers are read using the texture lookup functions texture1D, texture2D, etc.

Personal tools