diff options
author | Julien Gouesse <[email protected]> | 2013-06-18 20:44:05 +0200 |
---|---|---|
committer | Julien Gouesse <[email protected]> | 2013-06-18 20:44:05 +0200 |
commit | 3931791d51704fb2f4cb867cc16c8ac2d4abe1bf (patch) | |
tree | f83152e99248a27f2f60c536bef1aff204d5ddf0 | |
parent | 94d76930a7ab3f1ad940763f1bc839953e688f38 (diff) |
Fixes offscreen support, forces the rebinding of the texture in this case
-rw-r--r-- | ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java index f17c18b..2d35f05 100644 --- a/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java +++ b/ardor3d-jogl/src/main/java/com/ardor3d/scene/state/jogl/JoglTextureStateUtil.java @@ -21,6 +21,7 @@ import javax.media.opengl.GL2ES1; import javax.media.opengl.GL2ES2; import javax.media.opengl.GL2GL3; import javax.media.opengl.GLContext; +import javax.media.opengl.GLDrawable; import javax.media.opengl.GLException; import javax.media.opengl.fixedfunc.GLMatrixFunc; import javax.media.opengl.glu.GLU; @@ -61,6 +62,7 @@ import com.ardor3d.util.TextureManager; import com.ardor3d.util.geom.BufferUtils; import com.ardor3d.util.stat.StatCollector; import com.ardor3d.util.stat.StatType; +import com.jogamp.newt.opengl.GLWindow; public class JoglTextureStateUtil { private static final Logger logger = Logger.getLogger(JoglTextureStateUtil.class.getName()); @@ -674,8 +676,12 @@ public class JoglTextureStateUtil { continue; } } else { + final GLDrawable drawable = GLContext.getCurrent().getGLDrawable(); + // forces the rebinding when the drawable is offscreen + final boolean onscreen = !(drawable instanceof GLWindow) + || ((GLWindow) drawable).getChosenCapabilities().isOnscreen(); // texture already exists in OpenGL, just bind it if needed - if (!unitRecord.isValid() || unitRecord.boundTexture != textureId) { + if (!unitRecord.isValid() || unitRecord.boundTexture != textureId || !onscreen) { checkAndSetUnit(i, record, caps); gl.glBindTexture(getGLType(type), textureId); if (Constants.stats) { |