glsl/glslUtil/glslUtil.h
2011-05-13 15:28:24 -04:00

66 lines
1.9 KiB
C

#ifndef GLSLUTIL_H
#define GLSLUTIL_H
#ifdef GL_INCLUDE_FILE
#include GL_INCLUDE_FILE
#else
#include <GL/gl.h>
#endif
typedef GLfloat guMatrix3x3[3][3];
typedef GLfloat guMatrix4x4[4][4];
typedef struct {
GLuint index;
const char *name;
} guAttribBinding;
typedef struct {
GLint *loc;
const char *name;
} guUniformLocation;
#ifdef __cplusplus
extern "C" {
#endif
void guMatrixLoadIdentity(guMatrix4x4 *m);
void guMatrixMult(guMatrix4x4 *m, guMatrix4x4 *a, guMatrix4x4 *b);
void guMatrixTranslate(guMatrix4x4 *m, GLfloat x, GLfloat y, GLfloat z);
void guMatrixScale(guMatrix4x4 *m, GLfloat x, GLfloat y, GLfloat z);
void guMatrixRotate(guMatrix4x4 *m, GLfloat angle,
GLfloat x, GLfloat y, GLfloat z);
void guMatrixFrustum(guMatrix4x4 *m,
GLfloat left, GLfloat right,
GLfloat bottom, GLfloat top,
GLfloat near, GLfloat far);
void guMatrixPerspective(guMatrix4x4 *m, GLfloat fovy, GLfloat aspect,
GLfloat near, GLfloat far);
void guMatrixOrtho(guMatrix4x4 *m,
GLfloat left, GLfloat right,
GLfloat bottom, GLfloat top,
GLfloat near, GLfloat far);
void guMatrix4x4To3x3(guMatrix3x3 *out, const guMatrix4x4 *in);
char *guGetShaderLog(GLuint id);
char *guGetProgramLog(GLuint id);
GLuint guMakeShaderFromFile(GLenum shaderType, const char *fname);
GLuint guMakeShader(GLenum shaderType, const char *source);
GLuint guMakeProgramFromSource(const char *v_shader, const char *f_shader,
const guAttribBinding *bindings);
GLuint guMakeProgramFromFiles(const char *v_shader, const char *f_shader,
const guAttribBinding *bindings);
GLuint guMakeProgram(GLuint v_shader_id, GLuint f_shader_id,
const guAttribBinding *bindings);
void guGetUniformLocations(GLuint program, guUniformLocation *locs);
GLuint guMakeBuffer(GLenum target, GLenum usage, const void *ptr, size_t sz);
#ifdef __cplusplus
}
#endif
#endif