C-Functions for using


Functions

GLSLAPI void GLSLAPIENTRY glslPush ()
GLSLAPI void GLSLAPIENTRY glslPop ()
GLSLAPI GLSLprogram GLSLAPIENTRY glslCreateProgram ()
GLSLAPI void GLSLAPIENTRY glslAttachShader (GLSLprogram obj, const char *filename, GLSL_ShaderType shaderType)
GLSLAPI void GLSLAPIENTRY glslAttachVertexShader (GLSLprogram obj, const char *filename)
GLSLAPI void GLSLAPIENTRY glslAttachFragmentShader (GLSLprogram obj, const char *filename)
GLSLAPI void GLSLAPIENTRY glslAttachShaderFromMemory (GLSLprogram obj, const char *prog, size_t size, GLSL_ShaderType shaderType)
GLSLAPI void GLSLAPIENTRY glslAttachVertexShaderFromMemory (GLSLprogram obj, const char *prog, size_t size)
GLSLAPI void GLSLAPIENTRY glslAttachFragmentShaderFromMemory (GLSLprogram obj, const char *prog, size_t size)
GLSLAPI void GLSLAPIENTRY glslLinkProgram (GLSLprogram obj)
GLSLAPI void GLSLAPIENTRY glslDeleteProgram (GLSLprogram obj)
GLSLAPI void GLSLAPIENTRY glslEnableProgram (GLSLprogram obj)
GLSLAPI void GLSLAPIENTRY glslDisableProgram (GLSLprogram obj)
GLSLAPI void GLSLAPIENTRY glslDisable ()
GLSLAPI const char *GLSLAPIENTRY glslGetLastErrorString ()
GLSLAPI void GLSLAPIENTRY glslSetErrorCallback (GLSLerrorCallback pCallback, void *callbackParam)
GLSLAPI GLSLbool GLSLAPIENTRY glslHasError ()
GLSLAPI void GLSLAPIENTRY glslBindAttribute (GLSLprogram obj, GLSLint32 attrIndex, char *name)
GLSLAPI GLSLint32 GLSLAPIENTRY glslGetUniformParameterCount (GLSLprogram obj)
GLSLAPI void GLSLAPIENTRY glslSetParameterf (GLSLprogram obj, const char *name, GLSLint8 size, const GLSLfloat32 *value)
GLSLAPI void GLSLAPIENTRY glslSetParameter1f (GLSLprogram obj, const char *name, const GLSLfloat32 value)
GLSLAPI void GLSLAPIENTRY glslSetParameter2f (GLSLprogram obj, const char *name, const GLSLfloat32 *value)
GLSLAPI void GLSLAPIENTRY glslSetParameter3f (GLSLprogram obj, const char *name, const GLSLfloat32 *value)
GLSLAPI void GLSLAPIENTRY glslSetParameter4f (GLSLprogram obj, const char *name, const GLSLfloat32 *value)
GLSLAPI void GLSLAPIENTRY glslSetParameteri (GLSLprogram obj, const char *name, GLSLint8 size, const GLSLint32 *value)
GLSLAPI void GLSLAPIENTRY glslSetParameter1i (GLSLprogram obj, const char *name, const GLSLint32 value)
GLSLAPI void GLSLAPIENTRY glslSetParameter2i (GLSLprogram obj, const char *name, const GLSLint32 *value)
GLSLAPI void GLSLAPIENTRY glslSetParameter3i (GLSLprogram obj, const char *name, const GLSLint32 *value)
GLSLAPI void GLSLAPIENTRY glslSetParameter4i (GLSLprogram obj, const char *name, const GLSLint32 *value)
GLSLAPI void GLSLAPIENTRY glslSetMatrixParameter (GLSLprogram obj, const char *name, GLSLint8 size, const GLSLfloat32 *mat, GLSLbool trans)
GLSLAPI void GLSLAPIENTRY glslSetMatrixParameter4 (GLSLprogram obj, const char *name, const GLSLfloat32 *mat, GLSLbool trans)
GLSLAPI void GLSLAPIENTRY glslSetMatrixParameter9 (GLSLprogram obj, const char *name, const GLSLfloat32 *mat, GLSLbool trans)
GLSLAPI void GLSLAPIENTRY glslSetMatrixParameter16 (GLSLprogram obj, const char *name, const GLSLfloat32 *mat, GLSLbool trans)
GLSLAPI void GLSLAPIENTRY glslSetTexture (GLSLprogram obj, const char *name, GLSLuint32 texture_unit)
GLSLAPI GLint GLSLAPIENTRY glslGetUniformLocation (GLuint active_program, const char *name)
GLSLAPI void GLSLAPIENTRY glslCreateProgram_Quick (GLSLprogram *new_program, char *vshader_filename, char *fshader_filename)

