aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/graphics/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/graphics/shaders')
-rw-r--r--src/libjin/graphics/shaders/je_shader.cpp11
-rw-r--r--src/libjin/graphics/shaders/je_shader.h14
2 files changed, 21 insertions, 4 deletions
diff --git a/src/libjin/graphics/shaders/je_shader.cpp b/src/libjin/graphics/shaders/je_shader.cpp
index b7a4bba..8fbb133 100644
--- a/src/libjin/graphics/shaders/je_shader.cpp
+++ b/src/libjin/graphics/shaders/je_shader.cpp
@@ -252,20 +252,27 @@ if (success == GL_FALSE) \
glUniformMatrix4fv(loc, 1, GL_FALSE, mat4->getElements());
}
- void Shader::setVertexPointer(int n, GLenum type, GLsizei stride, const GLvoid * pointers)
+ void Shader::uploadVertices(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::setUVPointer(int n, GLenum type, GLsizei stride, const GLvoid * pointers)
+ void Shader::uploadUV(int n, GLenum type, GLsizei stride, const GLvoid * pointers)
{
GLint loc = glGetAttribLocation(mPID, SHADER_TEXTURE_COORDS);
glEnableVertexAttribArray(1);
glVertexAttribPointer(loc, n, type, GL_FALSE, stride, pointers);
}
+ void Shader::uploadAttribute(const String& name, int n, GLenum type, GLsizei stride, const GLvoid * pointers)
+ {
+ GLint loc = glGetAttribLocation(mPID, name);
+ glEnableVertexAttribArray(1);
+ glVertexAttribPointer(loc, n, type, GL_FALSE, stride, pointers);
+ }
+
} // namespace Shaders
} // namespace Graphics
} // namespace JinEngine
diff --git a/src/libjin/graphics/shaders/je_shader.h b/src/libjin/graphics/shaders/je_shader.h
index a92e206..9056d51 100644
--- a/src/libjin/graphics/shaders/je_shader.h
+++ b/src/libjin/graphics/shaders/je_shader.h
@@ -9,6 +9,8 @@
#include "GLee/GLee.h"
+#include "../../common/je_string.h"
+
#include "../je_color.h"
#include "../je_texture.h"
#include "../je_canvas.h"
@@ -130,7 +132,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 setVertexPointer(int n, GLenum type, GLsizei stride, const GLvoid * pointers);
+ void uploadVertices(int n, GLenum type, GLsizei stride, const GLvoid * pointers);
///
/// Set texture UV coordinates.
@@ -140,8 +142,16 @@ 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 setUVPointer(int n, GLenum type, GLsizei stride, const GLvoid * pointers);
+ void uploadUV(int n, GLenum type, GLsizei stride, const GLvoid * pointers);
+
+ ///
+ /// Set attribute.
+ ///
+ void uploadAttribute(const String& name, int n, GLenum type, GLsizei stride, const GLvoid * pointers);
+ ///
+ /// Program ID.
+ ///
inline GLuint getGLProgramID() { return mPID; };
protected: