diff options
-rw-r--r-- | src/render/modernopenglgraphics.cpp | 15 | ||||
-rw-r--r-- | src/render/modernopenglgraphics.h | 6 |
2 files changed, 14 insertions, 7 deletions
diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp index 1d5ef1593..fc21fd622 100644 --- a/src/render/modernopenglgraphics.cpp +++ b/src/render/modernopenglgraphics.cpp @@ -88,9 +88,6 @@ ModernOpenGLGraphics::ModernOpenGLGraphics() : mProgram(nullptr), mAlphaCached(1.0F), mVpCached(0), - mIsByteColor(false), - mByteColor(), - mImageCached(0), mFloatColor(1.0F), mMaxVertices(500), mProgramId(0U), @@ -101,6 +98,7 @@ ModernOpenGLGraphics::ModernOpenGLGraphics() : mDrawTypeUniform(0U), mVao(0U), mVbo(0U), + mVboCached(0U), mColorAlpha(false), mTextureDraw(false), #ifdef DEBUG_BIND_TEXTURE @@ -146,7 +144,7 @@ void ModernOpenGLGraphics::postInit() mglGenVertexArrays(1, &mVao); mglBindVertexArray(mVao); mglGenBuffers(1, &mVbo); - mglBindBuffer(GL_ARRAY_BUFFER, mVbo); + bindArrayBuffer(mVbo); logger->log("Compiling shaders"); mProgram = shaders.getSimpleProgram(); @@ -967,6 +965,15 @@ void ModernOpenGLGraphics::bindTexture(const GLenum target, } } +void ModernOpenGLGraphics::bindArrayBuffer(const GLuint vbo) +{ + if (mVboCached != vbo) + { + mVboCached = vbo; + mglBindBuffer(GL_ARRAY_BUFFER, vbo); + } +} + void ModernOpenGLGraphics::dumpSettings() { GLint test[1000]; diff --git a/src/render/modernopenglgraphics.h b/src/render/modernopenglgraphics.h index 3528462a8..ada964ee9 100644 --- a/src/render/modernopenglgraphics.h +++ b/src/render/modernopenglgraphics.h @@ -89,15 +89,14 @@ class ModernOpenGLGraphics final : public Graphics inline void drawLineArrays(const int size); + inline void bindArrayBuffer(const GLuint vbo); + GLfloat *mFloatArray; GLfloat *mFloatArrayCached; ShaderProgram *mProgram; float mAlphaCached; int mVpCached; - bool mIsByteColor; - Color mByteColor; - GLuint mImageCached; float mFloatColor; int mMaxVertices; GLuint mProgramId; @@ -108,6 +107,7 @@ class ModernOpenGLGraphics final : public Graphics GLuint mDrawTypeUniform; GLuint mVao; GLuint mVbo; + GLuint mVboCached; bool mColorAlpha; bool mTextureDraw; #ifdef DEBUG_BIND_TEXTURE |