aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
index 991a351e6..98d1cea71 100644
--- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
@@ -11,6 +11,7 @@ import javax.media.opengl.GLContext;
import javax.media.opengl.GLException;
import javax.media.opengl.GLFBODrawable;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.util.PropertyAccess;
import com.jogamp.common.util.VersionUtil;
import com.jogamp.nativewindow.MutableGraphicsConfiguration;
@@ -104,7 +105,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
private final void setupFBO(final GL gl, final int idx, final int width, final int height, final int samples,
final boolean useAlpha, final int depthBits, final int stencilBits,
- final boolean useTexture, final boolean realUnbind) {
+ final boolean useTexture, final boolean setupViewportScissors, final boolean realUnbind) {
final FBObject fbo = new FBObject();
fbos[idx] = fbo;
@@ -155,6 +156,11 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
// Also remedy for Bug 1020, i.e. OSX/Nvidia's FBO needs to be cleared before blitting,
// otherwise first MSAA frame lacks antialiasing.
fbo.bind(gl);
+ if( setupViewportScissors ) {
+ // Surfaceless: Set initial viewport/scissors
+ gl.glViewport(0, 0, width, height);
+ gl.glScissor(0, 0, width, height);
+ }
if( useDepth ) {
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
} else {
@@ -171,7 +177,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
if( !initialized && !realize ) {
if( DEBUG ) {
System.err.println("GLFBODrawableImpl.initialize(): WARNING - Already unrealized!");
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return; // NOP, no exception for de-init twice or no init!
}
@@ -216,7 +222,9 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
for(int i=0; i<fbosN; i++) {
setupFBO(gl, i, width, height, samples, useAlpha,
- chosenFBOCaps.getDepthBits(), chosenFBOCaps.getStencilBits(), useTexture, fbosN-1==i);
+ chosenFBOCaps.getDepthBits(), chosenFBOCaps.getStencilBits(), useTexture,
+ 0==i && 0 == parent.getHandle() /* setupViewportScissors for surfaceless */,
+ fbosN-1==i /* unbind */);
}
fbos[0].formatToGLCapabilities(chosenFBOCaps);
chosenFBOCaps.setDoubleBuffered( chosenFBOCaps.getDoubleBuffered() || samples > 0 );
@@ -233,7 +241,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
if(DEBUG) {
System.err.println("GLFBODrawableImpl.initialize("+realize+"): "+this);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
@@ -270,7 +278,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
// resetQuirk fallback
fbos[idx].destroy(gl);
final boolean useTexture = 0 != ( FBOMODE_USE_TEXTURE & fboModeBits );
- setupFBO(gl, idx, width, height, samples, useAlpha, depthBits, stencilBits, useTexture, true);
+ setupFBO(gl, idx, width, height, samples, useAlpha, depthBits, stencilBits, useTexture, false, true);
}
private final void reset(final GL gl, int newSamples) throws GLException {
@@ -284,7 +292,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
final boolean ctxSwitch = null != curContext && curContext != ourContext;
if(DEBUG) {
System.err.println("GLFBODrawableImpl.reset(newSamples "+newSamples+"): BEGIN - ctxSwitch "+ctxSwitch+", "+this);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
Throwable tFBO = null;
Throwable tGL = null;