diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-06-12 22:27:45 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-06-12 22:27:45 +0300 |
commit | 720dbe1e5a90adb66ada166090e34a571e24ff0a (patch) | |
tree | 8d5ecd6fe7289d88011fb0cd6044de4b64a1b6a6 | |
parent | 79a05c5d68c2d24d0b0e1b47c5eaa88f47940736 (diff) | |
download | manaverse-720dbe1e5a90adb66ada166090e34a571e24ff0a.tar.gz manaverse-720dbe1e5a90adb66ada166090e34a571e24ff0a.tar.bz2 manaverse-720dbe1e5a90adb66ada166090e34a571e24ff0a.tar.xz manaverse-720dbe1e5a90adb66ada166090e34a571e24ff0a.zip |
Add set vbo function into modernopengl.
-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 |