diff options
Diffstat (limited to 'indra/newview/llsurface.cpp')
-rw-r--r-- | indra/newview/llsurface.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp index de3d80f044..5440b2c9ad 100644 --- a/indra/newview/llsurface.cpp +++ b/indra/newview/llsurface.cpp @@ -214,7 +214,7 @@ void LLSurface::create(const S32 grids_per_edge, LLViewerTexture* LLSurface::getSTexture() { - if (mSTexturep.notNull() && !mSTexturep->hasValidGLTexture()) + if (mSTexturep.notNull() && !mSTexturep->hasGLTexture()) { createSTexture(); } @@ -223,7 +223,7 @@ LLViewerTexture* LLSurface::getSTexture() LLViewerTexture* LLSurface::getWaterTexture() { - if (mWaterTexturep.notNull() && !mWaterTexturep->hasValidGLTexture()) + if (mWaterTexturep.notNull() && !mWaterTexturep->hasGLTexture()) { createWaterTexture(); } @@ -235,6 +235,12 @@ void LLSurface::createSTexture() if (!mSTexturep) { // Fill with dummy gray data. + + //mSTexturep = LLViewerTextureManager::getLocalTexture(sTextureSize, sTextureSize, 3, FALSE); + //mSTexturep->dontDiscard(); + //mSTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); + + // GL NOT ACTIVE HERE LLPointer<LLImageRaw> raw = new LLImageRaw(sTextureSize, sTextureSize, 3); U8 *default_texture = raw->getData(); for (S32 i = 0; i < sTextureSize; i++) @@ -270,7 +276,8 @@ void LLSurface::createWaterTexture() *(default_texture + (i*sTextureSize/2 + j)*4 + 2) = MAX_WATER_COLOR.mV[2]; *(default_texture + (i*sTextureSize/2 + j)*4 + 3) = MAX_WATER_COLOR.mV[3]; } - } + } + mWaterTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE); mWaterTexturep->dontDiscard(); gGL.getTexUnit(0)->bind(mWaterTexturep); @@ -1189,7 +1196,7 @@ F32 LLSurface::getWaterHeight() const BOOL LLSurface::generateWaterTexture(const F32 x, const F32 y, const F32 width, const F32 height) { - if (!getWaterTexture() || !mWaterTexturep->hasGLTexture()) + if (!getWaterTexture()) { return FALSE; } @@ -1273,6 +1280,11 @@ BOOL LLSurface::generateWaterTexture(const F32 x, const F32 y, } } + if (!mWaterTexturep->hasGLTexture()) + { + mWaterTexturep->createGLTexture(0, raw); + } + mWaterTexturep->setSubImage(raw, x_begin, y_begin, x_end - x_begin, y_end - y_begin); return TRUE; } |