From c734eb129d24a5ed6dcad8fa8fd1bdb3352f1257 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 31 Oct 2018 20:44:20 +0800 Subject: =?UTF-8?q?*=E6=9B=B4=E6=96=B0=E6=B8=B2=E6=9F=93=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/Graphics/shaders/je_base.shader.h | 3 ++- src/libjin/Graphics/shaders/je_shader.cpp | 4 ++-- src/libjin/Graphics/shaders/je_shader.h | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src/libjin/Graphics/shaders') diff --git a/src/libjin/Graphics/shaders/je_base.shader.h b/src/libjin/Graphics/shaders/je_base.shader.h index e5ca2c3..88fa872 100644 --- a/src/libjin/Graphics/shaders/je_base.shader.h +++ b/src/libjin/Graphics/shaders/je_base.shader.h @@ -26,8 +26,9 @@ static const char* base_vertex = R"( #version 130 core %s - +// Projection matrix uniform mat4 jin_ProjectionMatrix; +// Model view matrix uniform mat4 jin_ModelMatrix; in vec2 jin_VertexCoords; diff --git a/src/libjin/Graphics/shaders/je_shader.cpp b/src/libjin/Graphics/shaders/je_shader.cpp index 3eae5c7..c1abbf0 100644 --- a/src/libjin/Graphics/shaders/je_shader.cpp +++ b/src/libjin/Graphics/shaders/je_shader.cpp @@ -260,14 +260,14 @@ if (success == GL_FALSE) \ glUniformMatrix4fv(loc, 1, GL_FALSE, mat4->getElements()); } - void Shader::bindVertexPointer(int n, GLenum type, GLsizei stride, const GLvoid * pointers) + void Shader::setVertexPointer(int n, GLenum type, GLsizei stride, const GLvoid * pointers) { GLint loc = glGetAttribLocation(mPID, SHADER_VERTEX_COORDS); glEnableVertexAttribArray(0); glVertexAttribPointer(loc, n, type, GL_FALSE, stride, pointers); } - void Shader::bindUVPointer(int n, GLenum type, GLsizei stride, const GLvoid * pointers) + void Shader::setUVPointer(int n, GLenum type, GLsizei stride, const GLvoid * pointers) { GLint loc = glGetAttribLocation(mPID, SHADER_TEXTURE_COORDS); glEnableVertexAttribArray(1); diff --git a/src/libjin/Graphics/shaders/je_shader.h b/src/libjin/Graphics/shaders/je_shader.h index 09cda51..d89b827 100644 --- a/src/libjin/Graphics/shaders/je_shader.h +++ b/src/libjin/Graphics/shaders/je_shader.h @@ -146,7 +146,7 @@ namespace JinEngine /// @param stride Byte offset between consecutive generic vertex attributes. /// @param pointers Pointer to the first component of the first generic vertex attribute in the array. /// - void bindVertexPointer(int n, GLenum type, GLsizei stride, const GLvoid * pointers); + void setVertexPointer(int n, GLenum type, GLsizei stride, const GLvoid * pointers); /// /// Set texture UV coordinates. @@ -156,7 +156,7 @@ namespace JinEngine /// @param stride Byte offset between consecutive generic vertex attributes. /// @param pointers Pointer to the first component of the first generic vertex attribute in the array. /// - void bindUVPointer(int n, GLenum type, GLsizei stride, const GLvoid * pointers); + void setUVPointer(int n, GLenum type, GLsizei stride, const GLvoid * pointers); protected: /// -- cgit v1.1-26-g67d0