diff --git a/swing/src/net/sf/openrocket/gui/figure3d/photo/sky/SkyBoxCross.java b/swing/src/net/sf/openrocket/gui/figure3d/photo/sky/SkyBoxCross.java index 31f912077..5a6488928 100644 --- a/swing/src/net/sf/openrocket/gui/figure3d/photo/sky/SkyBoxCross.java +++ b/swing/src/net/sf/openrocket/gui/figure3d/photo/sky/SkyBoxCross.java @@ -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); }