summaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-07-10 01:11:00 +0200
committerSven Gothel <[email protected]>2014-07-10 01:11:00 +0200
commitec2d94ca26ddab8ec67135ebc5f2d0a43f6a4c25 (patch)
treee405f17400b8d52ffe38347d226ca9927ac4f3ec /src/jogl
parentefa5f1110725d41b7ea58010fe34b2a8aacd185b (diff)
Bug 1031: Remove Deprecated Classes and Methods (JOGL)
Removed Deprecated Class: - com/jogamp/opengl/util/TGAWriter.java - Use TextureIO w/ .tga suffix - com/jogamp/opengl/util/awt/Screenshot.java - Use: - com.jogamp.opengl.util.GLReadBufferUtil, or - com.jogamp.opengl.util.awt.AWTGLReadBufferUtil The latter for reading into AWT BufferedImage See: TestBug461FBOSupersamplingSwingAWT, TestBug605FlippedImageAWT - javax/media/opengl/GLPbuffer.java - Use: caps.setPBuffer(true); final GLAutoDrawable pbuffer = GLDrawableFactory.getFactory( caps.getGLProfile() ).createOffscreenAutoDrawable(null, caps, null, 512, 512); - See: TestPBufferDeadlockAWT, .. Removed Deprecated Methods: - Constructor of AWT-GLCanvas, SWT-GLCanvas, AWT-GLJPanel with argument 'final GLContext shareWith' See GLSharedContextSetter, i.e. glCanvas.setSharedContext(..) ! - GLDrawableFactory.createOffscreenAutoDrawable(..) with argument 'final GLContext shareWith' See GLSharedContextSetter, i.e. offscreenAutoDrawable.setSharedContext(..) ! - GLDrawableFactory.createGLPbuffer(..), see above! - com.jogamp.opengl.util.av.AudioSink 'enqueueData(AudioDataFrame audioDataFrame)', use 'enqueueData(int, ByteBuffer, int)' - GLSharedContextSetter.areAllGLEventListenerInitialized(), migrated to GLAutoDrawable ! - GLBase's - glGetBoundBuffer(int), use getBoundBuffer(int) - glGetBufferSize(int), use getBufferStorage(int).getSize() - glIsVBOArrayBound(), use isVBOArrayBound() - glIsVBOElementArrayBound(), use isVBOElementArrayBound() - NEWT MouseEvent.BUTTON_NUMBER, use BUTTON_COUNT
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java70
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java116
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java14
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java3
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java414
-rw-r--r--src/jogl/classes/javax/media/opengl/GLAutoDrawable.java5
-rw-r--r--src/jogl/classes/javax/media/opengl/GLBase.java16
-rw-r--r--src/jogl/classes/javax/media/opengl/GLDrawableFactory.java106
-rw-r--r--src/jogl/classes/javax/media/opengl/GLPbuffer.java62
-rw-r--r--src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java6
-rw-r--r--src/jogl/classes/javax/media/opengl/Threading.java4
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java77
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java41
-rw-r--r--src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java7
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java48
-rw-r--r--src/jogl/classes/jogamp/opengl/GLPbufferImpl.java105
-rw-r--r--src/jogl/classes/jogamp/opengl/MemoryObject.java103
-rw-r--r--src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java5
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java22
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java5
21 files changed, 74 insertions, 1167 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
index c94d21369..e58d8c64a 100644
--- a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
+++ b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
@@ -297,40 +297,6 @@ public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextS
}
/**
- * Creates an instance using {@link #GLCanvas(Composite, int, GLCapabilitiesImmutable, GLCapabilitiesChooser, GLContext)}
- * on the SWT thread.
- *
- * @param parent
- * Required (non-null) parent Composite.
- * @param style
- * Optional SWT style bit-field. The {@link SWT#NO_BACKGROUND} bit is set before passing this up to the
- * Canvas constructor, so OpenGL handles the background.
- * @param caps
- * Optional GLCapabilities. If not provided, the default capabilities for the default GLProfile for the
- * graphics device determined by the parent Composite are used. Note that the GLCapabilities that are
- * actually used may differ based on the capabilities of the graphics device.
- * @param chooser
- * Optional GLCapabilitiesChooser to customize the selection of the used GLCapabilities based on the
- * requested GLCapabilities, and the available capabilities of the graphics device.
- * @param shareWith
- * Optional GLContext to share state (textures, vbos, shaders, etc.) with.
- * @return a new instance
- * @deprecated Use {@link #create(Composite, int, GLCapabilitiesImmutable, GLCapabilitiesChooser)}
- * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}.
- */
- public static GLCanvas create(final Composite parent, final int style, final GLCapabilitiesImmutable caps,
- final GLCapabilitiesChooser chooser, final GLContext shareWith) {
- final GLCanvas[] res = new GLCanvas[] { null };
- parent.getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- res[0] = new GLCanvas( parent, style, caps, chooser, shareWith );
- }
- });
- return res[0];
- }
-
- /**
* Creates a new SWT GLCanvas.
*
* @param parent
@@ -348,31 +314,6 @@ public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextS
*/
public GLCanvas(final Composite parent, final int style, final GLCapabilitiesImmutable capsReqUser,
final GLCapabilitiesChooser capsChooser) {
- this(parent, style, capsReqUser, capsChooser, null);
- }
-
- /**
- * Creates a new SWT GLCanvas.
- *
- * @param parent
- * Required (non-null) parent Composite.
- * @param style
- * Optional SWT style bit-field. The {@link SWT#NO_BACKGROUND} bit is set before passing this up to the
- * Canvas constructor, so OpenGL handles the background.
- * @param capsReqUser
- * Optional GLCapabilities. If not provided, the default capabilities for the default GLProfile for the
- * graphics device determined by the parent Composite are used. Note that the GLCapabilities that are
- * actually used may differ based on the capabilities of the graphics device.
- * @param capsChooser
- * Optional GLCapabilitiesChooser to customize the selection of the used GLCapabilities based on the
- * requested GLCapabilities, and the available capabilities of the graphics device.
- * @param shareWith
- * Optional GLContext to share state (textures, vbos, shaders, etc.) with.
- * @deprecated Use {@link #GLCanvas(Composite, int, GLCapabilitiesImmutable, GLCapabilitiesChooser)}
- * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}.
- */
- public GLCanvas(final Composite parent, final int style, GLCapabilitiesImmutable capsReqUser,
- final GLCapabilitiesChooser capsChooser, final GLContext shareWith) {
/* NO_BACKGROUND required to avoid clearing bg in native SWT widget (we do this in the GL display) */
super(parent, style | SWT.NO_BACKGROUND);
@@ -399,16 +340,13 @@ public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextS
screen = SWTAccessor.getScreen(swtDevice, -1 /* default */);
}
- /* Select default GLCapabilities if none was provided, otherwise clone provided caps to ensure safety */
+ /* Select default GLCapabilities if none was provided, otherwise use cloned provided caps */
if(null == capsReqUser) {
- capsReqUser = new GLCapabilities(GLProfile.getDefault(screen.getDevice()));
+ this.capsRequested = new GLCapabilities(GLProfile.getDefault(screen.getDevice()));
+ } else {
+ this.capsRequested = (GLCapabilitiesImmutable) capsReqUser.cloneMutable();
}
-
- this.capsRequested = capsReqUser;
this.capsChooser = capsChooser;
- if( null != shareWith ) {
- helper.setSharedContext(null, shareWith);
- }
// post create .. when ready
gdkWindow = 0;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java b/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java
deleted file mode 100644
index 6e31c78a0..000000000
--- a/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistribution of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistribution in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- */
-
-package com.jogamp.opengl.util;
-
-import java.io.*;
-import java.nio.*;
-import java.nio.channels.*;
-
-/**
- * Utility class which helps take fast screenshots of OpenGL rendering
- * results into Targa-format files. Used by the {@link com.jogamp.opengl.util.awt.Screenshot}
- * class; can also be used in conjunction with the {@link com.jogamp.opengl.util.gl2.TileRenderer} class.
- */
-public class TGAWriter {
-
- private static final int TARGA_HEADER_SIZE = 18;
-
- private FileChannel ch;
- private ByteBuffer buf;
-
- /** Constructor for the TGAWriter. */
- public TGAWriter() {
- }
-
- /**
- * Opens the specified Targa file for writing, overwriting any
- * existing file, and sets up the header of the file expecting the
- * data to be filled in before closing it.
- *
- * @param file the file to write containing the screenshot
- * @param width the width of the current drawable
- * @param height the height of the current drawable
- * @param alpha whether the alpha channel should be saved. If true,
- * requires GL_EXT_abgr extension to be present.
- *
- * @throws IOException if an I/O error occurred while writing the
- * file
- */
- public void open(final File file,
- final int width,
- final int height,
- final boolean alpha) throws IOException {
- final RandomAccessFile out = new RandomAccessFile(file, "rw");
- ch = out.getChannel();
- final int pixelSize = (alpha ? 32 : 24);
- final int numChannels = (alpha ? 4 : 3);
-
- final int fileLength = TARGA_HEADER_SIZE + width * height * numChannels;
- out.setLength(fileLength);
- final MappedByteBuffer image = ch.map(FileChannel.MapMode.READ_WRITE, 0, fileLength);
-
- // write the TARGA header
- image.put(0, (byte) 0).put(1, (byte) 0);
- image.put(2, (byte) 2); // uncompressed type
- image.put(12, (byte) (width & 0xFF)); // width
- image.put(13, (byte) (width >> 8)); // width
- image.put(14, (byte) (height & 0xFF)); // height
- image.put(15, (byte) (height >> 8)); // height
- image.put(16, (byte) pixelSize); // pixel size
-
- // go to image data position
- image.position(TARGA_HEADER_SIZE);
- // jogl needs a sliced buffer
- buf = image.slice();
- }
-
- /**
- * Returns the ByteBuffer corresponding to the data for the image.
- * This must be filled in with data in either BGR or BGRA format
- * depending on whether an alpha channel was specified during
- * open().
- */
- public ByteBuffer getImageData() {
- return buf;
- }
-
- public void close() throws IOException {
- // close the file channel
- ch.close();
- buf = null;
- }
-}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java
index 6d875fcf5..fd6172e13 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java
@@ -423,20 +423,6 @@ public interface AudioSink {
public int getFreeFrameCount();
/**
- * Enqueue the remaining bytes of the given {@link AudioDataFrame}'s direct ByteBuffer to this sink.
- * <p>
- * The data must comply with the chosen {@link AudioFormat} as returned by {@link #initSink(AudioFormat)}.
- * </p>
- * <p>
- * {@link #init(AudioFormat, float, int, int, int)} must be called first.
- * </p>
- * @returns the enqueued internal {@link AudioFrame}, which may differ from the input <code>audioDataFrame</code>.
- * @deprecated User shall use {@link #enqueueData(int, ByteBuffer, int)}, which allows implementation
- * to reuse specialized {@link AudioFrame} instances.
- */
- public AudioFrame enqueueData(AudioDataFrame audioDataFrame);
-
- /**
* Enqueue <code>byteCount</code> bytes of the remaining bytes of the given NIO {@link ByteBuffer} to this sink.
* <p>
* The data must comply with the chosen {@link AudioFormat} as returned by {@link #initSink(AudioFormat)}.
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java
index 06e3ccda5..b75ad3b17 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java
@@ -50,6 +50,9 @@ public class AWTGLReadBufferUtil extends GLReadBufferUtil {
super(new AWTGLPixelBuffer.AWTGLPixelBufferProvider( glp.isGL2ES3() /* allowRowStride */ ), alpha, false);
}
+ /**
+ * Returns the {@link AWTGLPixelBuffer}, as filled by previous call to {@link #readPixels(GL, int, int, int, int, boolean)}.
+ */
public AWTGLPixelBuffer getAWTGLPixelBuffer() { return (AWTGLPixelBuffer)this.getPixelBuffer(); }
/**
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java b/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java
deleted file mode 100644
index ac208044b..000000000
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
- * Copyright (c) 2013 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistribution of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistribution in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- */
-
-package com.jogamp.opengl.util.awt;
-
-import java.awt.image.BufferedImage;
-import java.awt.image.DataBufferByte;
-import java.io.File;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-import javax.imageio.ImageIO;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2;
-import javax.media.opengl.GL2GL3;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLException;
-
-import com.jogamp.common.util.IOUtil;
-import com.jogamp.opengl.GLExtensions;
-import com.jogamp.opengl.util.GLPixelStorageModes;
-import com.jogamp.opengl.util.TGAWriter;
-
-/**
- * Utilities for taking screenshots of OpenGL applications.
- * @deprecated Please consider using {@link com.jogamp.opengl.util.GLReadBufferUtil},
- * which is AWT independent and does not require a CPU based vertical image flip
- * in case drawable {@link GLDrawable#isGLOriented() is in OpenGL orientation}.
- * Further more you may use {@link AWTGLReadBufferUtil} to read out
- * the framebuffer into a BufferedImage for further AWT processing.
- */
-public class Screenshot {
- private Screenshot() {}
-
- /**
- * Takes a fast screenshot of the current OpenGL drawable to a Targa
- * file. Requires the OpenGL context for the desired drawable to be
- * current. Takes the screenshot from the last assigned read buffer,
- * or the OpenGL default read buffer if none has been specified by
- * the user (GL_FRONT for single-buffered configurations and GL_BACK
- * for double-buffered configurations). This is the fastest
- * mechanism for taking a screenshot of an application. Contributed
- * by Carsten Weisse of Bytonic Software (http://bytonic.de/). <p>
- *
- * No alpha channel is written with this variant.
- *
- * @param file the file to write containing the screenshot
- * @param width the width of the current drawable
- * @param height the height of the current drawable
- *
- * @throws GLException if an OpenGL context was not current or
- * another OpenGL-related error occurred
- * @throws IOException if an I/O error occurred while writing the
- * file
- */
- public static void writeToTargaFile(final File file,
- final int width,
- final int height) throws GLException, IOException {
- writeToTargaFile(file, width, height, false);
- }
-
- /**
- * Takes a fast screenshot of the current OpenGL drawable to a Targa
- * file. Requires the OpenGL context for the desired drawable to be
- * current. Takes the screenshot from the last assigned read buffer,
- * or the OpenGL default read buffer if none has been specified by
- * the user (GL_FRONT for single-buffered configurations and GL_BACK
- * for double-buffered configurations). This is the fastest
- * mechanism for taking a screenshot of an application. Contributed
- * by Carsten Weisse of Bytonic Software (http://bytonic.de/).
- *
- * @param file the file to write containing the screenshot
- * @param width the width of the current drawable
- * @param height the height of the current drawable
- * @param alpha whether the alpha channel should be saved. If true,
- * requires GL_EXT_abgr extension to be present.
- *
- * @throws GLException if an OpenGL context was not current or
- * another OpenGL-related error occurred
- * @throws IOException if an I/O error occurred while writing the
- * file
- */
- public static void writeToTargaFile(final File file,
- final int width,
- final int height,
- final boolean alpha) throws GLException, IOException {
- writeToTargaFile(file, 0, 0, width, height, alpha);
- }
-
- /**
- * Takes a fast screenshot of the current OpenGL drawable to a Targa
- * file. Requires the OpenGL context for the desired drawable to be
- * current. Takes the screenshot from the last assigned read buffer,
- * or the OpenGL default read buffer if none has been specified by
- * the user (GL_FRONT for single-buffered configurations and GL_BACK
- * for double-buffered configurations). This is the fastest
- * mechanism for taking a screenshot of an application. Contributed
- * by Carsten Weisse of Bytonic Software (http://bytonic.de/).
- *
- * @param file the file to write containing the screenshot
- * @param x the starting x coordinate of the screenshot, measured from the lower-left
- * @param y the starting y coordinate of the screenshot, measured from the lower-left
- * @param width the width of the desired screenshot area
- * @param height the height of the desired screenshot area
- * @param alpha whether the alpha channel should be saved. If true,
- * requires GL_EXT_abgr extension to be present.
- *
- * @throws GLException if an OpenGL context was not current or
- * another OpenGL-related error occurred
- * @throws IOException if an I/O error occurred while writing the
- * file
- */
- public static void writeToTargaFile(final File file,
- final int x,
- final int y,
- final int width,
- final int height,
- final boolean alpha) throws GLException, IOException {
- if (alpha) {
- checkExtABGR();
- }
-
- final TGAWriter writer = new TGAWriter();
- writer.open(file, width, height, alpha);
- final ByteBuffer bgr = writer.getImageData();
-
- final GL gl = GLContext.getCurrentGL();
-
- // Set up pixel storage modes
- final GLPixelStorageModes psm = new GLPixelStorageModes();
- psm.setPackAlignment(gl, 1);
-
- final int readbackType = (alpha ? GL2.GL_ABGR_EXT : GL2GL3.GL_BGR);
-
- // read the BGR values into the image buffer
- gl.glReadPixels(x, y, width, height, readbackType,
- GL.GL_UNSIGNED_BYTE, bgr);
-
- // Restore pixel storage modes
- psm.restore(gl);
-
- // close the file
- writer.close();
- }
-
- /**
- * Takes a screenshot of the current OpenGL drawable to a
- * BufferedImage. Requires the OpenGL context for the desired
- * drawable to be current. Takes the screenshot from the last
- * assigned read buffer, or the OpenGL default read buffer if none
- * has been specified by the user (GL_FRONT for single-buffered
- * configurations and GL_BACK for double-buffered configurations).
- * Note that the scanlines of the resulting image are flipped
- * vertically in order to correctly match the OpenGL contents, which
- * takes time and is therefore not as fast as the Targa screenshot
- * function. <P>
- *
- * No alpha channel is read back with this variant.
- *
- * @param width the width of the current drawable
- * @param height the height of the current drawable
- *
- * @throws GLException if an OpenGL context was not current or
- * another OpenGL-related error occurred
- */
- public static BufferedImage readToBufferedImage(final int width,
- final int height) throws GLException {
- return readToBufferedImage(width, height, false);
- }
-
- /**
- * Takes a screenshot of the current OpenGL drawable to a
- * BufferedImage. Requires the OpenGL context for the desired
- * drawable to be current. Takes the screenshot from the last
- * assigned read buffer, or the OpenGL default read buffer if none
- * has been specified by the user (GL_FRONT for single-buffered
- * configurations and GL_BACK for double-buffered configurations).
- * Note that the scanlines of the resulting image are flipped
- * vertically in order to correctly match the OpenGL contents, which
- * takes time and is therefore not as fast as the Targa screenshot
- * function.
- *
- * @param width the width of the current drawable
- * @param height the height of the current drawable
- * @param alpha whether the alpha channel should be read back. If
- * true, requires GL_EXT_abgr extension to be present.
- *
- * @throws GLException if an OpenGL context was not current or
- * another OpenGL-related error occurred
- */
- public static BufferedImage readToBufferedImage(final int width,
- final int height,
- final boolean alpha) throws GLException {
- return readToBufferedImage(0, 0, width, height, alpha);
- }
-
- /**
- * Takes a screenshot of the current OpenGL drawable to a
- * BufferedImage. Requires the OpenGL context for the desired
- * drawable to be current. Takes the screenshot from the last
- * assigned read buffer, or the OpenGL default read buffer if none
- * has been specified by the user (GL_FRONT for single-buffered
- * configurations and GL_BACK for double-buffered configurations).
- * Note that the scanlines of the resulting image are flipped
- * vertically in order to correctly match the OpenGL contents, which
- * takes time and is therefore not as fast as the Targa screenshot
- * function.
- *
- * @param x the starting x coordinate of the screenshot, measured from the lower-left
- * @param y the starting y coordinate of the screenshot, measured from the lower-left
- * @param width the width of the desired screenshot area
- * @param height the height of the desired screenshot area
- * @param alpha whether the alpha channel should be read back. If
- * true, requires GL_EXT_abgr extension to be present.
- *
- * @throws GLException if an OpenGL context was not current or
- * another OpenGL-related error occurred
- */
- public static BufferedImage readToBufferedImage(final int x,
- final int y,
- final int width,
- final int height,
- final boolean alpha) throws GLException {
- final int bufImgType = (alpha ? BufferedImage.TYPE_4BYTE_ABGR : BufferedImage.TYPE_3BYTE_BGR);
- final int readbackType = (alpha ? GL2.GL_ABGR_EXT : GL2GL3.GL_BGR);
-
- if (alpha) {
- checkExtABGR();
- }
-
- // Allocate necessary storage
- final BufferedImage image = new BufferedImage(width, height, bufImgType);
-
- final GLContext glc = GLContext.getCurrent();
- final GL gl = glc.getGL();
-
- // Set up pixel storage modes
- final GLPixelStorageModes psm = new GLPixelStorageModes();
- psm.setPackAlignment(gl, 1);
-
- // read the BGR values into the image
- gl.glReadPixels(x, y, width, height, readbackType,
- GL.GL_UNSIGNED_BYTE,
- ByteBuffer.wrap(((DataBufferByte) image.getRaster().getDataBuffer()).getData()));
-
- // Restore pixel storage modes
- psm.restore(gl);
-
- if( glc.getGLDrawable().isGLOriented() ) {
- // Must flip BufferedImage vertically for correct results
- ImageUtil.flipImageVertically(image);
- }
- return image;
- }
-
- /**
- * Takes a screenshot of the current OpenGL drawable to the
- * specified file on disk using the ImageIO package. Requires the
- * OpenGL context for the desired drawable to be current. Takes the
- * screenshot from the last assigned read buffer, or the OpenGL
- * default read buffer if none has been specified by the user
- * (GL_FRONT for single-buffered configurations and GL_BACK for
- * double-buffered configurations). This is not the fastest
- * mechanism for taking a screenshot but may be more convenient than
- * others for getting images for consumption by other packages. The
- * file format is inferred from the suffix of the given file. <P>
- *
- * No alpha channel is saved with this variant.
- *
- * @param file the file to write containing the screenshot
- * @param width the width of the current drawable
- * @param height the height of the current drawable
- *
- * @throws GLException if an OpenGL context was not current or
- * another OpenGL-related error occurred
- *
- * @throws IOException if an I/O error occurred or if the file could
- * not be written to disk due to the requested file format being
- * unsupported by ImageIO
- */
- public static void writeToFile(final File file,
- final int width,
- final int height) throws IOException, GLException {
- writeToFile(file, width, height, false);
- }
-
- /**
- * Takes a screenshot of the current OpenGL drawable to the
- * specified file on disk using the ImageIO package. Requires the
- * OpenGL context for the desired drawable to be current. Takes the
- * screenshot from the last assigned read buffer, or the OpenGL
- * default read buffer if none has been specified by the user
- * (GL_FRONT for single-buffered configurations and GL_BACK for
- * double-buffered configurations). This is not the fastest
- * mechanism for taking a screenshot but may be more convenient than
- * others for getting images for consumption by other packages. The
- * file format is inferred from the suffix of the given file. <P>
- *
- * Note that some file formats, in particular JPEG, can not handle
- * an alpha channel properly. If the "alpha" argument is specified
- * as true for such a file format it will be silently ignored.
- *
- * @param file the file to write containing the screenshot
- * @param width the width of the current drawable
- * @param height the height of the current drawable
- * @param alpha whether an alpha channel should be saved. If true,
- * requires GL_EXT_abgr extension to be present.
- *
- * @throws GLException if an OpenGL context was not current or
- * another OpenGL-related error occurred
- *
- * @throws IOException if an I/O error occurred or if the file could
- * not be written to disk due to the requested file format being
- * unsupported by ImageIO
- */
- public static void writeToFile(final File file,
- final int width,
- final int height,
- final boolean alpha) throws IOException, GLException {
- writeToFile(file, 0, 0, width, height, alpha);
- }
-
- /**
- * Takes a screenshot of the current OpenGL drawable to the
- * specified file on disk using the ImageIO package. Requires the
- * OpenGL context for the desired drawable to be current. Takes the
- * screenshot from the last assigned read buffer, or the OpenGL
- * default read buffer if none has been specified by the user
- * (GL_FRONT for single-buffered configurations and GL_BACK for
- * double-buffered configurations). This is not the fastest
- * mechanism for taking a screenshot but may be more convenient than
- * others for getting images for consumption by other packages. The
- * file format is inferred from the suffix of the given file. <P>
- *
- * Note that some file formats, in particular JPEG, can not handle
- * an alpha channel properly. If the "alpha" argument is specified
- * as true for such a file format it will be silently ignored.
- *
- * @param file the file to write containing the screenshot
- * @param x the starting x coordinate of the screenshot, measured from the lower-left
- * @param y the starting y coordinate of the screenshot, measured from the lower-left
- * @param width the width of the current drawable
- * @param height the height of the current drawable
- * @param alpha whether an alpha channel should be saved. If true,
- * requires GL_EXT_abgr extension to be present.
- *
- * @throws GLException if an OpenGL context was not current or
- * another OpenGL-related error occurred
- *
- * @throws IOException if an I/O error occurred or if the file could
- * not be written to disk due to the requested file format being
- * unsupported by ImageIO
- */
- public static void writeToFile(final File file,
- final int x,
- final int y,
- final int width,
- final int height,
- boolean alpha) throws IOException, GLException {
- final String fileSuffix = IOUtil.getFileSuffix(file);
- if (alpha && (fileSuffix.equals("jpg") || fileSuffix.equals("jpeg"))) {
- // JPEGs can't deal properly with alpha channels
- alpha = false;
- }
-
- final BufferedImage image = readToBufferedImage(x, y, width, height, alpha);
- if (!ImageIO.write(image, fileSuffix, file)) {
- throw new IOException("Unsupported file format " + fileSuffix);
- }
- }
-
- private static void checkExtABGR() {
- final GL gl = GLContext.getCurrentGL();
-
- if (!gl.isExtensionAvailable(GLExtensions.EXT_abgr)) {
- throw new IllegalArgumentException("Saving alpha channel requires GL_EXT_abgr");
- }
- }
-}
diff --git a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
index bf8fe65ac..377dce190 100644
--- a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
@@ -199,6 +199,11 @@ public interface GLAutoDrawable extends GLDrawable {
public int getGLEventListenerCount();
/**
+ * Returns true if all added {@link GLEventListener} are initialized, otherwise false.
+ */
+ boolean areAllGLEventListenerInitialized();
+
+ /**
* Returns the {@link GLEventListener} at the given index of this drawable queue.
* @param index Position of the listener to be returned.
* Should be within (0 <= index && index < size()).
diff --git a/src/jogl/classes/javax/media/opengl/GLBase.java b/src/jogl/classes/javax/media/opengl/GLBase.java
index c808399b8..48455c525 100644
--- a/src/jogl/classes/javax/media/opengl/GLBase.java
+++ b/src/jogl/classes/javax/media/opengl/GLBase.java
@@ -505,10 +505,6 @@ public interface GLBase {
public void glDepthRange(double zNear, double zFar);
/**
- * @deprecated Avoid original GL API namespace conflict. Use {@link #getBoundBuffer(int)}
- */
- public int glGetBoundBuffer(int target);
- /**
* @param target a GL buffer (VBO) target as used in {@link GL#glBindBuffer(int, int)}, ie {@link GL#GL_ELEMENT_ARRAY_BUFFER}, {@link GL#GL_ARRAY_BUFFER}, ..
* @return the GL buffer name bound to a target via {@link GL#glBindBuffer(int, int)} or 0 if unbound.
* @see #getBufferStorage(int)
@@ -516,10 +512,6 @@ public interface GLBase {
public int getBoundBuffer(int target);
/**
- * @deprecated Use {@link #getBufferStorage(int)}.
- */
- public long glGetBufferSize(int bufferName);
- /**
* @param bufferName a GL buffer name, generated with e.g. {@link GL#glGenBuffers(int, int[], int)} and used in {@link GL#glBindBuffer(int, int)}, {@link GL#glBufferData(int, long, java.nio.Buffer, int)} or {@link GL2#glNamedBufferDataEXT(int, long, java.nio.Buffer, int)}.
* @return the size of the given GL buffer storage, see {@link GLBufferStorage}
* @see #getBoundBuffer(int)
@@ -580,19 +572,11 @@ public interface GLBase {
public GLBufferStorage mapBufferRange(final int target, final long offset, final long length, final int access) throws GLException;
/**
- * @deprecated Avoid original GL API namespace conflict. Use {@link #isVBOArrayBound()}
- */
- public boolean glIsVBOArrayBound();
- /**
* @return true if a VBO is bound to {@link GL#GL_ARRAY_BUFFER} via {@link GL#glBindBuffer(int, int)}, otherwise false
*/
public boolean isVBOArrayBound();
/**
- * @deprecated Avoid original GL API namespace conflict. Use {@link #isVBOElementArrayBound()}
- */
- public boolean glIsVBOElementArrayBound();
- /**
* @return true if a VBO is bound to {@link GL#GL_ELEMENT_ARRAY_BUFFER} via {@link GL#glBindBuffer(int, int)}, otherwise false
*/
public boolean isVBOElementArrayBound();
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index 6e7caf8f8..82808a3cb 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -59,10 +59,10 @@ import javax.media.nativewindow.UpstreamSurfaceHook;
import jogamp.opengl.Debug;
-/** <P> Provides a virtual machine- and operating system-independent
- mechanism for creating {@link GLDrawable}s. </P>
-
- <P> The {@link javax.media.opengl.GLCapabilities} objects passed
+/** <p> Provides a virtual machine- and operating system-independent
+ mechanism for creating {@link GLDrawable}s.
+ </p>
+ <p> The {@link javax.media.opengl.GLCapabilities} objects passed
in to the various factory methods are used as a hint for the
properties of the returned drawable. The default capabilities
selection algorithm (equivalent to passing in a null {@link
@@ -72,9 +72,10 @@ import jogamp.opengl.Debug;
GLCapabilitiesChooser} which can select from the available pixel
formats. The GLCapabilitiesChooser mechanism may not be supported
by all implementations or on all platforms, in which case any
- passed GLCapabilitiesChooser will be ignored. </P>
+ passed GLCapabilitiesChooser will be ignored.
+ </p>
- <P> Because of the multithreaded nature of the Java platform's
+ <p> Because of the multithreaded nature of the Java platform's
Abstract Window Toolkit, it is typically not possible to immediately
reject a given {@link GLCapabilities} as being unsupportable by
either returning <code>null</code> from the creation routines or
@@ -83,14 +84,15 @@ import jogamp.opengl.Debug;
implementation will cause a {@link GLException} to be raised
during the first repaint of the {@link javax.media.opengl.awt.GLCanvas} or {@link
javax.media.opengl.awt.GLJPanel} if the capabilities can not be met.<br>
- {@link javax.media.opengl.GLPbuffer} are always
- created immediately and their creation will fail with a
- {@link javax.media.opengl.GLException} if errors occur. </P>
+ {@link GLOffscreenAutoDrawable} are created lazily,
+ see {@link #createOffscreenAutoDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int) createOffscreenAutoDrawable(..)}.
+ </p>
- <P> The concrete GLDrawableFactory subclass instantiated by {@link
+ <p> The concrete GLDrawableFactory subclass instantiated by {@link
#getFactory getFactory} can be changed by setting the system
property <code>opengl.factory.class.name</code> to the
- fully-qualified name of the desired class. </P>
+ fully-qualified name of the desired class.
+ </p>
*/
public abstract class GLDrawableFactory {
@@ -474,57 +476,11 @@ public abstract class GLDrawableFactory {
* incl it's offscreen {@link NativeSurface} with the given capabilites and dimensions.
* <p>
* The {@link GLOffscreenAutoDrawable}'s {@link GLDrawable} is {@link GLDrawable#isRealized() realized}
- * and it's {@link GLContext} assigned but not yet made current.
- * </p>
- * <p>
- * In case the passed {@link GLCapabilitiesImmutable} contains default values, i.e.
- * {@link GLCapabilitiesImmutable#isOnscreen() caps.isOnscreen()} <code> == true</code>,
- * it is auto-configured. Auto configuration will set {@link GLCapabilitiesImmutable caps} to offscreen
- * and FBO <i>or</i> Pbuffer, whichever is available in that order.
- * </p>
- * <p>
- * A FBO based auto drawable, {@link GLOffscreenAutoDrawable.FBO}, is created if both {@link GLCapabilitiesImmutable#isFBO() caps.isFBO()}
- * and {@link GLContext#isFBOAvailable(AbstractGraphicsDevice, GLProfile) canCreateFBO(device, caps.getGLProfile())} is true.
- * </p>
- * <p>
- * A Pbuffer based auto drawable is created if both {@link GLCapabilitiesImmutable#isPBuffer() caps.isPBuffer()}
- * and {@link #canCreateGLPbuffer(AbstractGraphicsDevice, GLProfile) canCreateGLPbuffer(device)} is true.
- * </p>
- * <p>
- * If neither FBO nor Pbuffer is available,
- * a simple pixmap/bitmap auto drawable is created, which is unlikely to be hardware accelerated.
- * </p>
- * <p>
- * The resulting {@link GLOffscreenAutoDrawable} has it's own independent device instance using <code>device</code> details.
- * </p>
- *
- * @param device which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device.
- * @param caps the requested GLCapabilties
- * @param chooser the custom chooser, may be null for default
- * @param width the requested offscreen width
- * @param height the requested offscreen height
- * @return the created and initialized offscreen {@link GLOffscreenAutoDrawable} instance
- *
- * @throws GLException if any window system-specific errors caused
- * the creation of the Offscreen to fail.
- *
- * @see #createOffscreenDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int)
- * @deprecated Use {@link #createOffscreenAutoDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int)
- */
- public abstract GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice device,
- GLCapabilitiesImmutable caps,
- GLCapabilitiesChooser chooser,
- int width, int height,
- GLContext shareWith) throws GLException;
-
- /**
- * Creates a {@link GLDrawable#isRealized() realized} {@link GLOffscreenAutoDrawable}
- * incl it's offscreen {@link NativeSurface} with the given capabilites and dimensions.
- * <p>
- * The {@link GLOffscreenAutoDrawable}'s {@link GLDrawable} is {@link GLDrawable#isRealized() realized}
* <i>without</i> an assigned {@link GLContext}, hence not initialized completely.<br>
+ *
* The {@link GLContext} can be assigned later manually via {@link GLAutoDrawable#setContext(GLContext, boolean) setContext(ctx)}
* <i>or</i> it will be created <i>lazily</i> at the 1st {@link GLAutoDrawable#display() display()} method call.<br>
+ *
* <i>Lazy</i> {@link GLContext} creation will take a shared {@link GLContext} into account
* which has been set {@link GLOffscreenAutoDrawable#setSharedContext(GLContext) directly}
* or {@link GLOffscreenAutoDrawable#setSharedAutoDrawable(GLAutoDrawable) via another GLAutoDrawable}.
@@ -716,38 +672,6 @@ public abstract class GLDrawableFactory {
*/
public abstract boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp);
- /**
- * Creates a GLPbuffer {@link GLAutoDrawable} with the given capabilites and dimensions.
- * <p>
- * The GLPbuffer drawable is realized and initialized eagerly.
- * </p>
- *
- * See the note in the overview documentation in {@link GLSharedContextSetter} and on
- * <a href="../../../spec-overview.html#SHARING">context sharing</a>.
- *
- * @param device which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
- * @param capabilities the requested capabilities
- * @param chooser the custom chooser, may be null for default
- * @param initialWidth initial width of pbuffer
- * @param initialHeight initial height of pbuffer
- * @param shareWith a shared GLContext this GLPbuffer shall use
- *
- * @return the created and initialized {@link GLPbuffer} instance
- *
- * @throws GLException if any window system-specific errors caused
- * the creation of the GLPbuffer to fail.
- *
- * @deprecated {@link GLPbuffer} is deprecated, use {@link #createOffscreenAutoDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int, GLContext)}
- */
- public abstract GLPbuffer createGLPbuffer(AbstractGraphicsDevice device,
- GLCapabilitiesImmutable capabilities,
- GLCapabilitiesChooser chooser,
- int initialWidth,
- int initialHeight,
- GLContext shareWith)
- throws GLException;
-
-
//----------------------------------------------------------------------
// Methods for interacting with third-party OpenGL libraries
diff --git a/src/jogl/classes/javax/media/opengl/GLPbuffer.java b/src/jogl/classes/javax/media/opengl/GLPbuffer.java
deleted file mode 100644
index f36a4bf29..000000000
--- a/src/jogl/classes/javax/media/opengl/GLPbuffer.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistribution of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistribution in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- *
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package javax.media.opengl;
-
-/** Provides offscreen rendering support via pbuffers. The principal
- addition of this interface is a {@link #destroy} method to
- deallocate the pbuffer and its associated resources. It also
- contains experimental methods for accessing the pbuffer's contents
- as a texture map and enabling rendering to floating-point frame
- buffers. These methods are not guaranteed to be supported on all
- platforms and may be deprecated in a future release.
-
- @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 {
- /** 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
- pbuffer, the application must destroy any additional OpenGL
- contexts which have been created for the pbuffer via {@link
- #createContext}. */
- @Override
- public void destroy();
-}
diff --git a/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java b/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java
index 2ea4e4cd6..11ed648c2 100644
--- a/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java
+++ b/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java
@@ -99,12 +99,6 @@ package javax.media.opengl;
*/
public interface GLSharedContextSetter extends GLAutoDrawable {
/**
- * Returns true if all {@link GLEventListener} are initialized, otherwise false.
- * @deprecated Promote method to {@link GLAutoDrawable}
- */
- boolean areAllGLEventListenerInitialized();
-
- /**
* Specifies an {@link GLContext OpenGL context}, which shall be shared by this {@link GLAutoDrawable}'s {@link GLContext}.
* <p>
* Since the {@link GLDrawable drawable} and {@link GLContext context} is created
diff --git a/src/jogl/classes/javax/media/opengl/Threading.java b/src/jogl/classes/javax/media/opengl/Threading.java
index 3ee233303..6c64cbe31 100644
--- a/src/jogl/classes/javax/media/opengl/Threading.java
+++ b/src/jogl/classes/javax/media/opengl/Threading.java
@@ -129,8 +129,8 @@ public class Threading {
consequences and are prepared to enforce some amount of
threading restrictions in their applications. Disabling
single-threading, for example, may have unintended consequences
- on GLAutoDrawable implementations such as GLCanvas, GLJPanel and
- GLPbuffer. Currently there is no supported way to re-enable it
+ on GLAutoDrawable implementations such as GLCanvas and GLJPanel.
+ Currently there is no supported way to re-enable it
once disabled, partly to discourage careless use of this
method. This method should be called as early as possible in an
application. */
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index ec834e02f..2d5e12429 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -155,6 +155,11 @@ import jogamp.opengl.awt.AWTTilePainter;
* <ul>
* <li><pre>sun.awt.noerasebackground=true</pre></li>
* </ul>
+ *
+ * <a name="contextSharing"><h5>OpenGL Context Sharing</h5></a>
+ * To share a {@link GLContext} see the following note in the documentation overview:
+ * <a href="../../../spec-overview.html#SHARING">context sharing</a>
+ * as well as {@link GLSharedContextSetter}.
*/
@SuppressWarnings("serial")
@@ -200,6 +205,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
/** Creates a new GLCanvas component with a default set of OpenGL
capabilities, using the default OpenGL capabilities selection
mechanism, on the default screen device.
+ <p>
+ See details about <a href="#contextSharing">OpenGL context sharing</a>.
+ </p>
* @throws GLException if no default profile is available for the default desktop device.
*/
public GLCanvas() throws GLException {
@@ -209,27 +217,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
/** Creates a new GLCanvas component with the requested set of
OpenGL capabilities, using the default OpenGL capabilities
selection mechanism, on the default screen device.
+ <p>
+ See details about <a href="#contextSharing">OpenGL context sharing</a>.
+ </p>
* @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
* @see GLCanvas#GLCanvas(javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, javax.media.opengl.GLContext, java.awt.GraphicsDevice)
*/
public GLCanvas(final GLCapabilitiesImmutable capsReqUser) throws GLException {
- this(capsReqUser, null, null, null);
- }
-
- /** Creates a new GLCanvas component with the requested set of
- OpenGL capabilities, using the default OpenGL capabilities
- selection mechanism, on the default screen device.
- * This constructor variant also supports using a shared GLContext.
- *
- * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
- * @see GLCanvas#GLCanvas(javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, javax.media.opengl.GLContext, java.awt.GraphicsDevice)
- * @deprecated Use {@link #GLCanvas(GLCapabilitiesImmutable)}
- * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}.
- */
- public GLCanvas(final GLCapabilitiesImmutable capsReqUser, final GLContext shareWith)
- throws GLException
- {
- this(capsReqUser, null, shareWith, null);
+ this(capsReqUser, null, null);
}
/** Creates a new GLCanvas component. The passed GLCapabilities
@@ -242,6 +237,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
which to create the GLCanvas; the GLDrawableFactory uses the
default screen device of the local GraphicsEnvironment if null
is passed for this argument.
+ <p>
+ See details about <a href="#contextSharing">OpenGL context sharing</a>.
+ </p>
* @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
*/
public GLCanvas(final GLCapabilitiesImmutable capsReqUser,
@@ -249,34 +247,6 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
final GraphicsDevice device)
throws GLException
{
- this(capsReqUser, chooser, null, device);
- }
-
- /** Creates a new GLCanvas component. The passed GLCapabilities
- specifies the OpenGL capabilities for the component; if null, a
- default set of capabilities is used. The GLCapabilitiesChooser
- specifies the algorithm for selecting one of the available
- GLCapabilities for the component; a DefaultGLCapabilitesChooser
- is used if null is passed for this argument. The passed
- GLContext specifies an OpenGL context with which to share
- textures, display lists and other OpenGL state, and may be null
- if sharing is not desired. See the note in the overview
- documentation on <a
- href="../../../spec-overview.html#SHARING">context
- sharing</a>. The passed GraphicsDevice indicates the screen on
- which to create the GLCanvas; the GLDrawableFactory uses the
- default screen device of the local GraphicsEnvironment if null
- is passed for this argument.
- * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
- * @deprecated Use {@link #GLCanvas(GLCapabilitiesImmutable, GLCapabilitiesChooser, GraphicsDevice)}
- * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}.
- */
- public GLCanvas(GLCapabilitiesImmutable capsReqUser,
- final GLCapabilitiesChooser chooser,
- final GLContext shareWith,
- GraphicsDevice device)
- throws GLException
- {
/*
* Determination of the native window is made in 'super.addNotify()',
* which creates the native peer using AWT's GraphicsConfiguration.
@@ -287,29 +257,28 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
super();
if(null==capsReqUser) {
- capsReqUser = new GLCapabilities(GLProfile.getDefault(GLProfile.getDefaultDevice()));
+ this.capsReqUser = new GLCapabilities(GLProfile.getDefault(GLProfile.getDefaultDevice()));
} else {
// don't allow the user to change data
- capsReqUser = (GLCapabilitiesImmutable) capsReqUser.cloneMutable();
+ this.capsReqUser = (GLCapabilitiesImmutable) capsReqUser.cloneMutable();
}
- if(!capsReqUser.isOnscreen()) {
+ if( !this.capsReqUser.isOnscreen() ) {
setShallUseOffscreenLayer(true); // trigger offscreen layer - if supported
}
if(null==device) {
final GraphicsConfiguration gc = super.getGraphicsConfiguration();
if(null!=gc) {
- device = gc.getDevice();
+ this.device = gc.getDevice();
+ } else {
+ this.device = null;
}
+ } else {
+ this.device = device;
}
// instantiation will be issued in addNotify()
- this.capsReqUser = capsReqUser;
this.chooser = chooser;
- if( null != shareWith ) {
- helper.setSharedContext(null, shareWith);
- }
- this.device = device;
this.addHierarchyListener(hierarchyListener);
this.isShowing = isShowing();
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index eca99c6c0..549b6e96f 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -170,6 +170,10 @@ import com.jogamp.opengl.util.texture.TextureState;
It is recommended to reset those states to default when leaving the {@link GLEventListener#display(GLAutoDrawable)} method!
We may change this behavior in the future, i.e. preserve all influencing states.
</p>
+ <a name="contextSharing"><h5>OpenGL Context Sharing</h5></a>
+ To share a {@link GLContext} see the following note in the documentation overview:
+ <a href="../../../spec-overview.html#SHARING">context sharing</a>
+ as well as {@link GLSharedContextSetter}.
*/
@SuppressWarnings("serial")
@@ -298,6 +302,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
/** Creates a new GLJPanel component with a default set of OpenGL
capabilities and using the default OpenGL capabilities selection
mechanism.
+ <p>
+ See details about <a href="#contextSharing">OpenGL context sharing</a>.
+ </p>
* @throws GLException if no default profile is available for the default desktop device.
*/
public GLJPanel() throws GLException {
@@ -307,10 +314,13 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
/** Creates a new GLJPanel component with the requested set of
OpenGL capabilities, using the default OpenGL capabilities
selection mechanism.
+ <p>
+ See details about <a href="#contextSharing">OpenGL context sharing</a>.
+ </p>
* @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
*/
public GLJPanel(final GLCapabilitiesImmutable userCapsRequest) throws GLException {
- this(userCapsRequest, null, null);
+ this(userCapsRequest, null);
}
/** Creates a new GLJPanel component. The passed GLCapabilities
@@ -319,34 +329,14 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
specifies the algorithm for selecting one of the available
GLCapabilities for the component; a DefaultGLCapabilitesChooser
is used if null is passed for this argument.
+ <p>
+ See details about <a href="#contextSharing">OpenGL context sharing</a>.
+ </p>
* @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
*/
public GLJPanel(final GLCapabilitiesImmutable userCapsRequest, final GLCapabilitiesChooser chooser)
throws GLException
{
- this(userCapsRequest, chooser, null);
- }
-
- /** Creates a new GLJPanel component. The passed GLCapabilities
- specifies the OpenGL capabilities for the component; if null, a
- default set of capabilities is used. The GLCapabilitiesChooser
- specifies the algorithm for selecting one of the available
- GLCapabilities for the component; a DefaultGLCapabilitesChooser
- is used if null is passed for this argument. The passed
- GLContext specifies an OpenGL context with which to share
- textures, display lists and other OpenGL state, and may be null
- if sharing is not desired. See the note in the overview documentation on
- <a href="../../../spec-overview.html#SHARING">context sharing</a>.
- <P>
- Note: Sharing cannot be enabled using J2D OpenGL FBO sharing,
- since J2D GL Context must be shared and we can only share one context.
- * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
- * @deprecated Use {@link #GLJPanel(GLCapabilitiesImmutable, GLCapabilitiesChooser)}
- * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}.
- */
- public GLJPanel(final GLCapabilitiesImmutable userCapsRequest, final GLCapabilitiesChooser chooser, final GLContext shareWith)
- throws GLException
- {
super();
// Works around problems on many vendors' cards; we don't need a
@@ -366,9 +356,6 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
this.chooser = chooser;
helper = new GLDrawableHelper();
- if( null != shareWith ) {
- helper.setSharedContext(null, shareWith);
- }
autoSwapBufferMode = helper.getAutoSwapBufferMode();
this.setFocusable(true); // allow keyboard input!
diff --git a/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java
index 34857586d..7e49b3464 100644
--- a/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java
+++ b/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java
@@ -491,18 +491,6 @@ public class GLBufferObjectTracker {
return res;
}
- public synchronized final long getBufferSize(final int bufferName) {
- final GLBufferStorageImpl store = (GLBufferStorageImpl)bufferName2StorageMap.get(bufferName);
- if ( null == store ) {
- if (DEBUG) {
- System.err.printf("%s: %s.getBufferSize(): Buffer %d not tracked%n", warning, msgClazzName, bufferName);
- Thread.dumpStack();
- }
- return 0;
- }
- return store.getSize();
- }
-
public synchronized final GLBufferStorage getBufferStorage(final int bufferName) {
return (GLBufferStorageImpl)bufferName2StorageMap.get(bufferName);
}
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index ff4e9314f..c175243ae 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -2093,13 +2093,6 @@ public abstract class GLContextImpl extends GLContext {
return contextFQN;
}
- /** Indicates which floating-point pbuffer implementation is in
- use. Returns one of GLPbuffer.APPLE_FLOAT, GLPbuffer.ATI_FLOAT,
- or GLPbuffer.NV_FLOAT. */
- public int getFloatingPointMode() throws GLException {
- throw new GLException("Not supported on non-pbuffer contexts");
- }
-
@Override
public int getDefaultPixelDataType() {
evalPixelDataType();
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
index 1aca29d0a..0b119b50d 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
@@ -59,7 +59,6 @@ import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLException;
import javax.media.opengl.GLFBODrawable;
import javax.media.opengl.GLOffscreenAutoDrawable;
-import javax.media.opengl.GLPbuffer;
import javax.media.opengl.GLProfile;
import com.jogamp.nativewindow.MutableGraphicsConfiguration;
@@ -74,7 +73,6 @@ import com.jogamp.opengl.GLRendererQuirks;
Independent Bitmaps on Windows, pixmaps on X11). Direct access to
these GLDrawables is not supplied directly to end users, though
they may be instantiated by the GLJPanel implementation. */
-@SuppressWarnings("deprecation")
public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
protected static final boolean DEBUG = GLDrawableFactory.DEBUG; // allow package access
@@ -251,37 +249,6 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
@Override
public abstract boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp);
- @Override
- public final GLPbuffer createGLPbuffer(final AbstractGraphicsDevice deviceReq,
- final GLCapabilitiesImmutable capsRequested,
- final GLCapabilitiesChooser chooser,
- final int width,
- final int height,
- final GLContext shareWith) {
- if(width<=0 || height<=0) {
- throw new GLException("initial size must be positive (were (" + width + " x " + height + "))");
- }
- final AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq);
- if(null == device) {
- throw new GLException("No shared device for requested: "+deviceReq);
- }
- if ( !canCreateGLPbuffer(device, capsRequested.getGLProfile()) ) {
- throw new GLException("Pbuffer not available with device: "+device);
- }
-
- final GLCapabilitiesImmutable capsChosen = GLGraphicsConfigurationUtil.fixGLPBufferGLCapabilities(capsRequested);
- final GLDrawableImpl drawable = createOffscreenDrawableImpl( createMutableSurfaceImpl(device, true, capsChosen, capsRequested, chooser,
- new UpstreamSurfaceHookMutableSize(width, height) ) );
- final GLContextImpl ctx;
- if(null != drawable) {
- drawable.setRealized(true);
- ctx = (GLContextImpl) drawable.createContext(shareWith);
- } else {
- ctx = null;
- }
- return new GLPbufferImpl( drawable, ctx);
- }
-
//---------------------------------------------------------------------------
//
// Offscreen GLDrawable construction
@@ -300,21 +267,6 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
public final GLOffscreenAutoDrawable createOffscreenAutoDrawable(final AbstractGraphicsDevice deviceReq,
final GLCapabilitiesImmutable capsRequested,
final GLCapabilitiesChooser chooser,
- final int width, final int height,
- final GLContext shareWith) {
- final GLDrawable drawable = createOffscreenDrawable( deviceReq, capsRequested, chooser, width, height );
- drawable.setRealized(true);
- final GLContext context = drawable.createContext(shareWith);
- if(drawable instanceof GLFBODrawableImpl) {
- return new GLOffscreenAutoDrawableImpl.FBOImpl( (GLFBODrawableImpl)drawable, context, null, null );
- }
- return new GLOffscreenAutoDrawableImpl( drawable, context, null, null);
- }
-
- @Override
- public final GLOffscreenAutoDrawable createOffscreenAutoDrawable(final AbstractGraphicsDevice deviceReq,
- final GLCapabilitiesImmutable capsRequested,
- final GLCapabilitiesChooser chooser,
final int width, final int height) {
final GLDrawable drawable = createOffscreenDrawable( deviceReq, capsRequested, chooser, width, height );
drawable.setRealized(true);
diff --git a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
deleted file mode 100644
index ac5487961..000000000
--- a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- * Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistribution of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistribution in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- *
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package jogamp.opengl;
-
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLPbuffer;
-
-import com.jogamp.common.util.locks.LockFactory;
-import com.jogamp.common.util.locks.RecursiveLock;
-
-@SuppressWarnings("deprecation")
-public class GLPbufferImpl extends GLAutoDrawableBase implements GLPbuffer {
-
- public GLPbufferImpl(final GLDrawableImpl pbufferDrawable, final GLContextImpl pbufferContext) {
- super(pbufferDrawable, pbufferContext, true); // drawable := pbufferDrawable, context := pbufferContext
- }
-
- //
- // pbuffer specifics
- //
-
- //
- // GLDrawable delegation
- //
-
- @Override
- public final void swapBuffers() throws GLException {
- defaultSwapBuffers();
- }
-
- //
- // GLAutoDrawable completion
- //
- private final RecursiveLock lock = LockFactory.createRecursiveLock(); // instance wide lock
-
- @Override
- protected final RecursiveLock getLock() { return lock; }
-
- @Override
- public final Object getUpstreamWidget() {
- return null;
- }
-
- @Override
- public void destroy() {
- defaultDestroy();
- }
-
- @Override
- public GLDrawableFactory getFactory() {
- return drawable.getFactory();
- }
-
- @Override
- public final void display() {
- final RecursiveLock _lock = lock;
- _lock.lock(); // sync: context/drawable could been recreated/destroyed while animating
- try {
- if( null != context ) {
- helper.invokeGL(drawable, context, defaultDisplayAction, defaultInitAction);
- }
- } finally {
- _lock.unlock();
- }
- }
-}
diff --git a/src/jogl/classes/jogamp/opengl/MemoryObject.java b/src/jogl/classes/jogamp/opengl/MemoryObject.java
deleted file mode 100644
index 942d62b9e..000000000
--- a/src/jogl/classes/jogamp/opengl/MemoryObject.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * Copyright 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-
-package jogamp.opengl;
-
-import java.nio.ByteBuffer;
-import java.util.HashMap;
-
-import javax.media.opengl.GLBufferStorage;
-
-import com.jogamp.common.util.HashUtil;
-
-/**
- * @deprecated No more used for GL buffer storage tracking, see {@link GLBufferStorage} and {@link GLBufferObjectTracker}.
- */
-public class MemoryObject {
- private final long addr;
- private final long size;
- private final int hash;
- private ByteBuffer buffer=null;
- public MemoryObject(final long addr, final long size) {
- this.addr = addr;
- this.size = size;
- this.hash = HashUtil.getAddrSizeHash32_EqualDist(addr, size);
- }
-
- public void setBuffer(final ByteBuffer buffer) {
- this.buffer = buffer;
- }
-
- public ByteBuffer getBuffer() {
- return this.buffer;
- }
-
- /**
- * @return the 32bit hash value generated via {@link HashUtil#getAddrSizeHash32_EqualDist(long, long)}.
- */
- @Override
- public int hashCode() {
- return hash;
- }
-
- @Override
- public String toString() {
- return "MemoryObject[addr 0x"+Long.toHexString(addr)+", size 0x"+Long.toHexString(size)+", hash32: 0x"+Integer.toHexString(hash)+"]";
- }
-
- /**
- * Ignores the optional attached <code>ByteBuffer</code> intentionally.<br>
- *
- * @return true of reference is equal or <code>obj</code> is of type <code>MemoryObject</code>
- * and <code>addr</code> and <code>size</code> is equal.<br>
- */
- public boolean equals(final Object obj) {
- if(this == obj) { return true; }
- if(obj instanceof MemoryObject) {
- final MemoryObject m = (MemoryObject) obj;
- return addr == m.addr && size == m.size ;
- }
- return false;
- }
-
- /**
- * @param map the identity HashMap, MemoryObject to MemoryObject
- * @param obj0 the MemoryObject
- * @return either the already mapped MemoryObject - not changing the map, or the newly mapped one.
- */
- public static MemoryObject getOrAddSafe(final HashMap<MemoryObject,MemoryObject> map, final MemoryObject obj0) {
- final MemoryObject obj1 = map.get(obj0); // get identity (fast)
- if(null == obj1) {
- map.put(obj0, obj0);
- return obj0;
- } else {
- return obj1;
- }
- }
-
-} \ No newline at end of file
diff --git a/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java b/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java
index 330c4f044..003b9148e 100644
--- a/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java
+++ b/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java
@@ -673,11 +673,6 @@ public class ALAudioSink implements AudioSink {
}
@Override
- public final AudioFrame enqueueData(final AudioDataFrame audioDataFrame) {
- return enqueueData(audioDataFrame.getPTS(), audioDataFrame.getData(), audioDataFrame.getByteSize());
- }
-
- @Override
public final AudioFrame enqueueData(final int pts, final ByteBuffer bytes, final int byteCount) {
if( !initialized || null == chosenFormat ) {
return null;
diff --git a/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java b/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java
index a24e77b7d..117be5489 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java
@@ -186,28 +186,22 @@ public class JavaSoundAudioSink implements AudioSink {
}
@Override
- public AudioFrame enqueueData(final AudioDataFrame audioDataFrame) {
- int byteSize = audioDataFrame.getByteSize();
- final ByteBuffer byteBuffer = audioDataFrame.getData();
- final byte[] bytes = new byte[byteSize];
+ public AudioFrame enqueueData(final int pts, final ByteBuffer byteBuffer, final int byteCount) {
+ final byte[] bytes = new byte[byteCount];
final int p = byteBuffer.position();
- byteBuffer.get(bytes, 0, byteSize);
+ byteBuffer.get(bytes, 0, byteCount);
byteBuffer.position(p);
int written = 0;
int len;
- while (byteSize > 0) {
- len = auline.write(bytes, written, byteSize);
- byteSize -= len;
+ int bytesLeft = byteCount;
+ while (bytesLeft > 0) {
+ len = auline.write(bytes, written, byteCount);
+ bytesLeft -= len;
written += len;
}
playImpl();
- return audioDataFrame;
- }
-
- @Override
- public AudioFrame enqueueData(final int pts, final ByteBuffer bytes, final int byteCount) {
- return enqueueData(new AudioDataFrame(pts, chosenFormat.getBytesDuration(byteCount), bytes, byteCount));
+ return new AudioDataFrame(pts, chosenFormat.getBytesDuration(byteCount), byteBuffer, byteCount);
}
@Override
diff --git a/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java b/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java
index 3aa9d7ab6..7e27f17c3 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java
@@ -171,11 +171,6 @@ public class NullAudioSink implements AudioSink {
}
@Override
- public AudioFrame enqueueData(final AudioDataFrame audioDataFrame) {
- return enqueueData(audioDataFrame.getPTS(), audioDataFrame.getData(), audioDataFrame.getByteSize());
- }
-
- @Override
public AudioFrame enqueueData(final int pts, final ByteBuffer bytes, final int byteCount) {
if( !initialized || null == chosenFormat ) {
return null;