From e8a8db1e71d90eda2f76b6c34afc8c1ec5cd2b8b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 11 Jun 2014 12:44:57 +0300 Subject: In modernopengl for textures use one attribute (before was two) --- src/render/modernopenglgraphics.cpp | 16 +--------------- src/render/modernopenglgraphics.h | 1 - 2 files changed, 1 insertion(+), 16 deletions(-) (limited to 'src') diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp index 7ab94348c..3241821ba 100644 --- a/src/render/modernopenglgraphics.cpp +++ b/src/render/modernopenglgraphics.cpp @@ -100,7 +100,6 @@ ModernOpenGLGraphics::ModernOpenGLGraphics() : mSimpleColorUniform(0U), mSimplePosAttrib(0), mTexturePosAttrib(0), - mTexAttrib(0), mSimpleScreenUniform(0U), mTextureScreenUniform(0U), mVao(0U), @@ -169,10 +168,8 @@ void ModernOpenGLGraphics::postInit() mglVertexAttribFormat(mSimplePosAttrib, 2, GL_FLOAT, GL_FALSE, 0); mTexturePosAttrib = mglGetAttribLocation(mTextureProgramId, "position"); - mTexAttrib = mglGetAttribLocation(mTextureProgramId, "texcoord"); mTextureScreenUniform = mglGetUniformLocation(mTextureProgramId, "screen"); - mglVertexAttribFormat(mTexturePosAttrib, 2, GL_FLOAT, GL_FALSE, 0); - mglVertexAttribFormat(mTexAttrib, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(GLfloat)); + mglVertexAttribFormat(mTexturePosAttrib, 4, GL_FLOAT, GL_FALSE, 0); screenResized(); } @@ -288,11 +285,7 @@ void ModernOpenGLGraphics::drawQuad(const Image *const image, }; mglBindVertexBuffer(0, mVbo, 0, 4 * sizeof(GLfloat)); - mglBindVertexBuffer(1, mVbo, 0, 4 * sizeof(GLfloat)); - mglVertexAttribBinding(mTexturePosAttrib, 0); - mglVertexAttribBinding(mTexAttrib, 1); - mglBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_DYNAMIC_DRAW); @@ -761,7 +754,6 @@ void ModernOpenGLGraphics::setTexturingAndBlending(const bool enable) mglDisableVertexAttribArray(mSimplePosAttrib); mglUseProgram(mTextureProgramId); mglEnableVertexAttribArray(mTexturePosAttrib); - mglEnableVertexAttribArray(mTexAttrib); } if (!mAlpha) { @@ -775,7 +767,6 @@ void ModernOpenGLGraphics::setTexturingAndBlending(const bool enable) { mTextureDraw = false; mglDisableVertexAttribArray(mTexturePosAttrib); - mglDisableVertexAttribArray(mTexAttrib); mglUseProgram(mSimpleProgramId); mglEnableVertexAttribArray(mSimplePosAttrib); } @@ -855,13 +846,8 @@ void ModernOpenGLGraphics::clearScreen() const void ModernOpenGLGraphics::drawTriangleArray(const int size) { mglBindVertexBuffer(0, mVbo, 0, 4 * sizeof(GLfloat)); - mglBindVertexBuffer(1, mVbo, 0, 4 * sizeof(GLfloat)); - mglVertexAttribBinding(mTexturePosAttrib, 0); - mglVertexAttribBinding(mTexAttrib, 1); - mglBufferData(GL_ARRAY_BUFFER, size, mFloatArray, GL_DYNAMIC_DRAW); - glDrawArrays(GL_TRIANGLES, 0, size / 2);; } diff --git a/src/render/modernopenglgraphics.h b/src/render/modernopenglgraphics.h index 1fed5d371..5519fd282 100644 --- a/src/render/modernopenglgraphics.h +++ b/src/render/modernopenglgraphics.h @@ -98,7 +98,6 @@ class ModernOpenGLGraphics final : public Graphics GLuint mSimpleColorUniform; GLint mSimplePosAttrib; GLint mTexturePosAttrib; - GLint mTexAttrib; GLuint mSimpleScreenUniform; GLuint mTextureScreenUniform; GLuint mVao; -- cgit v1.2.3-70-g09d2