Function Documentation

GLSLAPI void GLSLAPIENTRY glslAttachFragmentShader ( GLSLprogram  obj,
const char *  filename 
)

Attach a fragment shader program.

See also:
glslAttachShader()

Definition at line 307 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslAttachFragmentShaderFromMemory ( GLSLprogram  obj,
const char *  prog,
size_t  size 
)

Attach a fragment shader program.

See also:
glslAttachShader()

Definition at line 319 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslAttachShader ( GLSLprogram  obj,
const char *  filename,
GLSL_ShaderType  shaderType 
)

This will attach any shader to the existent program. You have to call this after you have created the program. The given file will be loaded, compiled and attached to the program. If there was any error, callback will be called and last error string will contain information about the error.

Parameters:
obj Shader program created before
filename File name of the shader program
shaderType Type of the shader program. It can be either:
  • GLSL_VERTEX if file contains vertex program
  • GLSL_FRAGMENT if file contains fragment program

Definition at line 254 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslAttachShaderFromMemory ( GLSLprogram  obj,
const char *  prog,
size_t  size,
GLSL_ShaderType  shaderType 
)

Same as glslAttachShader, but here you attach shaders from a character array containing the program. This allows you to use your own file loading routine for loading the programs.

Parameters:
obj Program object created before
prog String containing the program
size Size of the given string
shaderType Type of the shader you want to attach
See also:
glslAttachShader()

Definition at line 207 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslAttachVertexShader ( GLSLprogram  obj,
const char *  filename 
)

Same as glslAttachShader, but attaches a vertex shader program

See also:
glslAttachShader()

Definition at line 301 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslAttachVertexShaderFromMemory ( GLSLprogram  obj,
const char *  prog,
size_t  size 
)

Same as glslAttachShaderFromMemory, but attaches a vertex shader program

See also:
glslAttachShaderFromMemory()

Definition at line 313 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslBindAttribute ( GLSLprogram  obj,
GLSLint32  attrIndex,
char *  name 
)

Just bind an attribute index to a name of attribute parameter in the glsl program.

Parameters:
obj Program object created before
attrIndex index of the attribute used in your application
name Name of the attribute in the glsl program
Note:
If the program was already linked, so it will be relinked again, because all bounded attributes has to be linked with the program

Definition at line 326 of file glslShader.c.

GLSLAPI GLSLprogram GLSLAPIENTRY glslCreateProgram (  ) 

Here we create the program object so it can be filled out with shader programs (more than one is allowed for each kind of shaders). After that you have to compile it, to allow using of it.

Returns:
GLSL program object that will be used later to access to the program

Definition at line 178 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslCreateProgram_Quick ( GLSLprogram new_program,
char *  vshader_filename,
char *  fshader_filename 
)

Quick initialization of a GLSLprogram. This method will load the files and link the programm.

Parameters:
new_program Pointer to the GLSLprogram object, which should be initialized
vshader_filename Filename of a file containing the vertex shader program
fshader_filename Filename of file containing fragment shader program

