Merge pull request #978 from SiboVG/issue-977

[fixes #977] Fix Storm sky image going blank
This commit is contained in:
Billy Olsen 2021-07-11 19:25:46 -07:00 committed by GitHub
commit 0dfd5d52c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,7 @@ import com.jogamp.opengl.util.texture.awt.AWTTextureIO;
public class SkyBoxCross extends Sky {
private final URL imageURL;
private GL2 previousGL = null; // GL that the textures were previously bound to
Texture north, east, south, west, up, down;
public SkyBoxCross(final URL imageURL) {
@ -40,6 +41,7 @@ public class SkyBoxCross extends Sky {
south = AWTTextureIO.newTexture(GLProfile.getDefault(), fixBug(i.getSubimage(dx * 3, dy, dx, dy)), true);
up = AWTTextureIO.newTexture(GLProfile.getDefault(), fixBug(i.getSubimage(dx, 0, dx, dy)), true);
down = AWTTextureIO.newTexture(GLProfile.getDefault(), fixBug(i.getSubimage(dx, 2 * dy, dx, dy)), true);
previousGL = gl;
} catch (IOException e) {
throw new Error(e);
}
@ -47,7 +49,7 @@ public class SkyBoxCross extends Sky {
@Override
public void draw(GL2 gl, final TextureCache cache) {
if (north == null) {
if (north == null || gl != previousGL) {
loadTextures(gl);
}