-
Notifications
You must be signed in to change notification settings - Fork 0
/
Shader.h
57 lines (41 loc) · 1.4 KB
/
Shader.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
#ifndef SHADER_H
#define SHADER_H
#include <iostream>
#include <GL/glew.h>
#include "Mathlib.h"
#include "ResourceBase.h"
// -------------------------------
// Shader (vertex & pixel)
// -------------------------------
class Shader : public ResourceBase
{
public:
static bool Init();
virtual bool Load(const std::string& name);
virtual void Destroy();
virtual bool DoesSupportReloading() const {return true;}
bool Activate();
static void Deactivate();
static Shader* getActivatedShader() {return s_pCurrent;}
/*
static bool isExtensionSupported(const std::string& ext);
static void PrintSupportedExtensions();*/
// Communication du programme au shader :
void Uniform(const std::string& ext, GLint value);
void Uniform(const std::string& ext, GLfloat value);
void Uniform(const std::string& ext, const vec2& value);
void Uniform(const std::string& ext, const vec3& value);
void UniformTexture(const std::string& ext, GLint slot);
// GLhandleARB getHandle() {return m_nProgram;}
Shader() {m_nProgram=0; m_strName="undef";}
private:
static GLhandleARB loadShader(const std::string& filestr);
static bool compileShader(GLhandleARB object);
static GLhandleARB linkShaders(GLhandleARB* object, const unsigned int& nb);
private:
static bool s_bInitialized;
static Shader* s_pCurrent;
std::string m_strName;
GLhandleARB m_nProgram;
};
#endif