Don't use GL* types and methods in headers.

This commit is contained in:
Relintai 2024-01-05 13:51:49 +01:00
parent 7109823417
commit 11a8bde0d9
21 changed files with 193 additions and 189 deletions

View File

@ -15,8 +15,8 @@ void ColorMaterial::setup_uniforms() {
model_view_matrix_location = get_uniform("u_model_view_matrix"); model_view_matrix_location = get_uniform("u_model_view_matrix");
} }
const GLchar **ColorMaterial::get_vertex_shader_source() { const char **ColorMaterial::get_vertex_shader_source() {
static const GLchar *vertex_shader_source[] = { static const char *vertex_shader_source[] = {
"uniform mat4 u_proj_matrix;\n" "uniform mat4 u_proj_matrix;\n"
"uniform mat4 u_camera_matrix;\n" "uniform mat4 u_camera_matrix;\n"
"uniform mat4 u_model_view_matrix;\n" "uniform mat4 u_model_view_matrix;\n"
@ -35,8 +35,8 @@ const GLchar **ColorMaterial::get_vertex_shader_source() {
return vertex_shader_source; return vertex_shader_source;
} }
const GLchar **ColorMaterial::get_fragment_shader_source() { const char **ColorMaterial::get_fragment_shader_source() {
static const GLchar *fragment_shader_source[] = { static const char *fragment_shader_source[] = {
"precision mediump float;" "precision mediump float;"
"varying vec4 v_color;\n" "varying vec4 v_color;\n"
"\n" "\n"

View File

@ -18,14 +18,14 @@ public:
void bind_uniforms(); void bind_uniforms();
void setup_uniforms(); void setup_uniforms();
const GLchar **get_vertex_shader_source(); const char **get_vertex_shader_source();
const GLchar **get_fragment_shader_source(); const char **get_fragment_shader_source();
ColorMaterial(); ColorMaterial();
GLint projection_matrix_location; int32_t projection_matrix_location;
GLint camera_matrix_location; int32_t camera_matrix_location;
GLint model_view_matrix_location; int32_t model_view_matrix_location;
}; };
#endif #endif

View File

@ -21,8 +21,8 @@ void ColorMaterial2D::setup_state() {
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
} }
const GLchar **ColorMaterial2D::get_vertex_shader_source() { const char **ColorMaterial2D::get_vertex_shader_source() {
static const GLchar *vertex_shader_source[] = { static const char *vertex_shader_source[] = {
"uniform mat4 u_proj_matrix;\n" "uniform mat4 u_proj_matrix;\n"
"uniform mat4 u_model_view_matrix;\n" "uniform mat4 u_model_view_matrix;\n"
"\n" "\n"
@ -40,8 +40,8 @@ const GLchar **ColorMaterial2D::get_vertex_shader_source() {
return vertex_shader_source; return vertex_shader_source;
} }
const GLchar **ColorMaterial2D::get_fragment_shader_source() { const char **ColorMaterial2D::get_fragment_shader_source() {
static const GLchar *fragment_shader_source[] = { static const char *fragment_shader_source[] = {
"precision mediump float;\n" "precision mediump float;\n"
"\n" "\n"
"varying vec4 v_color;\n" "varying vec4 v_color;\n"

View File

@ -21,13 +21,13 @@ public:
void unbind(); void unbind();
void setup_state(); void setup_state();
const GLchar **get_vertex_shader_source(); const char **get_vertex_shader_source();
const GLchar **get_fragment_shader_source(); const char **get_fragment_shader_source();
ColorMaterial2D(); ColorMaterial2D();
GLint projection_matrix_location; int32_t projection_matrix_location;
GLint model_view_matrix_location; int32_t model_view_matrix_location;
}; };
#endif // COLORED_MATERIAL_H #endif // COLORED_MATERIAL_H

View File

@ -16,8 +16,8 @@ void ColoredMaterial::setup_uniforms() {
tri_color_uniform_location = get_uniform("fragment_color"); tri_color_uniform_location = get_uniform("fragment_color");
} }
const GLchar **ColoredMaterial::get_vertex_shader_source() { const char **ColoredMaterial::get_vertex_shader_source() {
static const GLchar *vertex_shader_source[] = { static const char *vertex_shader_source[] = {
"uniform mat4 u_proj_matrix;\n" "uniform mat4 u_proj_matrix;\n"
"uniform mat4 u_model_view_matrix;\n" "uniform mat4 u_model_view_matrix;\n"
"\n" "\n"
@ -31,8 +31,8 @@ const GLchar **ColoredMaterial::get_vertex_shader_source() {
return vertex_shader_source; return vertex_shader_source;
} }
const GLchar **ColoredMaterial::get_fragment_shader_source() { const char **ColoredMaterial::get_fragment_shader_source() {
static const GLchar *fragment_shader_source[] = { static const char *fragment_shader_source[] = {
"precision mediump float;\n" "precision mediump float;\n"
"\n" "\n"
"uniform vec4 fragment_color;\n" "uniform vec4 fragment_color;\n"

View File

@ -18,15 +18,15 @@ public:
void bind_uniforms(); void bind_uniforms();
void setup_uniforms(); void setup_uniforms();
const GLchar **get_vertex_shader_source(); const char **get_vertex_shader_source();
const GLchar **get_fragment_shader_source(); const char **get_fragment_shader_source();
ColoredMaterial(); ColoredMaterial();
GLint projection_matrix_location; int32_t projection_matrix_location;
GLint model_view_matrix_location; int32_t model_view_matrix_location;
GLint tri_color_uniform_location; int32_t tri_color_uniform_location;
Color color; Color color;
}; };

View File

@ -28,8 +28,8 @@ void FontMaterial::setup_state() {
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
} }
const GLchar **FontMaterial::get_vertex_shader_source() { const char **FontMaterial::get_vertex_shader_source() {
static const GLchar *vertex_shader_source[] = { static const char *vertex_shader_source[] = {
"uniform mat4 u_proj_matrix;\n" "uniform mat4 u_proj_matrix;\n"
"uniform mat4 u_model_view_matrix;\n" "uniform mat4 u_model_view_matrix;\n"
"\n" "\n"
@ -50,8 +50,8 @@ const GLchar **FontMaterial::get_vertex_shader_source() {
return vertex_shader_source; return vertex_shader_source;
} }
const GLchar **FontMaterial::get_fragment_shader_source() { const char **FontMaterial::get_fragment_shader_source() {
static const GLchar *fragment_shader_source[] = { static const char *fragment_shader_source[] = {
"precision mediump float;\n" "precision mediump float;\n"
"\n" "\n"
"uniform sampler2D u_texture;\n" "uniform sampler2D u_texture;\n"

View File

@ -21,15 +21,15 @@ public:
void unbind(); void unbind();
void setup_state(); void setup_state();
const GLchar **get_vertex_shader_source(); const char **get_vertex_shader_source();
const GLchar **get_fragment_shader_source(); const char **get_fragment_shader_source();
FontMaterial(); FontMaterial();
GLint projection_matrix_location; int32_t projection_matrix_location;
GLint model_view_matrix_location; int32_t model_view_matrix_location;
GLint texture_location; int32_t texture_location;
Ref<Texture> texture; Ref<Texture> texture;
}; };

View File

@ -46,8 +46,8 @@ void Material::setup_uniforms() {
void Material::setup_state() { void Material::setup_state() {
} }
GLint Material::get_uniform(const char* name) { int32_t Material::get_uniform(const char *name) {
GLint uniform = glGetUniformLocation(shader->program, name); int32_t uniform = glGetUniformLocation(shader->program, name);
if (uniform == -1) { if (uniform == -1) {
printf("%s is not a valid glsl program variable!\n", name); printf("%s is not a valid glsl program variable!\n", name);
@ -62,4 +62,66 @@ Material::Material() {
Material::~Material() { Material::~Material() {
} }
void Material::set_uniform(int32_t p_uniform, const Transform &p_transform) {
const Transform &tr = p_transform;
GLfloat matrix[16] = { /* build a 16x16 matrix */
tr.basis.rows[0][0],
tr.basis.rows[1][0],
tr.basis.rows[2][0],
0,
tr.basis.rows[0][1],
tr.basis.rows[1][1],
tr.basis.rows[2][1],
0,
tr.basis.rows[0][2],
tr.basis.rows[1][2],
tr.basis.rows[2][2],
0,
tr.origin.x,
tr.origin.y,
tr.origin.z,
1
};
glUniformMatrix4fv(p_uniform, 1, false, matrix);
}
void Material::set_uniform(int32_t p_uniform, const Transform2D &p_transform) {
const Transform2D &tr = p_transform;
GLfloat matrix[16] = { /* build a 16x16 matrix */
tr.columns[0][0],
tr.columns[0][1],
0,
0,
tr.columns[1][0],
tr.columns[1][1],
0,
0,
0,
0,
1,
0,
tr.columns[2][0],
tr.columns[2][1],
0,
1
};
glUniformMatrix4fv(p_uniform, 1, false, matrix);
}
void Material::set_uniform(int32_t p_uniform, const Projection &p_matrix) {
GLfloat matrix[16];
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
matrix[i * 4 + j] = p_matrix.matrix[i][j];
}
}
glUniformMatrix4fv(p_uniform, 1, false, matrix);
}
Material *Material::current_material = NULL; Material *Material::current_material = NULL;

View File

@ -20,10 +20,10 @@ public:
virtual void bind_uniforms(); virtual void bind_uniforms();
virtual void setup_uniforms(); virtual void setup_uniforms();
virtual void setup_state(); virtual void setup_state();
virtual const GLchar **get_vertex_shader_source() = 0; virtual const char **get_vertex_shader_source() = 0;
virtual const GLchar **get_fragment_shader_source() = 0; virtual const char **get_fragment_shader_source() = 0;
GLint get_uniform(const char *name); int32_t get_uniform(const char *name);
Material(); Material();
virtual ~Material(); virtual ~Material();
@ -34,67 +34,9 @@ protected:
Shader *shader; Shader *shader;
protected: protected:
_FORCE_INLINE_ void set_uniform(GLint p_uniform, const Transform &p_transform) { void set_uniform(int32_t p_uniform, const Transform &p_transform);
const Transform &tr = p_transform; void set_uniform(int32_t p_uniform, const Transform2D &p_transform);
void set_uniform(int32_t p_uniform, const Projection &p_matrix);
GLfloat matrix[16] = { /* build a 16x16 matrix */
tr.basis.rows[0][0],
tr.basis.rows[1][0],
tr.basis.rows[2][0],
0,
tr.basis.rows[0][1],
tr.basis.rows[1][1],
tr.basis.rows[2][1],
0,
tr.basis.rows[0][2],
tr.basis.rows[1][2],
tr.basis.rows[2][2],
0,
tr.origin.x,
tr.origin.y,
tr.origin.z,
1
};
glUniformMatrix4fv(p_uniform, 1, false, matrix);
}
_FORCE_INLINE_ void set_uniform(GLint p_uniform, const Transform2D &p_transform) {
const Transform2D &tr = p_transform;
GLfloat matrix[16] = { /* build a 16x16 matrix */
tr.columns[0][0],
tr.columns[0][1],
0,
0,
tr.columns[1][0],
tr.columns[1][1],
0,
0,
0,
0,
1,
0,
tr.columns[2][0],
tr.columns[2][1],
0,
1
};
glUniformMatrix4fv(p_uniform, 1, false, matrix);
}
_FORCE_INLINE_ void set_uniform(GLint p_uniform, const Projection &p_matrix) {
GLfloat matrix[16];
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
matrix[i * 4 + j] = p_matrix.matrix[i][j];
}
}
glUniformMatrix4fv(p_uniform, 1, false, matrix);
}
}; };
#endif // MATERIAL_H #endif // MATERIAL_H

View File

@ -37,8 +37,8 @@ public:
Mesh(int vert_dim); Mesh(int vert_dim);
virtual ~Mesh(); virtual ~Mesh();
GLuint VBO; uint32_t VBO;
GLuint IBO; uint32_t IBO;
int vertex_dimesions; int vertex_dimesions;

View File

@ -37,12 +37,12 @@ void Shader::compile() {
fragment_shader = glCreateShader(GL_FRAGMENT_SHADER); fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
} }
const GLchar **vertex_shader_source = get_vertex_shader_source(); const char **vertex_shader_source = get_vertex_shader_source();
glShaderSource(vertex_shader, 1, vertex_shader_source, NULL); glShaderSource(vertex_shader, 1, vertex_shader_source, NULL);
glCompileShader(vertex_shader); glCompileShader(vertex_shader);
GLint shader_compiled = GL_FALSE; int32_t shader_compiled = GL_FALSE;
glGetShaderiv(vertex_shader, GL_COMPILE_STATUS, &shader_compiled); glGetShaderiv(vertex_shader, GL_COMPILE_STATUS, &shader_compiled);
if (shader_compiled != GL_TRUE) { if (shader_compiled != GL_TRUE) {
print_shader_errors(vertex_shader, "compiling Vertex Shader"); print_shader_errors(vertex_shader, "compiling Vertex Shader");
@ -51,7 +51,7 @@ void Shader::compile() {
glAttachShader(program, vertex_shader); glAttachShader(program, vertex_shader);
const GLchar **fragment_shader_source = get_fragment_shader_source(); const char **fragment_shader_source = get_fragment_shader_source();
glShaderSource(fragment_shader, 1, fragment_shader_source, NULL); glShaderSource(fragment_shader, 1, fragment_shader_source, NULL);
glCompileShader(fragment_shader); glCompileShader(fragment_shader);
@ -72,7 +72,7 @@ void Shader::compile() {
glLinkProgram(program); glLinkProgram(program);
GLint program_compiled = GL_FALSE; int32_t program_compiled = GL_FALSE;
glGetProgramiv(program, GL_LINK_STATUS, &program_compiled); glGetProgramiv(program, GL_LINK_STATUS, &program_compiled);
if (program_compiled != GL_TRUE) { if (program_compiled != GL_TRUE) {
print_program_errors(program); print_program_errors(program);
@ -85,23 +85,23 @@ void Shader::destroy() {
glDeleteProgram(program); glDeleteProgram(program);
} }
const GLchar **Shader::get_vertex_shader_source() { const char **Shader::get_vertex_shader_source() {
return vertex_shader_source; return vertex_shader_source;
} }
void Shader::set_vertex_shader_source(const GLchar **source) { void Shader::set_vertex_shader_source(const char **source) {
vertex_shader_source = source; vertex_shader_source = source;
} }
const GLchar **Shader::get_fragment_shader_source() { const char **Shader::get_fragment_shader_source() {
return fragment_shader_source; return fragment_shader_source;
} }
void Shader::set_fragment_shader_source(const GLchar **source) { void Shader::set_fragment_shader_source(const char **source) {
fragment_shader_source = source; fragment_shader_source = source;
} }
void Shader::print_shader_errors(const GLuint p_program, const char *name) { void Shader::print_shader_errors(const uint32_t p_program, const char *name) {
int max_length = 5000; int max_length = 5000;
Vector<GLchar> error_log; Vector<char> error_log;
error_log.resize(max_length); error_log.resize(max_length);
glGetShaderInfoLog(p_program, max_length, &max_length, error_log.ptrw()); glGetShaderInfoLog(p_program, max_length, &max_length, error_log.ptrw());
@ -110,7 +110,7 @@ void Shader::print_shader_errors(const GLuint p_program, const char *name) {
printf("%s!\n", error_log.ptr()); printf("%s!\n", error_log.ptr());
} }
void Shader::print_program_errors(const GLuint p_program) { void Shader::print_program_errors(const uint32_t p_program) {
if (glIsProgram(program)) { if (glIsProgram(program)) {
int info_length = 0; int info_length = 0;
int max_length = 5000; int max_length = 5000;

View File

@ -21,27 +21,27 @@ public:
void compile(); void compile();
void destroy(); void destroy();
const GLchar **get_vertex_shader_source(); const char **get_vertex_shader_source();
void set_vertex_shader_source(const GLchar **source); void set_vertex_shader_source(const char **source);
const GLchar **get_fragment_shader_source(); const char **get_fragment_shader_source();
void set_fragment_shader_source(const GLchar **source); void set_fragment_shader_source(const char **source);
void print_shader_errors(const GLuint p_program, const char *name); void print_shader_errors(const uint32_t p_program, const char *name);
void print_program_errors(const GLuint p_program); void print_program_errors(const uint32_t p_program);
Shader(); Shader();
~Shader(); ~Shader();
GLuint vertex_shader; uint32_t vertex_shader;
GLuint fragment_shader; uint32_t fragment_shader;
GLuint program; uint32_t program;
static Shader *current_shader; static Shader *current_shader;
protected: protected:
const GLchar **vertex_shader_source; const char **vertex_shader_source;
const GLchar **fragment_shader_source; const char **fragment_shader_source;
}; };
class ShaderCache { class ShaderCache {

View File

@ -35,9 +35,9 @@ Ref<Image> Texture::get_data() {
//GLES //GLES
GLenum gl_format; uint32_t gl_format;
GLenum gl_internal_format; uint32_t gl_internal_format;
GLenum gl_type; uint32_t gl_type;
bool supported; bool supported;
_get_gl_format(_texture_format, gl_format, gl_internal_format, gl_type, supported); _get_gl_format(_texture_format, gl_format, gl_internal_format, gl_type, supported);
@ -80,9 +80,9 @@ void Texture::upload() {
return; return;
} }
GLenum gl_format; uint32_t gl_format;
GLenum gl_internal_format; uint32_t gl_internal_format;
GLenum gl_type; uint32_t gl_type;
bool supported; bool supported;
Image::Format image_format = _image->get_format(); Image::Format image_format = _image->get_format();
_get_gl_format(image_format, gl_format, gl_internal_format, gl_type, supported); _get_gl_format(image_format, gl_format, gl_internal_format, gl_type, supported);
@ -141,7 +141,7 @@ void Texture::upload() {
glTexParameterf(_texture, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameterf(_texture, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
} }
GLenum texture_type = GL_TEXTURE_2D; uint32_t texture_type = GL_TEXTURE_2D;
glBindTexture(texture_type, _texture); glBindTexture(texture_type, _texture);
@ -179,7 +179,7 @@ void Texture::upload() {
glBindTexture(texture_type, 0); glBindTexture(texture_type, 0);
} }
void Texture::_get_gl_format(Image::Format p_format, GLenum &r_gl_format, GLenum &r_gl_internal_format, GLenum &r_gl_type, bool &r_supported) const { void Texture::_get_gl_format(Image::Format p_format, uint32_t &r_gl_format, uint32_t &r_gl_internal_format, uint32_t &r_gl_type, bool &r_supported) const {
r_gl_format = 0; r_gl_format = 0;
r_supported = true; r_supported = true;

View File

@ -20,7 +20,7 @@ public:
TEXTURE_FLAG_MIP_MAPS = 1 << 3, TEXTURE_FLAG_MIP_MAPS = 1 << 3,
}; };
_FORCE_INLINE_ GLuint get_gl_texture() { _FORCE_INLINE_ uint32_t get_gl_texture() {
return _texture; return _texture;
} }
@ -36,7 +36,7 @@ public:
virtual ~Texture(); virtual ~Texture();
protected: protected:
void _get_gl_format(Image::Format p_format, GLenum &r_gl_format, GLenum &r_gl_internal_format, GLenum &r_gl_type, bool &r_supported) const; void _get_gl_format(Image::Format p_format, uint32_t &r_gl_format, uint32_t &r_gl_internal_format, uint32_t &r_gl_type, bool &r_supported) const;
Ref<Image> _image; Ref<Image> _image;
@ -49,7 +49,7 @@ protected:
int _data_size; int _data_size;
int _mipmaps; int _mipmaps;
GLuint _texture; uint32_t _texture;
}; };
//TODO //TODO
@ -64,7 +64,7 @@ public:
protected: protected:
int _fbo_width; int _fbo_width;
int _fbo_height; int _fbo_height;
GLuint _fbo; uint32_t _fbo;
}; };
#endif // TEXTURE_H #endif // TEXTURE_H

View File

@ -31,8 +31,8 @@ void TextureMaterial::setup_state() {
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
} }
const GLchar **TextureMaterial::get_vertex_shader_source() { const char **TextureMaterial::get_vertex_shader_source() {
static const GLchar *vertex_shader_source[] = { static const char *vertex_shader_source[] = {
"uniform mat4 u_proj_matrix;\n" "uniform mat4 u_proj_matrix;\n"
"uniform mat4 u_camera_matrix;\n" "uniform mat4 u_camera_matrix;\n"
"uniform mat4 u_model_view_matrix;\n" "uniform mat4 u_model_view_matrix;\n"
@ -51,8 +51,8 @@ const GLchar **TextureMaterial::get_vertex_shader_source() {
return vertex_shader_source; return vertex_shader_source;
} }
const GLchar **TextureMaterial::get_fragment_shader_source() { const char **TextureMaterial::get_fragment_shader_source() {
static const GLchar *fragment_shader_source[] = { static const char *fragment_shader_source[] = {
"precision mediump float;\n" "precision mediump float;\n"
"\n" "\n"
"uniform sampler2D u_texture;\n" "uniform sampler2D u_texture;\n"

View File

@ -21,16 +21,16 @@ public:
void unbind(); void unbind();
void setup_state(); void setup_state();
const GLchar **get_vertex_shader_source(); const char **get_vertex_shader_source();
const GLchar **get_fragment_shader_source(); const char **get_fragment_shader_source();
TextureMaterial(); TextureMaterial();
GLint projection_matrix_location; int32_t projection_matrix_location;
GLint camera_matrix_location; int32_t camera_matrix_location;
GLint model_view_matrix_location; int32_t model_view_matrix_location;
GLint texture_location; int32_t texture_location;
Ref<Texture> texture; Ref<Texture> texture;
}; };

View File

@ -28,8 +28,8 @@ void TextureMaterial2D::setup_state() {
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
} }
const GLchar **TextureMaterial2D::get_vertex_shader_source() { const char **TextureMaterial2D::get_vertex_shader_source() {
static const GLchar *vertex_shader_source[] = { static const char *vertex_shader_source[] = {
"uniform mat4 u_proj_matrix;\n" "uniform mat4 u_proj_matrix;\n"
"uniform mat4 u_model_view_matrix;\n" "uniform mat4 u_model_view_matrix;\n"
"\n" "\n"
@ -47,8 +47,8 @@ const GLchar **TextureMaterial2D::get_vertex_shader_source() {
return vertex_shader_source; return vertex_shader_source;
} }
const GLchar **TextureMaterial2D::get_fragment_shader_source() { const char **TextureMaterial2D::get_fragment_shader_source() {
static const GLchar *fragment_shader_source[] = { static const char *fragment_shader_source[] = {
"precision mediump float;\n" "precision mediump float;\n"
"\n" "\n"
"uniform sampler2D u_texture;\n" "uniform sampler2D u_texture;\n"

View File

@ -21,15 +21,15 @@ public:
void unbind(); void unbind();
void setup_state(); void setup_state();
const GLchar **get_vertex_shader_source(); const char **get_vertex_shader_source();
const GLchar **get_fragment_shader_source(); const char **get_fragment_shader_source();
TextureMaterial2D(); TextureMaterial2D();
GLint projection_matrix_location; int32_t projection_matrix_location;
GLint model_view_matrix_location; int32_t model_view_matrix_location;
GLint texture_location; int32_t texture_location;
Ref<Texture> texture; Ref<Texture> texture;
}; };

View File

@ -28,8 +28,8 @@ void TransparentTextureMaterial::setup_state() {
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
} }
const GLchar **TransparentTextureMaterial::get_vertex_shader_source() { const char **TransparentTextureMaterial::get_vertex_shader_source() {
static const GLchar *vertex_shader_source[] = { static const char *vertex_shader_source[] = {
"uniform mat4 u_proj_matrix;\n" "uniform mat4 u_proj_matrix;\n"
"uniform mat4 u_model_view_matrix;\n" "uniform mat4 u_model_view_matrix;\n"
"\n" "\n"
@ -47,8 +47,8 @@ const GLchar **TransparentTextureMaterial::get_vertex_shader_source() {
return vertex_shader_source; return vertex_shader_source;
} }
const GLchar **TransparentTextureMaterial::get_fragment_shader_source() { const char **TransparentTextureMaterial::get_fragment_shader_source() {
static const GLchar *fragment_shader_source[] = { static const char *fragment_shader_source[] = {
"precision mediump float;\n" "precision mediump float;\n"
"\n" "\n"
"uniform sampler2D u_texture;\n" "uniform sampler2D u_texture;\n"

View File

@ -21,15 +21,15 @@ public:
void unbind(); void unbind();
void setup_state(); void setup_state();
const GLchar **get_vertex_shader_source(); const char **get_vertex_shader_source();
const GLchar **get_fragment_shader_source(); const char **get_fragment_shader_source();
TransparentTextureMaterial(); TransparentTextureMaterial();
GLint projection_matrix_location; int32_t projection_matrix_location;
GLint model_view_matrix_location; int32_t model_view_matrix_location;
GLint texture_location; int32_t texture_location;
Ref<Texture> texture; Ref<Texture> texture;
}; };