glsl/glslUtil/glslUtil.h
2011-05-10 12:09:05 -04:00

55 lines
1.6 KiB
C

#ifndef GLSLUTIL_H
#define GLSLUTIL_H
#ifdef GL_INCLUDE_FILE
#include GL_INCLUDE_FILE
#else
#include <GL/gl.h>
#endif
typedef GLfloat guMatrix4x4[4][4];
typedef struct {
GLuint index;
const char *name;
} guAttribBinding;
#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 guPerspective(guMatrix4x4 *m, GLfloat fovy, GLfloat aspect,
GLfloat near, GLfloat far);
void guOrtho(guMatrix4x4 *m,
GLfloat left, GLfloat right,
GLfloat bottom, GLfloat top,
GLfloat near, GLfloat far);
char *guGetShaderLog(GLuint id);
char *guGetProgramLog(GLuint id);
GLuint guMakeShaderFromFile(GLenum shaderType, const char *fname);
GLuint guMakeShader(GLenum shaderType, const char *source);
GLuint guMakeBuffer(GLenum target, GLenum usage, const void *ptr, size_t sz);
GLuint guMakeProgramFromSource(const char *v_shader, const char *f_shader,
guAttribBinding *bindings);
GLuint guMakeProgramFromFiles(const char *v_shader, const char *f_shader,
guAttribBinding *bindings);
GLuint guMakeProgram(GLuint v_shader_id, GLuint f_shader_id,
guAttribBinding *bindings);
#ifdef __cplusplus
}
#endif
#endif