DDraceNetwork Docs
opengl_sl_program.h
Go to the documentation of this file.
1// This file can be included several times.
2#if(!defined(BACKEND_AS_OPENGL_ES) && !defined(ENGINE_CLIENT_BACKEND_OPENGL_OPENGL_SL_PROGRAM_H)) || \
3 (defined(BACKEND_AS_OPENGL_ES) && !defined(ENGINE_CLIENT_BACKEND_OPENGL_OPENGL_SL_PROGRAM_H_AS_ES))
4
5#if !defined(BACKEND_AS_OPENGL_ES) && !defined(ENGINE_CLIENT_BACKEND_OPENGL_OPENGL_SL_PROGRAM_H)
6#define ENGINE_CLIENT_BACKEND_OPENGL_OPENGL_SL_PROGRAM_H
7#endif
8
9#if defined(BACKEND_AS_OPENGL_ES) && !defined(ENGINE_CLIENT_BACKEND_OPENGL_OPENGL_SL_PROGRAM_H_AS_ES)
10#define ENGINE_CLIENT_BACKEND_OPENGL_OPENGL_SL_PROGRAM_H_AS_ES
11#endif
12
13#include <base/color.h>
14#include <base/vmath.h>
16
17class CGLSL;
18
20{
21public:
22 void CreateProgram();
23 void DeleteProgram();
24
25 bool AddShader(CGLSL *pShader) const;
26
27 void LinkProgram();
28 void UseProgram() const;
29 TWGLuint GetProgramId() const;
30
31 void DetachShader(CGLSL *pShader) const;
32 void DetachShaderById(TWGLuint ShaderId) const;
33 void DetachAllShaders() const;
34
35 //Support various types
36 void SetUniformVec2(int Loc, int Count, const float *pValue);
37 void SetUniformVec4(int Loc, int Count, const float *pValue);
38 void SetUniform(int Loc, int Value);
39 void SetUniform(int Loc, bool Value);
40 void SetUniform(int Loc, float Value);
41 void SetUniform(int Loc, int Count, const float *pValues);
42
43 //for performance reason we do not use SetUniform with using strings... save the Locations of the variables instead
44 int GetUniformLoc(const char *pName) const;
45
47 virtual ~CGLSLProgram();
48
49protected:
52};
53
55{
56public:
59 {
61 }
62
65
70};
71
73{
74public:
76
77 {
78 m_LastColor[0] = m_LastColor[1] = m_LastColor[2] = m_LastColor[3] = -1.f;
82 }
83
89
95};
96
98{
99public:
100};
101
103{
104public:
106
107 {
108 m_LastRotation = 0.f;
109 m_LastCenter = vec2(0, 0);
110 m_LastVerticesColor = ColorRGBA(-1, -1, -1, -1);
111 }
112
116
120};
121
123{
124public:
126
127 {
128 m_LastCenter = vec2(0, 0);
129 m_LastVerticesColor = ColorRGBA(-1, -1, -1, -1);
130 }
131
135
138};
139
141{
142public:
147};
148
150{
151public:
153 m_LocColor(-1), m_LocOffset(-1), m_LocDir(-1), m_LocNum(-1), m_LocJumpIndex(-1) {}
154
158 int m_LocScale = -1;
161};
162
163#endif
Definition: opengl_sl_program.h:103
int m_LocCenter
Definition: opengl_sl_program.h:114
int m_LocVertciesColor
Definition: opengl_sl_program.h:115
float m_LastRotation
Definition: opengl_sl_program.h:117
vec2 m_LastCenter
Definition: opengl_sl_program.h:118
int m_LocRotation
Definition: opengl_sl_program.h:113
CGLSLPrimitiveExProgram()
Definition: opengl_sl_program.h:105
ColorRGBA m_LastVerticesColor
Definition: opengl_sl_program.h:119
Definition: opengl_sl_program.h:98
Definition: opengl_sl_program.h:20
void CreateProgram()
Definition: opengl_sl_program.cpp:15
void LinkProgram()
Definition: opengl_sl_program.cpp:51
CGLSLProgram()
Definition: opengl_sl_program.cpp:138
TWGLuint m_ProgramId
Definition: opengl_sl_program.h:50
int GetUniformLoc(const char *pName) const
Definition: opengl_sl_program.cpp:122
void UseProgram() const
Definition: opengl_sl_program.cpp:127
bool m_IsLinked
Definition: opengl_sl_program.h:51
void DetachShader(CGLSL *pShader) const
Definition: opengl_sl_program.cpp:38
void DeleteProgram()
Definition: opengl_sl_program.cpp:20
void SetUniformVec2(int Loc, int Count, const float *pValue)
Definition: opengl_sl_program.cpp:97
bool AddShader(CGLSL *pShader) const
Definition: opengl_sl_program.cpp:28
void DetachAllShaders() const
Definition: opengl_sl_program.cpp:71
TWGLuint GetProgramId() const
Definition: opengl_sl_program.cpp:133
void DetachShaderById(TWGLuint ShaderId) const
Definition: opengl_sl_program.cpp:46
void SetUniformVec4(int Loc, int Count, const float *pValue)
Definition: opengl_sl_program.cpp:92
virtual ~CGLSLProgram()
Definition: opengl_sl_program.cpp:143
void SetUniform(int Loc, int Value)
Definition: opengl_sl_program.cpp:107
Definition: opengl_sl_program.h:141
int m_LocOffsets
Definition: opengl_sl_program.h:144
int m_LocQuadOffset
Definition: opengl_sl_program.h:146
int m_LocColors
Definition: opengl_sl_program.h:143
int m_LocRotations
Definition: opengl_sl_program.h:145
Definition: opengl_sl_program.h:123
int m_LocVertciesColor
Definition: opengl_sl_program.h:134
CGLSLSpriteMultipleProgram()
Definition: opengl_sl_program.h:125
int m_LocRSP
Definition: opengl_sl_program.h:132
int m_LocCenter
Definition: opengl_sl_program.h:133
ColorRGBA m_LastVerticesColor
Definition: opengl_sl_program.h:137
vec2 m_LastCenter
Definition: opengl_sl_program.h:136
Definition: opengl_sl_program.h:55
vec2 m_LastScreenBR
Definition: opengl_sl_program.h:69
int m_LastIsTextured
Definition: opengl_sl_program.h:67
int m_LocPos
Definition: opengl_sl_program.h:63
vec2 m_LastScreenTL
Definition: opengl_sl_program.h:68
CGLSLTWProgram()
Definition: opengl_sl_program.h:57
int m_LastTextureSampler
Definition: opengl_sl_program.h:66
int m_LocTextureSampler
Definition: opengl_sl_program.h:64
Definition: opengl_sl_program.h:73
ColorRGBA m_LastColor
Definition: opengl_sl_program.h:90
ColorRGBA m_LastOutlineColor
Definition: opengl_sl_program.h:91
int m_LastTextureSize
Definition: opengl_sl_program.h:94
int m_LocOutlineColor
Definition: opengl_sl_program.h:85
int m_LastTextOutlineSampler
Definition: opengl_sl_program.h:93
int m_LocTextSampler
Definition: opengl_sl_program.h:86
CGLSLTextProgram()
Definition: opengl_sl_program.h:75
int m_LocTextOutlineSampler
Definition: opengl_sl_program.h:87
int m_LastTextSampler
Definition: opengl_sl_program.h:92
int m_LocTextureSize
Definition: opengl_sl_program.h:88
int m_LocColor
Definition: opengl_sl_program.h:84
Definition: opengl_sl_program.h:150
CGLSLTileProgram()
Definition: opengl_sl_program.h:152
int m_LocNum
Definition: opengl_sl_program.h:159
int m_LocJumpIndex
Definition: opengl_sl_program.h:160
int m_LocColor
Definition: opengl_sl_program.h:155
int m_LocDir
Definition: opengl_sl_program.h:157
int m_LocScale
Definition: opengl_sl_program.h:158
int m_LocOffset
Definition: opengl_sl_program.h:156
Definition: opengl_sl.h:18
Definition: color.h:210
uint32_t TWGLuint
Definition: graphics_defines.h:7
vector2_base< float > vec2
Definition: vmath.h:158