Definition at line 847 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslDeleteProgram ( GLSLprogram  obj  ) 

Delete the program and release used memory.

Parameters:
obj Shader program created before

Definition at line 559 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslDisable (  ) 

This function will disable all currently active shader programs

Definition at line 821 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslDisableProgram ( GLSLprogram  obj  ) 

Disable the programm. So default OpenGL's pipeline will be used by rendering the coming data.

Parameters:
obj Program to be deisbaled

Definition at line 815 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslEnableProgram ( GLSLprogram  obj  ) 

Enable and bind the program for using in the next rendering steps.

Parameters:
obj SHader program created before.

Definition at line 808 of file glslShader.c.

GLSLAPI const char* GLSLAPIENTRY glslGetLastErrorString (  ) 

Returns the last error produced by GLSL compiler or linker. So if your programm does not load, you can find information about the error here.

Definition at line 141 of file glslShader.c.

GLSLAPI GLint GLSLAPIENTRY glslGetUniformLocation ( GLuint  active_program,
const char *  name 
)

Return opengl's location index of an uniform.

Parameters:
active_program Program containing the uniform
name Name of the uniform

Definition at line 832 of file glslShader.c.

GLSLAPI GLSLint32 GLSLAPIENTRY glslGetUniformParameterCount ( GLSLprogram  obj  ) 

Returns the number of uniform parameters used in programs.

Note:
If you have any parameters that are not in use, so they will be removed by glsl compiler.

Definition at line 826 of file glslShader.c.

GLSLAPI GLSLbool GLSLAPIENTRY glslHasError (  ) 

Returns 1 if there is an error. 0 otherwise

Definition at line 634 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslLinkProgram ( GLSLprogram  obj  ) 

After you have created the program object and attached shader files to it you should link the program. Linking will help to connect varying variables between vertex and fragment shader. Also it helps to connect used shader libraries function within shader objects.

You have to call this function before you can use the GLSL program, otherwise nothing happens.

Parameters:
obj Shader program created before.

Definition at line 498 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslPop (  ) 

Get the last program from the stack and use it.

See also:
glslPush();

Definition at line 133 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslPush (  ) 

This function is acting like glPushMatrix function. It will push your current program on the stack and will disable it. After the program is on the stack you can use other programs until you pop the program from the stack back.

Example: glslCreateProgram(...); glslAttachShader(...); glslLinkProgram(...); glslEnableProgram(...); ... glslPush(); // this wil push current program on the stack, so it can be restored later glslDisable();// here you disable running glsl program ... // Do something without shading glslPop(); // from here the program will continue to run

Note:
This mechanism will only work if you use the glsl* functions. If you enable or disable any program without using of glslEnable(), glslDisable() the behavior of the stack operations is not defined

Definition at line 125 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslSetErrorCallback ( GLSLerrorCallback  pCallback,
void *  callbackParam 
)

Set the callback function which will be called if any error occurs.

Definition at line 640 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslSetMatrixParameter ( GLSLprogram  obj,
const char *  name,
GLSLint8  size,
const GLSLfloat32 *  mat,
GLSLbool  trans 
)

Same as glslSetParameterf() but here you set matricies as parameters.

Parameters:
obj Shader program created before
name Parameter name
size Size of the parameter (mat4 => size=16)
mat Pointer containing the matrix
trans If 0 the matrix will be not transposed through OpenGL, otherwise yes
Note:
At now there is only support for values with the length 4,9,16 according to GLSL's mat2, mat3, mat4

Definition at line 741 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslSetMatrixParameter16 ( GLSLprogram  obj,
const char *  name,
const GLSLfloat32 *  mat,
GLSLbool  trans 
)

Same as glslSetMatrixParameter but used for fixed length of the matrix

See also:
glslSetMatrixParameter()

