93 lines
1.1 KiB
C
93 lines
1.1 KiB
C
|
|
#ifndef _shader
|
||
|
|
|
||
|
|
#define _shader
|
||
|
|
|
||
|
|
|
||
|
|
// Macros
|
||
|
|
|
||
|
|
#define GL_GLEXT_PROTOTYPES
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
#include "stdlib.h"
|
||
|
|
|
||
|
|
extern char * __ClassNames[];
|
||
|
|
|
||
|
|
|
||
|
|
// Includes
|
||
|
|
|
||
|
|
#include "char.h"
|
||
|
|
|
||
|
|
#include "array.h"
|
||
|
|
|
||
|
|
#include "fileSystem.h"
|
||
|
|
|
||
|
|
#include <stdio.h>
|
||
|
|
|
||
|
|
#include <GL/glx.h>
|
||
|
|
|
||
|
|
#include <GL/gl.h>
|
||
|
|
|
||
|
|
#include <GL/glext.h>
|
||
|
|
|
||
|
|
|
||
|
|
typedef struct shader{
|
||
|
|
|
||
|
|
unsigned short __classIndex;
|
||
|
|
|
||
|
|
array * uniforms;
|
||
|
|
|
||
|
|
array * attributes;
|
||
|
|
|
||
|
|
|
||
|
|
} shader;
|
||
|
|
|
||
|
|
void shader_checkShaderForErrors( shader * this, GLuint shader );
|
||
|
|
|
||
|
|
void shader_createFromFile( shader * this, char * vertexShaderPath, char * fragmentShaderPath );
|
||
|
|
|
||
|
|
struct attribute * shader_getAttributeByName( shader * this, char * attributeName );
|
||
|
|
|
||
|
|
void shader_setUniform( shader * this, char * name, void * value );
|
||
|
|
|
||
|
|
typedef struct uniform{
|
||
|
|
|
||
|
|
unsigned short __classIndex;
|
||
|
|
|
||
|
|
char name[64];
|
||
|
|
|
||
|
|
GLint location;
|
||
|
|
|
||
|
|
GLenum type;
|
||
|
|
|
||
|
|
|
||
|
|
} uniform;
|
||
|
|
|
||
|
|
typedef struct attribute{
|
||
|
|
|
||
|
|
unsigned short __classIndex;
|
||
|
|
|
||
|
|
GLchar name[64];
|
||
|
|
|
||
|
|
GLint location;
|
||
|
|
|
||
|
|
GLenum type;
|
||
|
|
|
||
|
|
|
||
|
|
} attribute;
|
||
|
|
|
||
|
|
shader shader_new( );
|
||
|
|
|
||
|
|
shader * shader_newPointer( );
|
||
|
|
|
||
|
|
uniform uniform_new( );
|
||
|
|
|
||
|
|
uniform * uniform_newPointer( );
|
||
|
|
|
||
|
|
attribute attribute_new( );
|
||
|
|
|
||
|
|
attribute * attribute_newPointer( );
|
||
|
|
|
||
|
|
#endif
|