Skip to content

Commit b55d2f9

Browse files
author
rt
committed
fix #5850
1 parent b4cd4a1 commit b55d2f9

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

rts/Rendering/Env/BumpWater.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ CBumpWater::CBumpWater()
147147

148148
// LOAD TEXTURES
149149
foamTexture = LoadTexture(waterRendering->foamTexture);
150-
normalTexture = LoadTexture(waterRendering->normalTexture , anisotropy , &normalTextureX, &normalTextureY);
150+
normalTexture = LoadTexture(waterRendering->normalTexture, anisotropy, &normalTextureX, &normalTextureY);
151151

152152
// caustic textures
153153
if (waterRendering->causticTextures.empty())
@@ -229,20 +229,18 @@ CBumpWater::CBumpWater()
229229
coastFBO.Bind();
230230
coastFBO.AttachTexture(coastTexture, GL_TEXTURE_2D, GL_COLOR_ATTACHMENT0);
231231

232-
if (coastFBO.CheckStatus("BUMPWATER(Coastmap)")) {
232+
if ((shoreWaves = coastFBO.CheckStatus("BUMPWATER(Coastmap)"))) {
233233
// initialize texture
234234
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
235235
glClear(GL_COLOR_BUFFER_BIT);
236236

237237
// fill with current heightmap/coastmap
238238
UnsyncedHeightMapUpdate(SRectangle(0, 0, mapDims.mapx, mapDims.mapy));
239239
UploadCoastline(true);
240-
UpdateCoastmap();
241-
} else
242-
shoreWaves = false;
240+
UpdateCoastmap(true);
243241

244-
if (shoreWaves)
245242
eventHandler.InsertEvent(this, "UnsyncedHeightMapUpdate");
243+
}
246244

247245
//coastFBO.Unbind(); // gets done below
248246
}
@@ -335,6 +333,7 @@ CBumpWater::CBumpWater()
335333
if (dynWavesFBO.CheckStatus("BUMPWATER(DynWaves)"))
336334
UpdateDynWaves(true); // initialize
337335
}
336+
338337
FBO::Unbind();
339338
}
340339

@@ -842,7 +841,7 @@ void CBumpWater::UploadCoastline(const bool forceFull)
842841
}
843842

844843

845-
void CBumpWater::UpdateCoastmap()
844+
void CBumpWater::UpdateCoastmap(const bool initialize)
846845
{
847846
coastFBO.Bind();
848847
glPushAttrib(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT);
@@ -935,7 +934,9 @@ void CBumpWater::UpdateCoastmap()
935934
blurShader->Disable();
936935
coastFBO.Detach(GL_COLOR_ATTACHMENT1);
937936
glPopAttrib();
938-
//coastFBO.Unbind();
937+
938+
// NB: not needed during init, but no reason to leave bound after ::Update
939+
coastFBO.Unbind();
939940

940941
// generate mipmaps
941942
//glActiveTexture(GL_TEXTURE0);
@@ -950,7 +951,7 @@ void CBumpWater::UpdateCoastmap()
950951
glDeleteTextures(1, &coastUpdateTexture);
951952
coastmapAtlasRects.clear();
952953

953-
//glViewport(globalRendering->viewPosX, 0, globalRendering->viewSizeX, globalRendering->viewSizeY);
954+
glViewport(globalRendering->viewPosX, 0, globalRendering->viewSizeX, globalRendering->viewSizeY);
954955
glActiveTexture(GL_TEXTURE0);
955956
}
956957

rts/Rendering/Env/BumpWater.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class CBumpWater : public IWater, public CEventClient
6767
CRectangleOptimizer heightmapUpdates;
6868

6969
void UploadCoastline(const bool forceFull = false);
70-
void UpdateCoastmap();
70+
void UpdateCoastmap(const bool initialize = false);
7171
void UpdateDynWaves(const bool initialize = false);
7272
void UnsyncedHeightMapUpdate(const SRectangle& rect);
7373

0 commit comments

Comments
 (0)