This commit is contained in:
Shyotl
2012-03-28 19:40:37 -05:00
parent 3d6511f4e1
commit 86c65e492d
5 changed files with 28 additions and 8 deletions

View File

@@ -645,7 +645,7 @@ void LLMultisampleBuffer::release()
if (mTex.size() > 0)
{
sBytesAllocated -= mResX*mResY*4*mResX*mResY*4*mTex.size();
sBytesAllocated -= mResX*mResY*4*mTex.size();
glDeleteRenderbuffers(mTex.size(), (GLuint *) &mTex[0]);
mTex.clear();

View File

@@ -129,8 +129,16 @@ BOOL LLViewerDynamicTexture::render()
//-----------------------------------------------------------------------------
void LLViewerDynamicTexture::preRender(BOOL clear_depth)
{
{
// force rendering to on-screen portion of frame buffer
//only images up to 512x512 are supported
llassert(mFullHeight <= 512);
llassert(mFullWidth <= 512);
if (gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete())
{ //using offscreen render target, just use the bottom left corner
mOrigin.set(0, 0);
}
else
{ // force rendering to on-screen portion of frame buffer
LLCoordScreen window_pos;
gViewerWindow->getWindow()->getPosition( &window_pos );
mOrigin.set(0, gViewerWindow->getWindowHeightRaw() - mFullHeight); // top left corner
@@ -145,8 +153,8 @@ void LLViewerDynamicTexture::preRender(BOOL clear_depth)
mOrigin.mY = llmax(mOrigin.mY, 0) ;
}
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
}
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
// Set up camera
LLViewerCamera* camera = LLViewerCamera::getInstance();
mCamera.setOrigin(*camera);
@@ -212,6 +220,12 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
return TRUE;
}
bool use_fbo = gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete();
if (use_fbo)
{
gPipeline.mWaterDis.bindTarget();
}
LLGLSLShader::bindNoShader();
LLVertexBuffer::unbind();
@@ -245,6 +259,11 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
}
}
if (use_fbo)
{
gPipeline.mWaterDis.flush();
}
return ret;
}

View File

@@ -362,7 +362,7 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy )
// rotateMat.setFwdRow( boneX );
// rotateMat.setLeftRow( boneY );
// rotateMat.setUpRow( boneZ );
// gGL.multMAtrix( &rotateMat.mMatrix[0][0] );
// gGL.multMatrix( &rotateMat.mMatrix[0][0] );
// // render the bone
// gGL.color3f( 0.5f, 0.5f, 0.0f );

View File

@@ -777,7 +777,7 @@ void LLViewerJointMesh::updateGeometry(LLFace *mFace, LLPolyMesh *mMesh)
LLStrider<LLVector3> o_normals;
//get vertex and normal striders
LLVertexBuffer *buffer = mFace->getVertexBuffer();
LLVertexBuffer* buffer = mFace->getVertexBuffer();
buffer->getVertexStrider(o_vertices, 0);
buffer->getNormalStrider(o_normals, 0);

View File

@@ -884,10 +884,11 @@ void LLPipeline::createGLBuffers()
if (LLPipeline::sWaterReflections)
{ //water reflection texture
U32 res = (U32) gSavedSettings.getS32("RenderWaterRefResolution");
U32 res = (U32) llmax(gSavedSettings.getS32("RenderWaterRefResolution"), 512);
mWaterRef.allocate(res,res,GL_RGBA,TRUE,FALSE);
mWaterDis.allocate(res,res,GL_RGBA,TRUE,FALSE);
//always use FBO for mWaterDis so it can be used for avatar texture bakes
mWaterDis.allocate(res,res,GL_RGBA,TRUE,FALSE,LLTexUnit::TT_TEXTURE, true);
}