@@ -147,7 +147,7 @@ CBumpWater::CBumpWater()
147
147
148
148
// LOAD TEXTURES
149
149
foamTexture = LoadTexture (waterRendering->foamTexture );
150
- normalTexture = LoadTexture (waterRendering->normalTexture , anisotropy , &normalTextureX, &normalTextureY);
150
+ normalTexture = LoadTexture (waterRendering->normalTexture , anisotropy, &normalTextureX, &normalTextureY);
151
151
152
152
// caustic textures
153
153
if (waterRendering->causticTextures .empty ())
@@ -229,20 +229,18 @@ CBumpWater::CBumpWater()
229
229
coastFBO.Bind ();
230
230
coastFBO.AttachTexture (coastTexture, GL_TEXTURE_2D, GL_COLOR_ATTACHMENT0);
231
231
232
- if (coastFBO.CheckStatus (" BUMPWATER(Coastmap)" )) {
232
+ if ((shoreWaves = coastFBO.CheckStatus (" BUMPWATER(Coastmap)" ) )) {
233
233
// initialize texture
234
234
glClearColor (0 .0f , 0 .0f , 0 .0f , 0 .0f );
235
235
glClear (GL_COLOR_BUFFER_BIT);
236
236
237
237
// fill with current heightmap/coastmap
238
238
UnsyncedHeightMapUpdate (SRectangle (0 , 0 , mapDims.mapx , mapDims.mapy ));
239
239
UploadCoastline (true );
240
- UpdateCoastmap ();
241
- } else
242
- shoreWaves = false ;
240
+ UpdateCoastmap (true );
243
241
244
- if (shoreWaves)
245
242
eventHandler.InsertEvent (this , " UnsyncedHeightMapUpdate" );
243
+ }
246
244
247
245
// coastFBO.Unbind(); // gets done below
248
246
}
@@ -335,6 +333,7 @@ CBumpWater::CBumpWater()
335
333
if (dynWavesFBO.CheckStatus (" BUMPWATER(DynWaves)" ))
336
334
UpdateDynWaves (true ); // initialize
337
335
}
336
+
338
337
FBO::Unbind ();
339
338
}
340
339
@@ -842,7 +841,7 @@ void CBumpWater::UploadCoastline(const bool forceFull)
842
841
}
843
842
844
843
845
- void CBumpWater::UpdateCoastmap ()
844
+ void CBumpWater::UpdateCoastmap (const bool initialize )
846
845
{
847
846
coastFBO.Bind ();
848
847
glPushAttrib (GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT);
@@ -935,7 +934,9 @@ void CBumpWater::UpdateCoastmap()
935
934
blurShader->Disable ();
936
935
coastFBO.Detach (GL_COLOR_ATTACHMENT1);
937
936
glPopAttrib ();
938
- // coastFBO.Unbind();
937
+
938
+ // NB: not needed during init, but no reason to leave bound after ::Update
939
+ coastFBO.Unbind ();
939
940
940
941
// generate mipmaps
941
942
// glActiveTexture(GL_TEXTURE0);
@@ -950,7 +951,7 @@ void CBumpWater::UpdateCoastmap()
950
951
glDeleteTextures (1 , &coastUpdateTexture);
951
952
coastmapAtlasRects.clear ();
952
953
953
- // glViewport(globalRendering->viewPosX, 0, globalRendering->viewSizeX, globalRendering->viewSizeY);
954
+ glViewport (globalRendering->viewPosX , 0 , globalRendering->viewSizeX , globalRendering->viewSizeY );
954
955
glActiveTexture (GL_TEXTURE0);
955
956
}
956
957
0 commit comments