aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-07-28 19:05:37 +0200
committerSven Gothel <[email protected]>2014-07-28 19:05:37 +0200
commit9be28a33fa92cfa52bdf13ad5c21f8317f66c319 (patch)
treee5af0f5405139a47aaea3d89ac2bce3a1cd3e5a8
parent6361d12c0b03132c57d326750b7911b313f3664b (diff)
Bug 1016 - GLJPanel Offscreen FBO size may exceed GL MAX TEXTURE SIZE, only use an FBO TextureAttachment if required
We only require an FBO TextureAttachment if using GLSL vertical flip, otherwise we simply requires a color renderbuffer. Further, the 'FBO fboFlipped' in GLSL vertical flip mode also simply requires a color renderbuffer.
-rw-r--r--make/scripts/tests.sh9
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java25
2 files changed, 25 insertions, 9 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 38226dbec..5e4857ba1 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -221,10 +221,11 @@ function jrun() {
#D_ARGS="-Xprof"
#D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all"
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel"
+ #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel -Djogl.gljpanel.noglsl"
+ #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel -Djogl.debug.FBObject.MaxTextureSize=512"
+ #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel -Djogl.gljpanel.noglsl -Djogl.debug.FBObject.MaxTextureSize=512"
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel -Dnativewindow.awt.nohidpi"
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel -Djogl.debug.GLJPanel.Viewport"
- #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel -Djogl.gljpanel.noglsl"
- #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel -Djogl.gljpanel.noglsl -Djogl.gljpanel.awtverticalflip"
#D_ARGS="-Djogl.debug.GLJPanel -Djogl.debug.DebugGL"
#D_ARGS="-Djogl.gljpanel.noverticalflip"
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Animator"
@@ -394,7 +395,7 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestOlympicES1NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestRedSquareES1NEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $*
+testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.ManualHiDPIBufferedImage01AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
@@ -499,7 +500,7 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOffThreadSharedContextMix2DemosES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOnThreadSharedContext1DemoES2NEWT $*
-testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableFactoryNEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableFactoryNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOMix2DemosES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOMRTNEWT01 $*
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index 15f1418ad..3a1e45440 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -1530,6 +1530,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
if(DEBUG) {
System.err.println(getThreadName()+": OffscreenBackend: initialize() - frameCount "+frameCount);
}
+ GLException glException = null;
try {
final GLContext[] shareWith = { null };
if( helper.isSharedGLContextPending(shareWith) ) {
@@ -1550,6 +1551,17 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
} } );
}
+ //
+ // Pre context configuration
+ //
+ flipVertical = !GLJPanel.this.skipGLOrientationVerticalFlip && offscreenDrawable.isGLOriented();
+ offscreenIsFBO = offscreenDrawable.getRequestedGLCapabilities().isFBO();
+ final boolean useGLSLFlip_pre = flipVertical && offscreenIsFBO && offscreenCaps.getGLProfile().isGL2ES2() && USE_GLSL_TEXTURE_RASTERIZER;
+ if( offscreenIsFBO && !useGLSLFlip_pre ) {
+ // Texture attachment only required for GLSL vertical flip, hence simply use a color-renderbuffer attachment.
+ ((GLFBODrawable)offscreenDrawable).setFBOMode(GLFBODrawable.FBOMODE_USE_DEPTH);
+ }
+
offscreenContext = (GLContextImpl) offscreenDrawable.createContext(shareWith[0]);
offscreenContext.setContextCreationFlags(additionalCtxCreationFlags);
if( GLContext.CONTEXT_NOT_CURRENT < offscreenContext.makeCurrent() ) {
@@ -1557,16 +1569,14 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
helper.setAutoSwapBufferMode(false); // we handle swap-buffers, see handlesSwapBuffer()
final GL gl = offscreenContext.getGL();
- flipVertical = !GLJPanel.this.skipGLOrientationVerticalFlip && offscreenDrawable.isGLOriented();
final GLCapabilitiesImmutable chosenCaps = offscreenDrawable.getChosenGLCapabilities();
- offscreenIsFBO = chosenCaps.isFBO();
final boolean glslCompliant = !offscreenContext.hasRendererQuirk(GLRendererQuirks.GLSLNonCompliant);
- final boolean useGLSLFlip = flipVertical && offscreenIsFBO && gl.isGL2ES2() && USE_GLSL_TEXTURE_RASTERIZER && glslCompliant;
+ final boolean useGLSLFlip = useGLSLFlip_pre && gl.isGL2ES2() && glslCompliant;
if( DEBUG ) {
System.err.println(getThreadName()+": OffscreenBackend.initialize: useGLSLFlip "+useGLSLFlip+
" [flip "+flipVertical+", isFBO "+offscreenIsFBO+", isGL2ES2 "+gl.isGL2ES2()+
", noglsl "+!USE_GLSL_TEXTURE_RASTERIZER+", glslNonCompliant "+!glslCompliant+
- ", isGL2ES2 " + gl.isGL2ES2()+"]");
+ ", isGL2ES2 " + gl.isGL2ES2()+"\n "+offscreenDrawable+"]");
}
if( useGLSLFlip ) {
final GLFBODrawable fboDrawable = (GLFBODrawable) offscreenDrawable;
@@ -1574,7 +1584,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
try {
fboFlipped = new FBObject();
fboFlipped.reset(gl, fboDrawable.getSurfaceWidth(), fboDrawable.getSurfaceHeight(), 0, false);
- fboFlipped.attachTexture2D(gl, 0, chosenCaps.getAlphaBits()>0);
+ fboFlipped.attachColorbuffer(gl, 0, chosenCaps.getAlphaBits()>0);
// fboFlipped.attachRenderbuffer(gl, Attachment.Type.DEPTH, 24);
glslTextureRaster = new GLSLTextureRaster(fboDrawable.getTextureUnit(), true);
glslTextureRaster.init(gl.getGL2ES2());
@@ -1598,6 +1608,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
} else {
isInitialized = false;
}
+ } catch( final GLException gle ) {
+ glException = gle;
} finally {
if( !isInitialized ) {
if(null != offscreenContext) {
@@ -1609,6 +1621,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
offscreenDrawable = null;
}
}
+ if( null != glException ) {
+ throw new GLException("Handled GLException: "+glException.getMessage(), glException);
+ }
}
}