diff --git a/sfw/render_core/color_material.cpp b/sfw/render_core/color_material.cpp index 91b5700..c531bdb 100644 --- a/sfw/render_core/color_material.cpp +++ b/sfw/render_core/color_material.cpp @@ -15,8 +15,8 @@ void ColorMaterial::setup_uniforms() { model_view_matrix_location = get_uniform("u_model_view_matrix"); } -const GLchar **ColorMaterial::get_vertex_shader_source() { - static const GLchar *vertex_shader_source[] = { +const char **ColorMaterial::get_vertex_shader_source() { + static const char *vertex_shader_source[] = { "uniform mat4 u_proj_matrix;\n" "uniform mat4 u_camera_matrix;\n" "uniform mat4 u_model_view_matrix;\n" @@ -35,8 +35,8 @@ const GLchar **ColorMaterial::get_vertex_shader_source() { return vertex_shader_source; } -const GLchar **ColorMaterial::get_fragment_shader_source() { - static const GLchar *fragment_shader_source[] = { +const char **ColorMaterial::get_fragment_shader_source() { + static const char *fragment_shader_source[] = { "precision mediump float;" "varying vec4 v_color;\n" "\n" diff --git a/sfw/render_core/color_material.h b/sfw/render_core/color_material.h index 308c527..78fc7ec 100644 --- a/sfw/render_core/color_material.h +++ b/sfw/render_core/color_material.h @@ -18,14 +18,14 @@ public: void bind_uniforms(); void setup_uniforms(); - const GLchar **get_vertex_shader_source(); - const GLchar **get_fragment_shader_source(); + const char **get_vertex_shader_source(); + const char **get_fragment_shader_source(); ColorMaterial(); - GLint projection_matrix_location; - GLint camera_matrix_location; - GLint model_view_matrix_location; + int32_t projection_matrix_location; + int32_t camera_matrix_location; + int32_t model_view_matrix_location; }; #endif \ No newline at end of file diff --git a/sfw/render_core/color_material_2d.cpp b/sfw/render_core/color_material_2d.cpp index 666b6fe..3c7e88e 100644 --- a/sfw/render_core/color_material_2d.cpp +++ b/sfw/render_core/color_material_2d.cpp @@ -21,8 +21,8 @@ void ColorMaterial2D::setup_state() { glEnable(GL_TEXTURE_2D); } -const GLchar **ColorMaterial2D::get_vertex_shader_source() { - static const GLchar *vertex_shader_source[] = { +const char **ColorMaterial2D::get_vertex_shader_source() { + static const char *vertex_shader_source[] = { "uniform mat4 u_proj_matrix;\n" "uniform mat4 u_model_view_matrix;\n" "\n" @@ -40,8 +40,8 @@ const GLchar **ColorMaterial2D::get_vertex_shader_source() { return vertex_shader_source; } -const GLchar **ColorMaterial2D::get_fragment_shader_source() { - static const GLchar *fragment_shader_source[] = { +const char **ColorMaterial2D::get_fragment_shader_source() { + static const char *fragment_shader_source[] = { "precision mediump float;\n" "\n" "varying vec4 v_color;\n" diff --git a/sfw/render_core/color_material_2d.h b/sfw/render_core/color_material_2d.h index 4e02092..1bf1652 100644 --- a/sfw/render_core/color_material_2d.h +++ b/sfw/render_core/color_material_2d.h @@ -21,13 +21,13 @@ public: void unbind(); void setup_state(); - const GLchar **get_vertex_shader_source(); - const GLchar **get_fragment_shader_source(); + const char **get_vertex_shader_source(); + const char **get_fragment_shader_source(); ColorMaterial2D(); - GLint projection_matrix_location; - GLint model_view_matrix_location; + int32_t projection_matrix_location; + int32_t model_view_matrix_location; }; #endif // COLORED_MATERIAL_H diff --git a/sfw/render_core/colored_material.cpp b/sfw/render_core/colored_material.cpp index 2d3e58b..d7993cd 100644 --- a/sfw/render_core/colored_material.cpp +++ b/sfw/render_core/colored_material.cpp @@ -16,8 +16,8 @@ void ColoredMaterial::setup_uniforms() { tri_color_uniform_location = get_uniform("fragment_color"); } -const GLchar **ColoredMaterial::get_vertex_shader_source() { - static const GLchar *vertex_shader_source[] = { +const char **ColoredMaterial::get_vertex_shader_source() { + static const char *vertex_shader_source[] = { "uniform mat4 u_proj_matrix;\n" "uniform mat4 u_model_view_matrix;\n" "\n" @@ -31,8 +31,8 @@ const GLchar **ColoredMaterial::get_vertex_shader_source() { return vertex_shader_source; } -const GLchar **ColoredMaterial::get_fragment_shader_source() { - static const GLchar *fragment_shader_source[] = { +const char **ColoredMaterial::get_fragment_shader_source() { + static const char *fragment_shader_source[] = { "precision mediump float;\n" "\n" "uniform vec4 fragment_color;\n" diff --git a/sfw/render_core/colored_material.h b/sfw/render_core/colored_material.h index f543e94..eac1ee6 100644 --- a/sfw/render_core/colored_material.h +++ b/sfw/render_core/colored_material.h @@ -18,15 +18,15 @@ public: void bind_uniforms(); void setup_uniforms(); - const GLchar **get_vertex_shader_source(); - const GLchar **get_fragment_shader_source(); + const char **get_vertex_shader_source(); + const char **get_fragment_shader_source(); ColoredMaterial(); - GLint projection_matrix_location; - GLint model_view_matrix_location; + int32_t projection_matrix_location; + int32_t model_view_matrix_location; - GLint tri_color_uniform_location; + int32_t tri_color_uniform_location; Color color; }; diff --git a/sfw/render_core/font_material.cpp b/sfw/render_core/font_material.cpp index 682ee22..cf68a89 100644 --- a/sfw/render_core/font_material.cpp +++ b/sfw/render_core/font_material.cpp @@ -28,8 +28,8 @@ void FontMaterial::setup_state() { glEnable(GL_TEXTURE_2D); } -const GLchar **FontMaterial::get_vertex_shader_source() { - static const GLchar *vertex_shader_source[] = { +const char **FontMaterial::get_vertex_shader_source() { + static const char *vertex_shader_source[] = { "uniform mat4 u_proj_matrix;\n" "uniform mat4 u_model_view_matrix;\n" "\n" @@ -50,8 +50,8 @@ const GLchar **FontMaterial::get_vertex_shader_source() { return vertex_shader_source; } -const GLchar **FontMaterial::get_fragment_shader_source() { - static const GLchar *fragment_shader_source[] = { +const char **FontMaterial::get_fragment_shader_source() { + static const char *fragment_shader_source[] = { "precision mediump float;\n" "\n" "uniform sampler2D u_texture;\n" diff --git a/sfw/render_core/font_material.h b/sfw/render_core/font_material.h index ab9f575..ea53f22 100644 --- a/sfw/render_core/font_material.h +++ b/sfw/render_core/font_material.h @@ -21,15 +21,15 @@ public: void unbind(); void setup_state(); - const GLchar **get_vertex_shader_source(); - const GLchar **get_fragment_shader_source(); + const char **get_vertex_shader_source(); + const char **get_fragment_shader_source(); FontMaterial(); - GLint projection_matrix_location; - GLint model_view_matrix_location; + int32_t projection_matrix_location; + int32_t model_view_matrix_location; - GLint texture_location; + int32_t texture_location; Ref texture; }; diff --git a/sfw/render_core/material.cpp b/sfw/render_core/material.cpp index 0306e1e..29663c0 100644 --- a/sfw/render_core/material.cpp +++ b/sfw/render_core/material.cpp @@ -5,36 +5,36 @@ //--STRIP void Material::bind() { - //csak main thread! + //csak main thread! - if (!shader) { - shader = ShaderCache::get_singleton()->get_shader(get_material_id()); + if (!shader) { + shader = ShaderCache::get_singleton()->get_shader(get_material_id()); - if (!shader) { - shader = memnew(Shader()); + if (!shader) { + shader = memnew(Shader()); - shader->set_vertex_shader_source(get_vertex_shader_source()); - shader->set_fragment_shader_source(get_fragment_shader_source()); + shader->set_vertex_shader_source(get_vertex_shader_source()); + shader->set_fragment_shader_source(get_fragment_shader_source()); - shader->compile(); + shader->compile(); - ShaderCache::get_singleton()->add_shader(get_material_id(), shader); - } + ShaderCache::get_singleton()->add_shader(get_material_id(), shader); + } - setup_uniforms(); - } + setup_uniforms(); + } - if (current_material && current_material != this) { - current_material->unbind(); + if (current_material && current_material != this) { + current_material->unbind(); - setup_state(); - } + setup_state(); + } - current_material = this; + current_material = this; - shader->bind(); + shader->bind(); - bind_uniforms(); + bind_uniforms(); } void Material::unbind() { @@ -46,20 +46,82 @@ void Material::setup_uniforms() { void Material::setup_state() { } -GLint Material::get_uniform(const char* name) { - GLint uniform = glGetUniformLocation(shader->program, name); +int32_t Material::get_uniform(const char *name) { + int32_t uniform = glGetUniformLocation(shader->program, name); - if (uniform == -1) { - printf("%s is not a valid glsl program variable!\n", name); - } + if (uniform == -1) { + printf("%s is not a valid glsl program variable!\n", name); + } - return uniform; + return uniform; } Material::Material() { - shader = NULL; + shader = NULL; } 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; diff --git a/sfw/render_core/material.h b/sfw/render_core/material.h index 487b279..8fe2d37 100644 --- a/sfw/render_core/material.h +++ b/sfw/render_core/material.h @@ -20,10 +20,10 @@ public: virtual void bind_uniforms(); virtual void setup_uniforms(); virtual void setup_state(); - virtual const GLchar **get_vertex_shader_source() = 0; - virtual const GLchar **get_fragment_shader_source() = 0; + virtual const char **get_vertex_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(); virtual ~Material(); @@ -34,67 +34,9 @@ protected: Shader *shader; protected: - _FORCE_INLINE_ void set_uniform(GLint 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); - } - - _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); - } + void set_uniform(int32_t p_uniform, const Transform &p_transform); + void set_uniform(int32_t p_uniform, const Transform2D &p_transform); + void set_uniform(int32_t p_uniform, const Projection &p_matrix); }; #endif // MATERIAL_H diff --git a/sfw/render_core/mesh.h b/sfw/render_core/mesh.h index 2a01d8c..5c20f43 100644 --- a/sfw/render_core/mesh.h +++ b/sfw/render_core/mesh.h @@ -37,8 +37,8 @@ public: Mesh(int vert_dim); virtual ~Mesh(); - GLuint VBO; - GLuint IBO; + uint32_t VBO; + uint32_t IBO; int vertex_dimesions; diff --git a/sfw/render_core/shader.cpp b/sfw/render_core/shader.cpp index ecd33f0..df3c042 100644 --- a/sfw/render_core/shader.cpp +++ b/sfw/render_core/shader.cpp @@ -37,12 +37,12 @@ void Shader::compile() { 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); glCompileShader(vertex_shader); - GLint shader_compiled = GL_FALSE; + int32_t shader_compiled = GL_FALSE; glGetShaderiv(vertex_shader, GL_COMPILE_STATUS, &shader_compiled); if (shader_compiled != GL_TRUE) { print_shader_errors(vertex_shader, "compiling Vertex Shader"); @@ -51,7 +51,7 @@ void Shader::compile() { 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); glCompileShader(fragment_shader); @@ -72,7 +72,7 @@ void Shader::compile() { glLinkProgram(program); - GLint program_compiled = GL_FALSE; + int32_t program_compiled = GL_FALSE; glGetProgramiv(program, GL_LINK_STATUS, &program_compiled); if (program_compiled != GL_TRUE) { print_program_errors(program); @@ -85,23 +85,23 @@ void Shader::destroy() { glDeleteProgram(program); } -const GLchar **Shader::get_vertex_shader_source() { +const char **Shader::get_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; } -const GLchar **Shader::get_fragment_shader_source() { +const char **Shader::get_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; } -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; - Vector error_log; + Vector error_log; error_log.resize(max_length); 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()); } -void Shader::print_program_errors(const GLuint p_program) { +void Shader::print_program_errors(const uint32_t p_program) { if (glIsProgram(program)) { int info_length = 0; int max_length = 5000; diff --git a/sfw/render_core/shader.h b/sfw/render_core/shader.h index 3d4c0f9..53ce707 100644 --- a/sfw/render_core/shader.h +++ b/sfw/render_core/shader.h @@ -21,27 +21,27 @@ public: void compile(); void destroy(); - const GLchar **get_vertex_shader_source(); - void set_vertex_shader_source(const GLchar **source); + const char **get_vertex_shader_source(); + void set_vertex_shader_source(const char **source); - const GLchar **get_fragment_shader_source(); - void set_fragment_shader_source(const GLchar **source); + const char **get_fragment_shader_source(); + void set_fragment_shader_source(const char **source); - void print_shader_errors(const GLuint p_program, const char *name); - void print_program_errors(const GLuint p_program); + void print_shader_errors(const uint32_t p_program, const char *name); + void print_program_errors(const uint32_t p_program); Shader(); ~Shader(); - GLuint vertex_shader; - GLuint fragment_shader; - GLuint program; + uint32_t vertex_shader; + uint32_t fragment_shader; + uint32_t program; static Shader *current_shader; protected: - const GLchar **vertex_shader_source; - const GLchar **fragment_shader_source; + const char **vertex_shader_source; + const char **fragment_shader_source; }; class ShaderCache { diff --git a/sfw/render_core/texture.cpp b/sfw/render_core/texture.cpp index 1b5f332..9aa1423 100644 --- a/sfw/render_core/texture.cpp +++ b/sfw/render_core/texture.cpp @@ -35,9 +35,9 @@ Ref Texture::get_data() { //GLES - GLenum gl_format; - GLenum gl_internal_format; - GLenum gl_type; + uint32_t gl_format; + uint32_t gl_internal_format; + uint32_t gl_type; bool supported; _get_gl_format(_texture_format, gl_format, gl_internal_format, gl_type, supported); @@ -80,9 +80,9 @@ void Texture::upload() { return; } - GLenum gl_format; - GLenum gl_internal_format; - GLenum gl_type; + uint32_t gl_format; + uint32_t gl_internal_format; + uint32_t gl_type; bool supported; Image::Format image_format = _image->get_format(); _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); } - GLenum texture_type = GL_TEXTURE_2D; + uint32_t texture_type = GL_TEXTURE_2D; glBindTexture(texture_type, _texture); @@ -179,7 +179,7 @@ void Texture::upload() { 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_supported = true; diff --git a/sfw/render_core/texture.h b/sfw/render_core/texture.h index f41f35a..91ccbc9 100644 --- a/sfw/render_core/texture.h +++ b/sfw/render_core/texture.h @@ -20,7 +20,7 @@ public: TEXTURE_FLAG_MIP_MAPS = 1 << 3, }; - _FORCE_INLINE_ GLuint get_gl_texture() { + _FORCE_INLINE_ uint32_t get_gl_texture() { return _texture; } @@ -36,7 +36,7 @@ public: virtual ~Texture(); 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; @@ -49,7 +49,7 @@ protected: int _data_size; int _mipmaps; - GLuint _texture; + uint32_t _texture; }; //TODO @@ -64,7 +64,7 @@ public: protected: int _fbo_width; int _fbo_height; - GLuint _fbo; + uint32_t _fbo; }; #endif // TEXTURE_H diff --git a/sfw/render_core/texture_material.cpp b/sfw/render_core/texture_material.cpp index d017099..9afddee 100644 --- a/sfw/render_core/texture_material.cpp +++ b/sfw/render_core/texture_material.cpp @@ -31,8 +31,8 @@ void TextureMaterial::setup_state() { glEnable(GL_TEXTURE_2D); } -const GLchar **TextureMaterial::get_vertex_shader_source() { - static const GLchar *vertex_shader_source[] = { +const char **TextureMaterial::get_vertex_shader_source() { + static const char *vertex_shader_source[] = { "uniform mat4 u_proj_matrix;\n" "uniform mat4 u_camera_matrix;\n" "uniform mat4 u_model_view_matrix;\n" @@ -51,8 +51,8 @@ const GLchar **TextureMaterial::get_vertex_shader_source() { return vertex_shader_source; } -const GLchar **TextureMaterial::get_fragment_shader_source() { - static const GLchar *fragment_shader_source[] = { +const char **TextureMaterial::get_fragment_shader_source() { + static const char *fragment_shader_source[] = { "precision mediump float;\n" "\n" "uniform sampler2D u_texture;\n" diff --git a/sfw/render_core/texture_material.h b/sfw/render_core/texture_material.h index 0e979e2..7c36925 100644 --- a/sfw/render_core/texture_material.h +++ b/sfw/render_core/texture_material.h @@ -21,16 +21,16 @@ public: void unbind(); void setup_state(); - const GLchar **get_vertex_shader_source(); - const GLchar **get_fragment_shader_source(); + const char **get_vertex_shader_source(); + const char **get_fragment_shader_source(); TextureMaterial(); - GLint projection_matrix_location; - GLint camera_matrix_location; - GLint model_view_matrix_location; + int32_t projection_matrix_location; + int32_t camera_matrix_location; + int32_t model_view_matrix_location; - GLint texture_location; + int32_t texture_location; Ref texture; }; diff --git a/sfw/render_core/texture_material_2d.cpp b/sfw/render_core/texture_material_2d.cpp index 420cb70..5175016 100644 --- a/sfw/render_core/texture_material_2d.cpp +++ b/sfw/render_core/texture_material_2d.cpp @@ -28,8 +28,8 @@ void TextureMaterial2D::setup_state() { glEnable(GL_TEXTURE_2D); } -const GLchar **TextureMaterial2D::get_vertex_shader_source() { - static const GLchar *vertex_shader_source[] = { +const char **TextureMaterial2D::get_vertex_shader_source() { + static const char *vertex_shader_source[] = { "uniform mat4 u_proj_matrix;\n" "uniform mat4 u_model_view_matrix;\n" "\n" @@ -47,8 +47,8 @@ const GLchar **TextureMaterial2D::get_vertex_shader_source() { return vertex_shader_source; } -const GLchar **TextureMaterial2D::get_fragment_shader_source() { - static const GLchar *fragment_shader_source[] = { +const char **TextureMaterial2D::get_fragment_shader_source() { + static const char *fragment_shader_source[] = { "precision mediump float;\n" "\n" "uniform sampler2D u_texture;\n" diff --git a/sfw/render_core/texture_material_2d.h b/sfw/render_core/texture_material_2d.h index 52cbee3..9ae6ab6 100644 --- a/sfw/render_core/texture_material_2d.h +++ b/sfw/render_core/texture_material_2d.h @@ -21,15 +21,15 @@ public: void unbind(); void setup_state(); - const GLchar **get_vertex_shader_source(); - const GLchar **get_fragment_shader_source(); + const char **get_vertex_shader_source(); + const char **get_fragment_shader_source(); TextureMaterial2D(); - GLint projection_matrix_location; - GLint model_view_matrix_location; + int32_t projection_matrix_location; + int32_t model_view_matrix_location; - GLint texture_location; + int32_t texture_location; Ref texture; }; diff --git a/sfw/render_core/transparent_texture_material.cpp b/sfw/render_core/transparent_texture_material.cpp index f0d1827..7785d70 100644 --- a/sfw/render_core/transparent_texture_material.cpp +++ b/sfw/render_core/transparent_texture_material.cpp @@ -28,8 +28,8 @@ void TransparentTextureMaterial::setup_state() { glEnable(GL_TEXTURE_2D); } -const GLchar **TransparentTextureMaterial::get_vertex_shader_source() { - static const GLchar *vertex_shader_source[] = { +const char **TransparentTextureMaterial::get_vertex_shader_source() { + static const char *vertex_shader_source[] = { "uniform mat4 u_proj_matrix;\n" "uniform mat4 u_model_view_matrix;\n" "\n" @@ -47,8 +47,8 @@ const GLchar **TransparentTextureMaterial::get_vertex_shader_source() { return vertex_shader_source; } -const GLchar **TransparentTextureMaterial::get_fragment_shader_source() { - static const GLchar *fragment_shader_source[] = { +const char **TransparentTextureMaterial::get_fragment_shader_source() { + static const char *fragment_shader_source[] = { "precision mediump float;\n" "\n" "uniform sampler2D u_texture;\n" diff --git a/sfw/render_core/transparent_texture_material.h b/sfw/render_core/transparent_texture_material.h index 022bc8c..404174c 100644 --- a/sfw/render_core/transparent_texture_material.h +++ b/sfw/render_core/transparent_texture_material.h @@ -21,15 +21,15 @@ public: void unbind(); void setup_state(); - const GLchar **get_vertex_shader_source(); - const GLchar **get_fragment_shader_source(); + const char **get_vertex_shader_source(); + const char **get_fragment_shader_source(); TransparentTextureMaterial(); - GLint projection_matrix_location; - GLint model_view_matrix_location; + int32_t projection_matrix_location; + int32_t model_view_matrix_location; - GLint texture_location; + int32_t texture_location; Ref texture; };