diff options
author | Michael Jaumann <meta_dev@yahoo.com> | 2014-11-20 15:11:19 +0000 |
---|---|---|
committer | Michael Jaumann <meta_dev@yahoo.com> | 2015-03-02 12:42:45 +0000 |
commit | 6fd4dd1cbac8242835614d5de9fec827ef927169 (patch) | |
tree | 00275084f39cda81fabfe083e61fcede0491c457 | |
parent | 3b1fc03cef647f919d6312ab98582bf70294b00f (diff) |
feed glDrawArrays with right vertexcount
Change-Id: I8aa835cc1b2f0f41d5c1051ae2a005928d625746
-rw-r--r-- | canvas/source/opengl/ogl_renderHelper.cxx | 19 | ||||
-rw-r--r-- | canvas/source/opengl/ogl_renderHelper.hxx | 1 |
2 files changed, 11 insertions, 9 deletions
diff --git a/canvas/source/opengl/ogl_renderHelper.cxx b/canvas/source/opengl/ogl_renderHelper.cxx index b192df21ebbe..acd0a1746f9e 100644 --- a/canvas/source/opengl/ogl_renderHelper.cxx +++ b/canvas/source/opengl/ogl_renderHelper.cxx @@ -29,7 +29,7 @@ namespace oglcanvas m_simpleTexUnf = glGetUniformLocation(m_simpleProgID, "TextTex"); m_manCordUnf = glGetUniformLocation(m_texManProgID, "texCord"); - m_texColorUnf = glGetUniformLocation(m_texProgID, "constantColor"); + m_texColorUnf = glGetUniformLocation(m_texProgID, "constColor"); m_manColorUnf = glGetUniformLocation(m_texManProgID,"colorTex"); m_simpleColorUnf = glGetUniformLocation(m_simpleProgID,"colorTex"); @@ -45,7 +45,7 @@ namespace oglcanvas m_simplePosAttrb = glGetAttribLocation(m_simpleProgID ,"vPosition"); m_texPosAttrb = glGetAttribLocation(m_texProgID ,"vPosition"); - glViewport(0, 0, m_iWidth, m_iHeight); + //glViewport(0, 0, m_iWidth, m_iHeight); } //Todo figgure out, which parameters i should use :) void RenderHelper::SetVP(int width, int height) @@ -62,6 +62,8 @@ namespace oglcanvas m_Model = mat; m_MVP = m_Projection * m_View * m_Model; } + + void RenderHelper::renderVertexConstColor(GLfloat vertices[], glm::vec4 color, GLenum mode) const { glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer); @@ -69,7 +71,7 @@ namespace oglcanvas glUseProgram(m_texProgID); - glUniform4fv(m_texColorUnf, 1, glm::value_ptr(color)); + glUniform4fv(m_texColorUnf, 1, &color[0]); glUniformMatrix4fv(m_texMVPUnf, 1, GL_FALSE, &m_MVP[0][0]); glEnableVertexAttribArray(m_texPosAttrb); //vertices @@ -83,7 +85,7 @@ namespace oglcanvas (void*)0 // array buffer offset ); - glDrawArrays(mode, 0, sizeof(vertices) / sizeof(vertices[0]) /2); + glDrawArrays(mode, 0, sizeof(vertices) / 2); glDisableVertexAttribArray(m_texPosAttrb); glBindBuffer(GL_ARRAY_BUFFER, 0); @@ -102,7 +104,8 @@ namespace oglcanvas glUseProgram(m_simpleProgID); glUniform1i(m_simpleTexUnf, 0); //Use texture Unit 0 - glUniform4fv(m_simpleColorUnf, 1, glm::value_ptr(color)); + + glUniform4fv(m_simpleColorUnf, 1, &color[0]); glUniformMatrix4fv(m_simpleMVPUnf, 1, GL_FALSE, &m_MVP[0][0]); glEnableVertexAttribArray(m_simplePosAttrb); @@ -127,7 +130,7 @@ namespace oglcanvas (void*)0 // array buffer offset ); - glDrawArrays(mode, 0, sizeof(vertices) / sizeof(vertices[0]) /2); + glDrawArrays(mode, 0, sizeof(vertices) / 2); glDisableVertexAttribArray(m_simplePosAttrb); glDisableVertexAttribArray(m_simpleUvAttrb); @@ -157,7 +160,7 @@ namespace oglcanvas //Set Uniforms glUniform1i(m_manTexUnf, 0); glUniform2f(m_manCordUnf,fWidth,fHeight); - glUniform4fv(m_manColorUnf, 1, glm::value_ptr(color)); + glUniform4fv(m_manColorUnf, 1, &color[0]); glUniformMatrix4fv(m_manMVPUnf, 1, GL_FALSE, &m_MVP[0][0]); glEnableVertexAttribArray(m_manPosAttrb); @@ -171,7 +174,7 @@ namespace oglcanvas (void*)0 // array buffer offset ); - glDrawArrays(mode, 0, sizeof(vertices) / sizeof(vertices[0]) /2); + glDrawArrays(mode, 0, sizeof(vertices) / 2); glDisableVertexAttribArray(m_manPosAttrb); glBindBuffer(GL_ARRAY_BUFFER, 0); diff --git a/canvas/source/opengl/ogl_renderHelper.hxx b/canvas/source/opengl/ogl_renderHelper.hxx index 66d4e5eb0198..803e198806ec 100644 --- a/canvas/source/opengl/ogl_renderHelper.hxx +++ b/canvas/source/opengl/ogl_renderHelper.hxx @@ -12,7 +12,6 @@ #include <GL/glew.h> #include <glm/glm.hpp> #include "glm/gtx/transform.hpp" -#include <glm/gtc/type_ptr.hpp> namespace oglcanvas { class RenderHelper |