aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lldrawpoolwater.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/lldrawpoolwater.cpp')
-rw-r--r--linden/indra/newview/lldrawpoolwater.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/linden/indra/newview/lldrawpoolwater.cpp b/linden/indra/newview/lldrawpoolwater.cpp
index d8303bd..6e2c42a 100644
--- a/linden/indra/newview/lldrawpoolwater.cpp
+++ b/linden/indra/newview/lldrawpoolwater.cpp
@@ -68,11 +68,11 @@ LLDrawPoolWater::LLDrawPoolWater() :
68 LLFacePool(POOL_WATER) 68 LLFacePool(POOL_WATER)
69{ 69{
70 mHBTex[0] = gImageList.getImage(gSunTextureID, TRUE, TRUE); 70 mHBTex[0] = gImageList.getImage(gSunTextureID, TRUE, TRUE);
71 mHBTex[0]->bind(); 71 gGL.getTexUnit(0)->bind(mHBTex[0].get());
72 mHBTex[0]->setClamp(TRUE, TRUE); 72 mHBTex[0]->setClamp(TRUE, TRUE);
73 73
74 mHBTex[1] = gImageList.getImage(gMoonTextureID, TRUE, TRUE); 74 mHBTex[1] = gImageList.getImage(gMoonTextureID, TRUE, TRUE);
75 mHBTex[1]->bind(); 75 gGL.getTexUnit(0)->bind(mHBTex[1].get());
76 mHBTex[1]->setClamp(TRUE, TRUE); 76 mHBTex[1]->setClamp(TRUE, TRUE);
77 77
78 mWaterImagep = gImageList.getImage(WATER_TEST); 78 mWaterImagep = gImageList.getImage(WATER_TEST);
@@ -166,10 +166,9 @@ void LLDrawPoolWater::render(S32 pass)
166 166
167 // Set up second pass first 167 // Set up second pass first
168 mWaterImagep->addTextureStats(1024.f*1024.f); 168 mWaterImagep->addTextureStats(1024.f*1024.f);
169 mWaterImagep->bind(1);
170 gGL.getTexUnit(1)->activate(); 169 gGL.getTexUnit(1)->activate();
171 170 gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
172 glEnable(GL_TEXTURE_2D); // Texture unit 1 171 gGL.getTexUnit(1)->bind(mWaterImagep.get());
173 172
174 LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis(); 173 LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis();
175 F32 up_dot = camera_up * LLVector3::z_axis; 174 F32 up_dot = camera_up * LLVector3::z_axis;
@@ -218,20 +217,20 @@ void LLDrawPoolWater::render(S32 pass)
218 { 217 {
219 continue; 218 continue;
220 } 219 }
221 face->bindTexture(); 220 gGL.getTexUnit(0)->bind(face->getTexture());
222 face->renderIndexed(); 221 face->renderIndexed();
223 } 222 }
224 223
225 // Now, disable texture coord generation on texture state 1 224 // Now, disable texture coord generation on texture state 1
226 gGL.getTexUnit(1)->activate(); 225 gGL.getTexUnit(1)->activate();
227 glDisable(GL_TEXTURE_2D); // Texture unit 1 226 gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
227 gGL.getTexUnit(1)->disable();
228 glDisable(GL_TEXTURE_GEN_S); //texture unit 1 228 glDisable(GL_TEXTURE_GEN_S); //texture unit 1
229 glDisable(GL_TEXTURE_GEN_T); //texture unit 1 229 glDisable(GL_TEXTURE_GEN_T); //texture unit 1
230 LLImageGL::unbindTexture(1, GL_TEXTURE_2D);
231 230
232 // Disable texture coordinate and color arrays 231 // Disable texture coordinate and color arrays
233 gGL.getTexUnit(0)->activate(); 232 gGL.getTexUnit(0)->activate();
234 LLImageGL::unbindTexture(0, GL_TEXTURE_2D); 233 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
235 234
236 stop_glerror(); 235 stop_glerror();
237 236
@@ -275,8 +274,9 @@ void LLDrawPoolWater::render(S32 pass)
275 { 274 {
276 gSky.mVOSkyp->getCubeMap()->disable(); 275 gSky.mVOSkyp->getCubeMap()->disable();
277 } 276 }
278 LLImageGL::unbindTexture(0, GL_TEXTURE_2D); 277
279 glEnable(GL_TEXTURE_2D); 278 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
279 gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
280 glMatrixMode(GL_TEXTURE); 280 glMatrixMode(GL_TEXTURE);
281 glLoadIdentity(); 281 glLoadIdentity();
282 glMatrixMode(GL_MODELVIEW); 282 glMatrixMode(GL_MODELVIEW);
@@ -316,7 +316,7 @@ void LLDrawPoolWater::renderReflection(LLFace* face)
316 316
317 LLGLSNoFog noFog; 317 LLGLSNoFog noFog;
318 318
319 LLViewerImage::bindTexture(mHBTex[dr]); 319 gGL.getTexUnit(0)->bind(mHBTex[dr].get());
320 320
321 LLOverrideFaceColor override(this, face->getFaceColor().mV); 321 LLOverrideFaceColor override(this, face->getFaceColor().mV);
322 face->renderIndexed(); 322 face->renderIndexed();
@@ -390,7 +390,7 @@ void LLDrawPoolWater::shade()
390 if (reftex > -1) 390 if (reftex > -1)
391 { 391 {
392 gGL.getTexUnit(reftex)->activate(); 392 gGL.getTexUnit(reftex)->activate();
393 gPipeline.mWaterRef.bindTexture(); 393 gGL.getTexUnit(reftex)->bind(&gPipeline.mWaterRef);
394 gGL.getTexUnit(0)->activate(); 394 gGL.getTexUnit(0)->activate();
395 } 395 }
396 396
@@ -406,7 +406,7 @@ void LLDrawPoolWater::shade()
406 } 406 }
407 407
408 mWaterNormp->addTextureStats(1024.f*1024.f); 408 mWaterNormp->addTextureStats(1024.f*1024.f);
409 mWaterNormp->bind(bumpTex); 409 gGL.getTexUnit(bumpTex)->bind(mWaterNormp.get());
410 mWaterNormp->setMipFilterNearest (mWaterNormp->getMipFilterNearest(), 410 mWaterNormp->setMipFilterNearest (mWaterNormp->getMipFilterNearest(),
411 !gSavedSettings.getBOOL("RenderWaterMipNormal")); 411 !gSavedSettings.getBOOL("RenderWaterMipNormal"));
412 412
@@ -421,8 +421,8 @@ void LLDrawPoolWater::shade()
421 shader->uniform1f(LLViewerShaderMgr::WATER_FOGDENSITY, 421 shader->uniform1f(LLViewerShaderMgr::WATER_FOGDENSITY,
422 param_mgr->getFogDensity()); 422 param_mgr->getFogDensity());
423 } 423 }
424 424
425 gPipeline.mWaterDis.bindTexture(); 425 gGL.getTexUnit(screentex)->bind(&gPipeline.mWaterDis);
426 426
427 if (mVertexShaderLevel == 1) 427 if (mVertexShaderLevel == 1)
428 { 428 {
@@ -502,7 +502,7 @@ void LLDrawPoolWater::shade()
502 } 502 }
503 503
504 LLVOWater* water = (LLVOWater*) face->getViewerObject(); 504 LLVOWater* water = (LLVOWater*) face->getViewerObject();
505 face->bindTexture(diffTex); 505 gGL.getTexUnit(diffTex)->bind(face->getTexture());
506 506
507 sNeedsReflectionUpdate = TRUE; 507 sNeedsReflectionUpdate = TRUE;
508 508
@@ -527,7 +527,7 @@ void LLDrawPoolWater::shade()
527 } 527 }
528 } 528 }
529 529
530 shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, GL_TEXTURE_CUBE_MAP_ARB); 530 shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
531 shader->disableTexture(LLViewerShaderMgr::WATER_SCREENTEX); 531 shader->disableTexture(LLViewerShaderMgr::WATER_SCREENTEX);
532 shader->disableTexture(LLViewerShaderMgr::BUMP_MAP); 532 shader->disableTexture(LLViewerShaderMgr::BUMP_MAP);
533 shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); 533 shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
@@ -536,7 +536,7 @@ void LLDrawPoolWater::shade()
536 shader->unbind(); 536 shader->unbind();
537 537
538 gGL.getTexUnit(0)->activate(); 538 gGL.getTexUnit(0)->activate();
539 glEnable(GL_TEXTURE_2D); 539 gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
540 gGL.setColorMask(true, false); 540 gGL.setColorMask(true, false);
541 541
542} 542}