-
Notifications
You must be signed in to change notification settings - Fork 0
/
glslprogram.h
executable file
·87 lines (71 loc) · 1.91 KB
/
glslprogram.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef GLSLPROGRAM_CPP
#define GLSLPROGRAM_CPP
#include <ctype.h>
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <math.h>
#include <string.h>
#ifdef WIN32
#include <windows.h>
#endif
// if on a Mac, don't need glew.h and the <GL/ should be <OpenGL/
#include "glew.h"
#include <GL/gl.h>
#include <GL/glu.h>
#include "glut.h"
#include <map>
#include <stdarg.h>
inline int GetOSU( int flag )
{
int i;
glGetIntegerv( flag, &i );
return i;
}
void CheckGlErrors( const char* );
class GLSLProgram
{
private:
std::map<char *, int> AttributeLocs;
char * Ffile;
unsigned int Fshader;
bool IncludeGstap;
GLuint Program;
std::map<char *, int> UniformLocs;
bool Valid;
char * Vfile;
GLuint Vshader;
bool Verbose;
static int CurrentProgram;
void AttachShader( GLuint );
bool CanDoFragmentShaders;
bool CanDoVertexShaders;
int CompileShader( GLuint );
bool CreateHelper( char *, ... );
int GetAttributeLocation( char * );
int GetUniformLocation( char * );
public:
GLSLProgram( );
bool Create( char *, char * = NULL, char * = NULL, char * = NULL, char * = NULL, char * = NULL );
void DisableVertexAttribArray( const char * );
void EnableVertexAttribArray( const char * );
void Init( );
bool IsExtensionSupported( const char * );
bool IsNotValid( );
bool IsValid( );
void SetAttributePointer3fv( char *, float * );
void SetAttributeVariable( char *, int );
void SetAttributeVariable( char *, float );
void SetAttributeVariable( char *, float, float, float );
void SetAttributeVariable( char *, float[3] );
void VertexAttrib3f( const char *, float, float, float );
void SetUniformVariable( char *, int );
void SetUniformVariable( char *, float );
void SetUniformVariable( char *, float, float, float );
void SetUniformVariable( char *, float[3] );
void SetVerbose( bool );
void UnUse( );
void Use( );
void Use( GLuint );
void UseFixedFunction( );
};
#endif // #ifndef GLSLPROGRAM_CPP