aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java4
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java43
-rw-r--r--src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java2
4 files changed, 28 insertions, 23 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
index 422714ac5..fbd40ebdd 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
@@ -459,7 +459,7 @@ public class VBORegion2PMSAAES2 extends GLRegion {
fbo.attachColorbuffer(gl, 0, true);
if( !blendingEnabled ) {
// no depth-buffer w/ blending
- fbo.attachRenderbuffer(gl, Attachment.Type.DEPTH, 24);
+ fbo.attachRenderbuffer(gl, Attachment.Type.DEPTH, FBObject.DEFAULT_BITS);
}
final FBObject ssink = new FBObject();
{
@@ -469,7 +469,7 @@ public class VBORegion2PMSAAES2 extends GLRegion {
ssink.attachTexture2D(gl, 0, true, GL.GL_NEAREST, GL.GL_NEAREST, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE);
if( !blendingEnabled ) {
// no depth-buffer w/ blending
- ssink.attachRenderbuffer(gl, Attachment.Type.DEPTH, 24);
+ ssink.attachRenderbuffer(gl, Attachment.Type.DEPTH, FBObject.DEFAULT_BITS);
}
}
fbo.setSamplingSink(ssink);
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
index 5251ade39..8f1de9157 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
@@ -580,7 +580,7 @@ public class VBORegion2PVBAAES2 extends GLRegion {
texA = fbo.attachTexture2D(gl, 0, true, GL.GL_NEAREST, GL.GL_NEAREST, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE);
if( !blendingEnabled ) {
// no depth-buffer w/ blending
- fbo.attachRenderbuffer(gl, Attachment.Type.DEPTH, 24);
+ fbo.attachRenderbuffer(gl, Attachment.Type.DEPTH, FBObject.DEFAULT_BITS);
}
if( DEBUG_FBO_1 ) {
System.err.printf("XXX.createFBO: %dx%d%n%s%n", fboWidth, fboHeight, fbo.toString());
diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
index 1bdc99a9b..fdd5aa5e9 100644
--- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
@@ -91,7 +91,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
final GLCapabilitiesImmutable fboCaps, final int textureUnit) {
super(factory, surface, fboCaps, false);
this.initialized = false;
- this.fboModeBits = FBOMODE_USE_TEXTURE | FBOMODE_USE_DEPTH;
+ this.fboModeBits = FBOMODE_USE_TEXTURE;
this.parent = parent;
this.origParentChosenCaps = getChosenGLCapabilities(); // just to avoid null, will be reset at initialize(..)
@@ -102,11 +102,14 @@ 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 boolean useStencil, final boolean useDepth, final boolean useTexture,
- final boolean realUnbind) {
+ final boolean useAlpha, final int depthBits, final int stencilBits,
+ final boolean useTexture, final boolean realUnbind) {
final FBObject fbo = new FBObject();
fbos[idx] = fbo;
+ final boolean useDepth = depthBits > 0 || 0 != ( FBOMODE_USE_DEPTH & fboModeBits );
+ final boolean useStencil = stencilBits > 0;
+
fbo.init(gl, width, height, samples);
if(fbo.getNumSamples() != samples) {
throw new InternalError("Sample number mismatch: "+samples+", fbos["+idx+"] "+fbo);
@@ -118,12 +121,12 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
}
if( useStencil ) {
if( useDepth ) {
- fbo.attachRenderbuffer(gl, Attachment.Type.DEPTH_STENCIL, 24);
+ fbo.attachRenderbuffer(gl, Attachment.Type.DEPTH_STENCIL, depthBits);
} else {
- fbo.attachRenderbuffer(gl, Attachment.Type.STENCIL, 24);
+ fbo.attachRenderbuffer(gl, Attachment.Type.STENCIL, stencilBits);
}
} else if( useDepth ) {
- fbo.attachRenderbuffer(gl, Attachment.Type.DEPTH, 24);
+ fbo.attachRenderbuffer(gl, Attachment.Type.DEPTH, depthBits);
}
if(samples > 0) {
final FBObject ssink = new FBObject();
@@ -136,12 +139,12 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
}
if( useStencil ) {
if( useDepth ) {
- ssink.attachRenderbuffer(gl, Attachment.Type.DEPTH_STENCIL, 24);
+ ssink.attachRenderbuffer(gl, Attachment.Type.DEPTH_STENCIL, depthBits);
} else {
- ssink.attachRenderbuffer(gl, Attachment.Type.STENCIL, 24);
+ ssink.attachRenderbuffer(gl, Attachment.Type.STENCIL, stencilBits);
}
} else if( useDepth ) {
- ssink.attachRenderbuffer(gl, Attachment.Type.DEPTH, 24);
+ ssink.attachRenderbuffer(gl, Attachment.Type.DEPTH, depthBits);
}
}
fbo.setSamplingSink(ssink);
@@ -206,14 +209,13 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
}
final boolean useTexture = 0 != ( FBOMODE_USE_TEXTURE & fboModeBits );
- final boolean useDepth = 0 != ( FBOMODE_USE_DEPTH & fboModeBits );
- final boolean useStencil = chosenFBOCaps.getStencilBits() > 0;
final boolean useAlpha = chosenFBOCaps.getAlphaBits() > 0;
final int width = getSurfaceWidth();
final int height = getSurfaceHeight();
for(int i=0; i<fbosN; i++) {
- setupFBO(gl, i, width, height, samples, useAlpha, useStencil, useDepth, useTexture, fbosN-1==i);
+ setupFBO(gl, i, width, height, samples, useAlpha,
+ chosenFBOCaps.getDepthBits(), chosenFBOCaps.getStencilBits(), useTexture, fbosN-1==i);
}
fbos[0].formatToGLCapabilities(chosenFBOCaps);
chosenFBOCaps.setDoubleBuffered( chosenFBOCaps.getDoubleBuffered() || samples > 0 );
@@ -239,8 +241,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
}
private final void reset(final GL gl, final int idx, final int width, final int height, final int samples,
- final boolean useAlpha, final boolean useStencil) {
- final boolean useDepth = 0 != ( FBOMODE_USE_DEPTH & fboModeBits );
+ final boolean useAlpha, final int depthBits, final int stencilBits) {
if( !fboResetQuirk ) {
try {
fbos[idx].reset(gl, width, height, samples);
@@ -268,7 +269,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, useStencil, useDepth, useTexture, true);
+ setupFBO(gl, idx, width, height, samples, useAlpha, depthBits, stencilBits, useTexture, true);
}
private final void reset(final GL gl, int newSamples) throws GLException {
@@ -313,7 +314,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) surface.getGraphicsConfiguration().getChosenCapabilities();
for(int i=0; i<fbos.length; i++) {
if( pendingFBOReset != i ) {
- reset(gl, i, nWidth, nHeight, samples, caps.getAlphaBits()>0, caps.getStencilBits()>0);
+ reset(gl, i, nWidth, nHeight, samples, caps.getAlphaBits()>0, caps.getDepthBits(), caps.getStencilBits());
}
}
final GLCapabilities fboCapsNative = (GLCapabilities) surface.getGraphicsConfiguration().getChosenCapabilities();
@@ -440,7 +441,8 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
// Safely reset the previous front FBO - after completing propagating swap
if(0 <= pendingFBOReset) {
final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) surface.getGraphicsConfiguration().getChosenCapabilities();
- reset(glc.getGL(), pendingFBOReset, getSurfaceWidth(), getSurfaceHeight(), samples, caps.getAlphaBits()>0, caps.getStencilBits()>0);
+ reset(glc.getGL(), pendingFBOReset, getSurfaceWidth(), getSurfaceHeight(), samples,
+ caps.getAlphaBits()>0, caps.getDepthBits(), caps.getStencilBits());
pendingFBOReset = -1;
}
}
@@ -523,9 +525,12 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
}
@Override
- public final int setNumBuffers(final int bufferCount) throws GLException {
+ public final int setNumBuffers(final int bufferCount) throws /* IllegalStateException, */ GLException {
+ if( isInitialized() ) {
+ throw new IllegalStateException("Already initialized: "+this);
+ }
// FIXME: Implement
- return bufferCount;
+ return GLFBODrawableImpl.bufferCount;
}
@Override
diff --git a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java
index 60cc9f0fd..721dc7384 100644
--- a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java
@@ -102,7 +102,7 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen
}
@Override
- public final int setNumBuffers(final int bufferCount) throws GLException {
+ public final int setNumBuffers(final int bufferCount) throws /* IllegalStateException, */ GLException {
return ((GLFBODrawableImpl)drawable).setNumBuffers(bufferCount);
}