diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-06-11 12:44:57 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-06-11 12:44:57 +0300 |
commit | e8a8db1e71d90eda2f76b6c34afc8c1ec5cd2b8b (patch) | |
tree | 8877badb3d70f78adf16bdd57c8bd3217877b783 /src/render | |
parent | 16aee7e951a63492548380517eb550be93ce4369 (diff) | |
download | plus-e8a8db1e71d90eda2f76b6c34afc8c1ec5cd2b8b.tar.gz plus-e8a8db1e71d90eda2f76b6c34afc8c1ec5cd2b8b.tar.bz2 plus-e8a8db1e71d90eda2f76b6c34afc8c1ec5cd2b8b.tar.xz plus-e8a8db1e71d90eda2f76b6c34afc8c1ec5cd2b8b.zip |
In modernopengl for textures use one attribute (before was two)
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/modernopenglgraphics.cpp | 16 | ||||
-rw-r--r-- | src/render/modernopenglgraphics.h | 1 |
2 files changed, 1 insertions, 16 deletions
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; |