summaryrefslogtreecommitdiff
path: root/src/render/modernopenglgraphics.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-06-12 22:27:45 +0300
committerAndrei Karas <akaras@inbox.ru>2014-06-12 22:27:45 +0300
commit720dbe1e5a90adb66ada166090e34a571e24ff0a (patch)
tree8d5ecd6fe7289d88011fb0cd6044de4b64a1b6a6 /src/render/modernopenglgraphics.cpp
parent79a05c5d68c2d24d0b0e1b47c5eaa88f47940736 (diff)
downloadmanaverse-720dbe1e5a90adb66ada166090e34a571e24ff0a.tar.gz
manaverse-720dbe1e5a90adb66ada166090e34a571e24ff0a.tar.bz2
manaverse-720dbe1e5a90adb66ada166090e34a571e24ff0a.tar.xz
manaverse-720dbe1e5a90adb66ada166090e34a571e24ff0a.zip
Add set vbo function into modernopengl.
Diffstat (limited to 'src/render/modernopenglgraphics.cpp')
-rw-r--r--src/render/modernopenglgraphics.cpp15
1 files changed, 11 insertions, 4 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];