aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/javax/media/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/javax/media/opengl')
-rw-r--r--src/jogl/classes/javax/media/opengl/GLCapabilities.java55
-rw-r--r--src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java27
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java10
-rw-r--r--src/jogl/classes/javax/media/opengl/GLDrawable.java14
-rw-r--r--src/jogl/classes/javax/media/opengl/GLDrawableFactory.java9
-rw-r--r--src/jogl/classes/javax/media/opengl/GLPbuffer.java34
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java6
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java40
8 files changed, 37 insertions, 158 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilities.java b/src/jogl/classes/javax/media/opengl/GLCapabilities.java
index 09db70f64..5b3eb9119 100644
--- a/src/jogl/classes/javax/media/opengl/GLCapabilities.java
+++ b/src/jogl/classes/javax/media/opengl/GLCapabilities.java
@@ -75,11 +75,6 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
private boolean sampleBuffers = false;
private int numSamples = 2;
- // Bits for pbuffer creation
- private boolean pbufferFloatingPointBuffers;
- private boolean pbufferRenderToTexture;
- private boolean pbufferRenderToTextureRectangle;
-
/** Creates a GLCapabilities object. All attributes are in a default state.
* @param glp GLProfile, or null for the default GLProfile
* @throws GLException if no profile is given and no default profile is available for the default device.
@@ -122,9 +117,6 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
accumBlueBits = source.getAccumBlueBits();
accumAlphaBits = source.getAccumAlphaBits();
sampleBuffers = source.getSampleBuffers();
- pbufferFloatingPointBuffers = source.getPbufferFloatingPointBuffers();
- pbufferRenderToTexture = source.getPbufferRenderToTexture();
- pbufferRenderToTextureRectangle = source.getPbufferRenderToTextureRectangle();
numSamples = source.getNumSamples();
sampleExtension = source.getSampleExtension();
return this;
@@ -148,9 +140,6 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
hash = ((hash << 5) - hash) + this.accumGreenBits;
hash = ((hash << 5) - hash) + this.accumBlueBits;
hash = ((hash << 5) - hash) + this.accumAlphaBits;
- hash = ((hash << 5) - hash) + ( this.pbufferFloatingPointBuffers ? 1 : 0 );
- hash = ((hash << 5) - hash) + ( this.pbufferRenderToTexture ? 1 : 0 );
- hash = ((hash << 5) - hash) + ( this.pbufferRenderToTextureRectangle ? 1 : 0 );
return hash;
}
@@ -174,10 +163,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
other.getAccumGreenBits()==accumGreenBits &&
other.getAccumBlueBits()==accumBlueBits &&
other.getAccumAlphaBits()==accumAlphaBits &&
- other.getSampleBuffers()==sampleBuffers &&
- other.getPbufferFloatingPointBuffers()==pbufferFloatingPointBuffers &&
- other.getPbufferRenderToTexture()==pbufferRenderToTexture &&
- other.getPbufferRenderToTextureRectangle()==pbufferRenderToTextureRectangle;
+ other.getSampleBuffers()==sampleBuffers;
if(res && sampleBuffers) {
res = other.getNumSamples()==getNumSamples() &&
other.getSampleExtension().equals(sampleExtension) ;
@@ -449,40 +435,6 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
return sampleBuffers ? numSamples : 0;
}
- /** For pbuffers only, indicates whether floating-point buffers
- should be used if available. Defaults to false. */
- public void setPbufferFloatingPointBuffers(boolean enable) {
- pbufferFloatingPointBuffers = enable;
- }
-
- @Override
- public final boolean getPbufferFloatingPointBuffers() {
- return pbufferFloatingPointBuffers;
- }
-
- /** For pbuffers only, indicates whether the render-to-texture
- extension should be used if available. Defaults to false. */
- public void setPbufferRenderToTexture(boolean enable) {
- pbufferRenderToTexture = enable;
- }
-
- @Override
- public final boolean getPbufferRenderToTexture() {
- return pbufferRenderToTexture;
- }
-
- /** For pbuffers only, indicates whether the
- render-to-texture-rectangle extension should be used if
- available. Defaults to false. */
- public void setPbufferRenderToTextureRectangle(boolean enable) {
- pbufferRenderToTextureRectangle = enable;
- }
-
- @Override
- public final boolean getPbufferRenderToTextureRectangle() {
- return pbufferRenderToTextureRectangle;
- }
-
@Override
public StringBuilder toString(StringBuilder sink) {
if(null == sink) {
@@ -526,10 +478,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
}
if(isPBuffer()) {
if(ns) { sink.append(CSEP); }
- sink.append("pbuffer [r2t ").append(pbufferRenderToTexture?1:0)
- .append(", r2tr ").append(pbufferRenderToTextureRectangle?1:0)
- .append(", float ").append(pbufferFloatingPointBuffers?1:0)
- .append("]");
+ sink.append("pbuffer");
ns = true;
}
if(isBitmap()) {
diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java b/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java
index ee261ca01..6af35021f 100644
--- a/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java
+++ b/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java
@@ -130,33 +130,6 @@ public interface GLCapabilitiesImmutable extends CapabilitiesImmutable {
int getNumSamples();
/**
- * For pbuffers only, returns whether floating-point buffers should
- * be used if available.
- * <p>
- * Default is false.
- * </p>
- */
- boolean getPbufferFloatingPointBuffers();
-
- /**
- * For pbuffers only, returns whether the render-to-texture
- * extension should be used if available.
- * <p>
- * Default is false.
- * </p>
- */
- boolean getPbufferRenderToTexture();
-
- /**
- * For pbuffers only, returns whether the render-to-texture
- * extension should be used.
- * <p>
- * Default is false.
- * </p>
- */
- boolean getPbufferRenderToTextureRectangle();
-
- /**
* Returns the number of stencil buffer bits.
* <p>
* Default is 0.
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index 23ca96504..d26076344 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -1026,16 +1026,6 @@ public abstract class GLContext {
*/
public abstract int getDefaultReadBuffer();
- /** On some platforms the mismatch between OpenGL's coordinate
- system (origin at bottom left) and the window system's
- coordinate system (origin at top left) necessitates a vertical
- flip of pixels read from offscreen contexts.
- <p>
- Default impl. is <code>true</code>.
- </p>
- */
- public abstract boolean isGLOrientationFlippedVertical();
-
/** Get the default pixel data type, as required by e.g. {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer)}. */
public abstract int getDefaultPixelDataType();
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawable.java b/src/jogl/classes/javax/media/opengl/GLDrawable.java
index 65c8b2ea5..369ea6d2b 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawable.java
@@ -145,6 +145,20 @@ public interface GLDrawable {
/** Returns the current height of this GLDrawable. */
public int getHeight();
+ /**
+ * Returns <code>true</code> if the drawable is rendered in
+ * OpenGL's coordinate system, <i>origin at bottom left</i>.
+ * Otherwise returns <code>false</code>, i.e. <i>origin at top left</i>.
+ * <p>
+ * Default impl. is <code>true</code>, i.e. OpenGL coordinate system.
+ * </p>
+ * <p>
+ * Currently only MS-Windows bitmap offscreen drawable uses a non OpenGL orientation and hence returns <code>false</code>.<br/>
+ * This removes the need of a vertical flip when used in AWT or Windows applications.
+ * </p>
+ */
+ public boolean isGLOriented();
+
/** Swaps the front and back buffers of this drawable. For {@link
GLAutoDrawable} implementations, when automatic buffer swapping
is enabled (as is the default), this method is called
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index e775afbff..9feb54a46 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -114,9 +114,6 @@ public abstract class GLDrawableFactory {
*/
protected static final boolean disableOpenGLES = Debug.isPropertyDefined("jogl.disable.opengles", true);
- static final String macosxFactoryClassNameCGL = "jogamp.opengl.macosx.cgl.MacOSXCGLDrawableFactory";
- static final String macosxFactoryClassNameAWTCGL = "jogamp.opengl.macosx.cgl.awt.MacOSXAWTCGLDrawableFactory";
-
private static volatile boolean isInit = false;
private static GLDrawableFactory eglFactory;
private static GLDrawableFactory nativeOSFactory;
@@ -154,11 +151,7 @@ public abstract class GLDrawableFactory {
} else if ( nwt == NativeWindowFactory.TYPE_WINDOWS ) {
factoryClassName = "jogamp.opengl.windows.wgl.WindowsWGLDrawableFactory";
} else if ( nwt == NativeWindowFactory.TYPE_MACOSX ) {
- if(ReflectionUtil.isClassAvailable(macosxFactoryClassNameAWTCGL, cl)) {
- factoryClassName = macosxFactoryClassNameAWTCGL;
- } else {
- factoryClassName = macosxFactoryClassNameCGL;
- }
+ factoryClassName = "jogamp.opengl.macosx.cgl.MacOSXCGLDrawableFactory";
} else {
// may use egl*Factory ..
if (DEBUG || GLProfile.DEBUG) {
diff --git a/src/jogl/classes/javax/media/opengl/GLPbuffer.java b/src/jogl/classes/javax/media/opengl/GLPbuffer.java
index de7731a3b..12f57fcd8 100644
--- a/src/jogl/classes/javax/media/opengl/GLPbuffer.java
+++ b/src/jogl/classes/javax/media/opengl/GLPbuffer.java
@@ -50,32 +50,7 @@ package javax.media.opengl;
@deprecated Use {@link GLOffscreenAutoDrawable} w/ {@link GLCapabilities#setFBO(boolean)}
via {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int, GLContext) GLDrawableFactory.createOffscreenAutoDrawable(..)}.
*/
-
public interface GLPbuffer extends GLAutoDrawable {
- /** Indicates the GL_APPLE_float_pixels extension is being used for this pbuffer. */
- public static final int APPLE_FLOAT = 1;
-
- /** Indicates the GL_ATI_texture_float extension is being used for this pbuffer. */
- public static final int ATI_FLOAT = 2;
-
- /** Indicates the GL_NV_float_buffer extension is being used for this pbuffer. */
- public static final int NV_FLOAT = 3;
-
- /** Binds this pbuffer to its internal texture target. Only valid to
- call if offscreen render-to-texture has been specified in the
- NWCapabilities for this GLPbuffer. If the
- render-to-texture-rectangle capability has also been specified,
- this will use e.g. wglBindTexImageARB as its implementation and
- cause the texture to be bound to e.g. the
- GL_TEXTURE_RECTANGLE_NV state; otherwise, during the display()
- phase the pixels will have been copied into an internal texture
- target and this will cause that to be bound to the GL_TEXTURE_2D
- state. */
- public void bindTexture();
-
- /** Unbinds the pbuffer from its internal texture target. */
- public void releaseTexture();
-
/** Destroys the native resources associated with this pbuffer. It
is not valid to call display() or any other routines on this
pbuffer after it has been destroyed. Before destroying the
@@ -84,13 +59,4 @@ public interface GLPbuffer extends GLAutoDrawable {
#createContext}. */
@Override
public void destroy();
-
- /** Indicates which vendor's extension is being used to support
- floating point channels in this pbuffer if that capability was
- requested in the NWCapabilities during pbuffer creation. Returns
- one of NV_FLOAT, ATI_FLOAT or APPLE_FLOAT, or throws GLException
- if floating-point channels were not requested for this pbuffer.
- This function may only be called once the init method for this
- pbuffer's GLEventListener has been called. */
- public int getFloatingPointMode();
}
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index c1d5fb1d2..b7a24a777 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -887,6 +887,12 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
@Override
+ public boolean isGLOriented() {
+ final GLDrawable _drawable = drawable;
+ return null != _drawable ? _drawable.isGLOriented() : true;
+ }
+
+ @Override
public NativeSurface getNativeSurface() {
final GLDrawable _drawable = drawable;
return (null != _drawable) ? _drawable.getNativeSurface() : null;
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index e82ad54c3..6ef695319 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -83,17 +83,12 @@ import jogamp.opengl.GLDrawableFactoryImpl;
import jogamp.opengl.GLDrawableHelper;
import jogamp.opengl.GLDrawableImpl;
import jogamp.opengl.awt.Java2D;
-import jogamp.opengl.awt.Java2DGLContext;
import jogamp.opengl.util.glsl.GLSLTextureRaster;
import com.jogamp.nativewindow.awt.AWTWindowClosingProtocol;
import com.jogamp.opengl.FBObject;
import com.jogamp.opengl.util.GLPixelStorageModes;
-// FIXME: Subclasses need to call resetGLFunctionAvailability() on their
-// context whenever the displayChanged() function is called on their
-// GLEventListeners
-
/** A lightweight Swing component which provides OpenGL rendering
support. Provided for compatibility with Swing user interfaces
when adding a heavyweight doesn't work either because of
@@ -627,6 +622,14 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
@Override
+ public boolean isGLOriented() {
+ if(null != backend) {
+ return backend.getDrawable().isGLOriented();
+ }
+ return true;
+ }
+
+ @Override
public GLCapabilitiesImmutable getChosenGLCapabilities() {
return backend.getChosenGLCapabilities();
}
@@ -916,7 +919,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
private final int fboTextureUnit = 0;
private GLContextImpl offscreenContext;
- private boolean flippedVertical;
+ private boolean flipVertical;
// For saving/restoring of OpenGL state during ReadPixels
private final GLPixelStorageModes psm = new GLPixelStorageModes();
@@ -941,9 +944,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
if( GLContext.CONTEXT_NOT_CURRENT < offscreenContext.makeCurrent() ) {
isInitialized = true;
final GL gl = offscreenContext.getGL();
- flippedVertical = offscreenContext.isGLOrientationFlippedVertical();
+ flipVertical = offscreenDrawable.isGLOriented();
final GLCapabilitiesImmutable chosenCaps = offscreenDrawable.getChosenGLCapabilities();
- if( USE_GLSL_TEXTURE_RASTERIZER && chosenCaps.isFBO() && flippedVertical && gl.isGL2ES2() ) {
+ if( USE_GLSL_TEXTURE_RASTERIZER && chosenCaps.isFBO() && flipVertical && gl.isGL2ES2() ) {
final boolean _autoSwapBufferMode = helper.getAutoSwapBufferMode();
helper.setAutoSwapBufferMode(false);
final GLFBODrawable fboDrawable = (GLFBODrawable) offscreenDrawable;
@@ -1054,14 +1057,14 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
glType = GL.GL_UNSIGNED_BYTE; // offscreenContext.getDefaultPixelDataType();
offscreenImage = new BufferedImage(panelWidth, panelHeight, withAlpha ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB);
- if(!flippedVertical || null != glslTextureRaster) {
+ if(!flipVertical || null != glslTextureRaster) {
final int[] readBackIntBuffer = ((DataBufferInt) offscreenImage.getRaster().getDataBuffer()).getData();
readBackInts = IntBuffer.wrap(readBackIntBuffer);
} else {
readBackInts = IntBuffer.allocate(readBackWidthInPixels * readBackHeightInPixels);
}
if(DEBUG) {
- System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: flippedVertical "+flippedVertical+", glslTextureRaster "+(null!=glslTextureRaster));
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: flippedVertical "+flipVertical+", glslTextureRaster "+(null!=glslTextureRaster));
System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: panelSize "+panelWidth+"x"+panelHeight +", readBackSizeInPixels "+readBackWidthInPixels+"x"+readBackHeightInPixels);
System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: offscreenImage "+offscreenImage.getWidth()+"x"+offscreenImage.getHeight());
}
@@ -1101,7 +1104,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
} else {
gl.glReadPixels(0, 0, readBackWidthInPixels, readBackHeightInPixels, glFormat, glType, readBackInts);
- if ( flippedVertical ) {
+ if ( flipVertical ) {
// Copy temporary data into raster of BufferedImage for faster
// blitting Note that we could avoid this copy in the cases
// where !offscreenContext.offscreenImageNeedsVerticalFlip(),
@@ -1641,28 +1644,13 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
System.err.println("-- Created External Drawable: "+joglDrawable);
System.err.println("-- Created Context: "+joglContext);
}
- } else if (factory.canCreateContextOnJava2DSurface(device)) {
- // Mac OS X code path
- joglContext = factory.createContextOnJava2DSurface(g, j2dContext);
- if (DEBUG) {
- System.err.println("-- Created Context: "+joglContext);
- }
}
- /*if (DEBUG) {
- joglContext.setGL(new DebugGL2(joglContext.getGL().getGL2()));
- }*/
-
if (Java2D.isFBOEnabled() &&
Java2D.getOGLSurfaceType(g) == Java2D.FBOBJECT &&
fbObjectWorkarounds) {
createNewDepthBuffer = true;
}
}
- if (joglContext instanceof Java2DGLContext) {
- // Mac OS X code path
- ((Java2DGLContext) joglContext).setGraphics(g);
- }
-
helper.invokeGL(joglDrawable, joglContext, updaterDisplayAction, updaterInitAction);
}
} finally {