summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2008-05-06 18:09:03 +0000
committerSteven Bennetts <steve@lindenlab.com>2008-05-06 18:09:03 +0000
commit068da0b5655fc3c735cd8019ab3b6bb0defec4c0 (patch)
tree143580a4ff29c4c4df91c41e1429add4abaa3f87 /indra/llrender
parenteb14fece837683ebc58540d7f10eb74f5a5fbd4e (diff)
merge release-QAR-511 Viewer 1.20 RC 5
merge Branch_1-20-Viewer -r 85828 : 86279 -> release
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llrendertarget.cpp10
-rw-r--r--indra/llrender/llrendertarget.h3
-rw-r--r--indra/llrender/llvertexbuffer.cpp16
3 files changed, 29 insertions, 0 deletions
diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp
index cbadb029ac..4efe078ad7 100644
--- a/indra/llrender/llrendertarget.cpp
+++ b/indra/llrender/llrendertarget.cpp
@@ -33,6 +33,7 @@
#include "llrendertarget.h"
#include "llglimmediate.h"
+#include "llgl.h"
BOOL LLRenderTarget::sUseFBO = FALSE;
@@ -150,6 +151,15 @@ void LLRenderTarget::bindTarget()
glViewport(0, 0, mResX, mResY);
}
+// static
+void LLRenderTarget::unbindTarget()
+{
+ if (gGLManager.mHasFramebufferObject)
+ {
+ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+ }
+}
+
void LLRenderTarget::clear()
{
U32 mask = GL_COLOR_BUFFER_BIT;
diff --git a/indra/llrender/llrendertarget.h b/indra/llrender/llrendertarget.h
index 27c40fcfcf..df88640970 100644
--- a/indra/llrender/llrendertarget.h
+++ b/indra/llrender/llrendertarget.h
@@ -83,6 +83,9 @@ public:
//bind target for rendering
//applies appropriate viewport
void bindTarget();
+
+ //unbind target for rendering
+ static void unbindTarget();
//clear render targer, clears depth buffer if present,
//uses scissor rect if in copy-to-texture mode
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index b646a02cae..99fd2b33d4 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -491,6 +491,7 @@ void LLVertexBuffer::destroyGLBuffer()
}
mGLBuffer = 0;
+ unbind();
}
void LLVertexBuffer::destroyGLIndices()
@@ -517,6 +518,7 @@ void LLVertexBuffer::destroyGLIndices()
}
mGLIndices = 0;
+ unbind();
}
void LLVertexBuffer::updateNumVerts(S32 nverts)
@@ -737,8 +739,11 @@ U8* LLVertexBuffer::mapBuffer(S32 access)
{
setBuffer(0);
mLocked = TRUE;
+ stop_glerror();
mMappedData = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
+ stop_glerror();
mMappedIndexData = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
+ stop_glerror();
/*if (sMapped)
{
llerrs << "Mapped two VBOs at the same time!" << llendl;
@@ -767,8 +772,11 @@ void LLVertexBuffer::unmapBuffer()
{
if (useVBOs() && mLocked)
{
+ stop_glerror();
glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
+ stop_glerror();
glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB);
+ stop_glerror();
/*if (!sMapped)
{
@@ -907,7 +915,9 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
{
llerrs << "VBO bound while another VBO mapped!" << llendl;
}*/
+ stop_glerror();
glBindBufferARB(GL_ARRAY_BUFFER_ARB, mGLBuffer);
+ stop_glerror();
sBindCount++;
sVBOActive = TRUE;
setup = TRUE; // ... or the bound buffer changed
@@ -918,7 +928,9 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
{
llerrs << "VBO bound while another VBO mapped!" << llendl;
}*/
+ stop_glerror();
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mGLIndices);
+ stop_glerror();
sBindCount++;
sIBOActive = TRUE;
}
@@ -927,11 +939,15 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
{
if (mGLBuffer)
{
+ stop_glerror();
glBufferDataARB(GL_ARRAY_BUFFER_ARB, getSize(), NULL, mUsage);
+ stop_glerror();
}
if (mGLIndices)
{
+ stop_glerror();
glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, getIndicesSize(), NULL, mUsage);
+ stop_glerror();
}
mEmpty = TRUE;