Definition at line 778 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslSetMatrixParameter4 ( GLSLprogram  obj,
const char *  name,
const GLSLfloat32 *  mat,
GLSLbool  trans 
)

Same as glslSetMatrixParameter but used for fixed length of the matrix

See also:
glslSetMatrixParameter()

Definition at line 767 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslSetMatrixParameter9 ( GLSLprogram  obj,
const char *  name,
const GLSLfloat32 *  mat,
GLSLbool  trans 
)

Same as glslSetMatrixParameter but used for fixed length of the matrix

See also:
glslSetMatrixParameter()

Definition at line 772 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslSetParameter1f ( GLSLprogram  obj,
const char *  name,
const GLSLfloat32  value 
)

Same as glslSetParameterf but only for parameters with a length of 1

See also:
glslSetParameterf

Definition at line 673 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslSetParameter1i ( GLSLprogram  obj,
const char *  name,
const GLSLint32  value 
)

Same as glslSetParameteri but only for parameters with a length of 1

See also:
glslSetParameteri

Definition at line 719 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslSetParameter2f ( GLSLprogram  obj,
const char *  name,
const GLSLfloat32 *  value 
)

Same as glslSetParameterf but only for parameters with a length of 2

See also:
glslSetParameterf

Definition at line 679 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslSetParameter2i ( GLSLprogram  obj,
const char *  name,
const GLSLint32 *  value 
)

Same as glslSetParameteri but only for parameters with a length of 2

See also:
glslSetParameteri

Definition at line 725 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslSetParameter3f ( GLSLprogram  obj,
const char *  name,
const GLSLfloat32 *  value 
)

Same as glslSetParameterf but only for parameters with a length of 3

See also:
glslSetParameterf

Definition at line 684 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslSetParameter3i ( GLSLprogram  obj,
const char *  name,
const GLSLint32 *  value 
)

Same as glslSetParameteri but only for parameters with a length of 3

See also:
glslSetParameteri

Definition at line 730 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslSetParameter4f ( GLSLprogram  obj,
const char *  name,
const GLSLfloat32 *  value 
)

Same as glslSetParameterf but only for parameters with a length of 4

See also:
glslSetParameterf

Definition at line 689 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslSetParameter4i ( GLSLprogram  obj,
const char *  name,
const GLSLint32 *  value 
)

Same as glslSetParameteri but only for parameters with a length of 4

See also:
glslSetParameteri

Definition at line 735 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslSetParameterf ( GLSLprogram  obj,
const char *  name,
GLSLint8  size,
const GLSLfloat32 *  value 
)

Float version. This function will set new value for the given parameter in glsl program. Parameters should be definded as uniform in your program. Because you can load more than one file for one program it is safer to use different names for parameters.

Parameters:
obj Shader program created before
name Parameter name
size Size of the parameter (vec4 => size=4)
value Pointer containing vector of data for the parameter
Note:
At now there is only support for values with the length 1,2,3,4 according to GLSL's float, vec2, vec3, vec4

Definition at line 647 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslSetParameteri ( GLSLprogram  obj,
const char *  name,
GLSLint8  size,
const GLSLint32 *  value 
)

Integer version.

See also:
glslSetParameterf() for more information.
Note:
At now there is only support for values with the length 1,2,3,4 according to GLSL's int, ivec2, ivec3, ivec4

Definition at line 694 of file glslShader.c.

GLSLAPI void GLSLAPIENTRY glslSetTexture ( GLSLprogram  obj,
const char *  name,
GLSLuint32  texture_unit 
)

Bind the texture to specified parameter name.

Parameters:
obj Shader program created before
name Name of the parameter containing texture sampler
texture_unit OpenGL's texture unit (e.g. for GL_TEXTURE4 texture_unit=4)
Note:
Don't forget to call glBindTexture() before you use it :-)

Definition at line 784 of file glslShader.c.


Generated on Sat Apr 7 18:49:42 2007 for glslShader by  doxygen 1.5.1