From 78b4918b207e16b967e8335fb8ec1b31c706c507 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 2 Feb 2015 02:38:55 +0100 Subject: Bug 682 - Relocating javax.media.opengl.* -> com.jogamp.opengl.* (Part 2) Relocation javax.media.nativewindow.* -> com.jogamp.nativewindow.* Relocation javax.media.opengl.* -> com.jogamp.opengl.* --- src/jogl/classes/javax/media/opengl/DebugGL2.java | 21 - src/jogl/classes/javax/media/opengl/DebugGL3.java | 21 - .../classes/javax/media/opengl/DebugGL3bc.java | 21 - src/jogl/classes/javax/media/opengl/DebugGL4.java | 21 - .../classes/javax/media/opengl/DebugGLES2.java | 21 - .../media/opengl/DefaultGLCapabilitiesChooser.java | 304 --- .../classes/javax/media/opengl/FPSCounter.java | 117 - .../javax/media/opengl/GLAnimatorControl.java | 236 -- .../classes/javax/media/opengl/GLArrayData.java | 210 -- .../classes/javax/media/opengl/GLAutoDrawable.java | 636 ----- src/jogl/classes/javax/media/opengl/GLBase.java | 646 ----- .../javax/media/opengl/GLBufferStorage.java | 160 -- .../classes/javax/media/opengl/GLCapabilities.java | 512 ---- .../javax/media/opengl/GLCapabilitiesChooser.java | 62 - .../media/opengl/GLCapabilitiesImmutable.java | 178 -- src/jogl/classes/javax/media/opengl/GLContext.java | 2038 --------------- .../javax/media/opengl/GLDebugListener.java | 44 - .../classes/javax/media/opengl/GLDebugMessage.java | 253 -- .../classes/javax/media/opengl/GLDrawable.java | 251 -- .../javax/media/opengl/GLDrawableFactory.java | 798 ------ .../javax/media/opengl/GLEventListener.java | 102 - .../classes/javax/media/opengl/GLException.java | 78 - .../classes/javax/media/opengl/GLFBODrawable.java | 227 -- .../media/opengl/GLOffscreenAutoDrawable.java | 69 - .../javax/media/opengl/GLPipelineFactory.java | 207 -- src/jogl/classes/javax/media/opengl/GLProfile.java | 2322 ----------------- .../classes/javax/media/opengl/GLRunnable.java | 58 - .../classes/javax/media/opengl/GLRunnable2.java | 44 - .../javax/media/opengl/GLSharedContextSetter.java | 181 -- .../classes/javax/media/opengl/GLUniformData.java | 227 -- src/jogl/classes/javax/media/opengl/Threading.java | 226 -- src/jogl/classes/javax/media/opengl/TraceGL2.java | 23 - src/jogl/classes/javax/media/opengl/TraceGL3.java | 23 - .../classes/javax/media/opengl/TraceGL3bc.java | 23 - src/jogl/classes/javax/media/opengl/TraceGL4.java | 23 - .../classes/javax/media/opengl/TraceGLES2.java | 23 - .../javax/media/opengl/awt/AWTGLAutoDrawable.java | 51 - .../javax/media/opengl/awt/ComponentEvents.java | 75 - .../classes/javax/media/opengl/awt/GLCanvas.java | 1643 ------------ .../classes/javax/media/opengl/awt/GLJPanel.java | 2689 -------------------- .../media/opengl/fixedfunc/GLLightingFunc.java | 70 - .../javax/media/opengl/fixedfunc/GLMatrixFunc.java | 152 -- .../media/opengl/fixedfunc/GLPointerFunc.java | 61 - .../media/opengl/fixedfunc/GLPointerFuncUtil.java | 68 - .../classes/javax/media/opengl/glu/GLUnurbs.java | 8 - .../classes/javax/media/opengl/glu/GLUquadric.java | 33 - .../javax/media/opengl/glu/GLUtessellator.java | 66 - .../media/opengl/glu/GLUtessellatorCallback.java | 356 --- .../opengl/glu/GLUtessellatorCallbackAdapter.java | 96 - 49 files changed, 15774 deletions(-) delete mode 100644 src/jogl/classes/javax/media/opengl/DebugGL2.java delete mode 100644 src/jogl/classes/javax/media/opengl/DebugGL3.java delete mode 100644 src/jogl/classes/javax/media/opengl/DebugGL3bc.java delete mode 100644 src/jogl/classes/javax/media/opengl/DebugGL4.java delete mode 100644 src/jogl/classes/javax/media/opengl/DebugGLES2.java delete mode 100644 src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java delete mode 100644 src/jogl/classes/javax/media/opengl/FPSCounter.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLAnimatorControl.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLArrayData.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLAutoDrawable.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLBase.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLBufferStorage.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLCapabilities.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLContext.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLDebugListener.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLDebugMessage.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLDrawable.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLDrawableFactory.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLEventListener.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLException.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLFBODrawable.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLPipelineFactory.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLProfile.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLRunnable.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLRunnable2.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java delete mode 100644 src/jogl/classes/javax/media/opengl/GLUniformData.java delete mode 100644 src/jogl/classes/javax/media/opengl/Threading.java delete mode 100644 src/jogl/classes/javax/media/opengl/TraceGL2.java delete mode 100644 src/jogl/classes/javax/media/opengl/TraceGL3.java delete mode 100644 src/jogl/classes/javax/media/opengl/TraceGL3bc.java delete mode 100644 src/jogl/classes/javax/media/opengl/TraceGL4.java delete mode 100644 src/jogl/classes/javax/media/opengl/TraceGLES2.java delete mode 100644 src/jogl/classes/javax/media/opengl/awt/AWTGLAutoDrawable.java delete mode 100644 src/jogl/classes/javax/media/opengl/awt/ComponentEvents.java delete mode 100644 src/jogl/classes/javax/media/opengl/awt/GLCanvas.java delete mode 100644 src/jogl/classes/javax/media/opengl/awt/GLJPanel.java delete mode 100644 src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java delete mode 100644 src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java delete mode 100644 src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java delete mode 100644 src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java delete mode 100644 src/jogl/classes/javax/media/opengl/glu/GLUnurbs.java delete mode 100644 src/jogl/classes/javax/media/opengl/glu/GLUquadric.java delete mode 100644 src/jogl/classes/javax/media/opengl/glu/GLUtessellator.java delete mode 100644 src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallback.java delete mode 100644 src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java (limited to 'src/jogl/classes/javax/media/opengl') diff --git a/src/jogl/classes/javax/media/opengl/DebugGL2.java b/src/jogl/classes/javax/media/opengl/DebugGL2.java deleted file mode 100644 index dc0f0df50..000000000 --- a/src/jogl/classes/javax/media/opengl/DebugGL2.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.jogamp.opengl; - -/** - *

- * Composable pipeline which wraps an underlying {@link GL} implementation, - * providing error checking after each OpenGL method call. If an error occurs, - * causes a {@link GLException} to be thrown at exactly the point of failure. - *

- *

- * Sample code which installs this pipeline, manual: - *

- *     gl = drawable.setGL(new DebugGL(drawable.getGL()));
- * 
- * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. - *

- */ -public class DebugGL2 extends DebugGL4bc { - public DebugGL2(final GL2 downstream) { - super((GL4bc)downstream); - } -} diff --git a/src/jogl/classes/javax/media/opengl/DebugGL3.java b/src/jogl/classes/javax/media/opengl/DebugGL3.java deleted file mode 100644 index 6b27d207b..000000000 --- a/src/jogl/classes/javax/media/opengl/DebugGL3.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.jogamp.opengl; - -/** - *

- * Composable pipeline which wraps an underlying {@link GL} implementation, - * providing error checking after each OpenGL method call. If an error occurs, - * causes a {@link GLException} to be thrown at exactly the point of failure. - *

- *

- * Sample code which installs this pipeline, manual: - *

- *     gl = drawable.setGL(new DebugGL(drawable.getGL()));
- * 
- * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. - *

- */ -public class DebugGL3 extends DebugGL4bc { - public DebugGL3(final GL3 downstream) { - super((GL4bc)downstream); - } -} diff --git a/src/jogl/classes/javax/media/opengl/DebugGL3bc.java b/src/jogl/classes/javax/media/opengl/DebugGL3bc.java deleted file mode 100644 index d92f6043f..000000000 --- a/src/jogl/classes/javax/media/opengl/DebugGL3bc.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.jogamp.opengl; - -/** - *

- * Composable pipeline which wraps an underlying {@link GL} implementation, - * providing error checking after each OpenGL method call. If an error occurs, - * causes a {@link GLException} to be thrown at exactly the point of failure. - *

- *

- * Sample code which installs this pipeline, manual: - *

- *     gl = drawable.setGL(new DebugGL(drawable.getGL()));
- * 
- * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. - *

- */ -public class DebugGL3bc extends DebugGL4bc { - public DebugGL3bc(final GL3bc downstream) { - super((GL4bc)downstream); - } -} diff --git a/src/jogl/classes/javax/media/opengl/DebugGL4.java b/src/jogl/classes/javax/media/opengl/DebugGL4.java deleted file mode 100644 index 76f5a4ac3..000000000 --- a/src/jogl/classes/javax/media/opengl/DebugGL4.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.jogamp.opengl; - -/** - *

- * Composable pipeline which wraps an underlying {@link GL} implementation, - * providing error checking after each OpenGL method call. If an error occurs, - * causes a {@link GLException} to be thrown at exactly the point of failure. - *

- *

- * Sample code which installs this pipeline, manual: - *

- *     gl = drawable.setGL(new DebugGL(drawable.getGL()));
- * 
- * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. - *

- */ -public class DebugGL4 extends DebugGL4bc { - public DebugGL4(final GL4 downstream) { - super((GL4bc)downstream); - } -} diff --git a/src/jogl/classes/javax/media/opengl/DebugGLES2.java b/src/jogl/classes/javax/media/opengl/DebugGLES2.java deleted file mode 100644 index e2b280515..000000000 --- a/src/jogl/classes/javax/media/opengl/DebugGLES2.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.jogamp.opengl; - -/** - *

- * Composable pipeline which wraps an underlying {@link GL} implementation, - * providing error checking after each OpenGL method call. If an error occurs, - * causes a {@link GLException} to be thrown at exactly the point of failure. - *

- *

- * Sample code which installs this pipeline, manual: - *

- *     gl = drawable.setGL(new DebugGL(drawable.getGL()));
- * 
- * For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}. - *

- */ -public class DebugGLES2 extends DebugGLES3 { - public DebugGLES2(final GLES2 downstream) { - super((GLES3)downstream); - } -} diff --git a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java deleted file mode 100644 index 88a88087f..000000000 --- a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright (c) 2003-2009 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 com.jogamp.opengl; - -import com.jogamp.nativewindow.NativeWindowException; - -import java.util.List; - -import com.jogamp.nativewindow.CapabilitiesImmutable; - -import com.jogamp.common.ExceptionUtils; -import com.jogamp.common.util.PropertyAccess; - -import jogamp.opengl.Debug; - -/**

The default implementation of the {@link - GLCapabilitiesChooser} interface, which provides consistent visual - selection behavior across platforms. The precise algorithm is - deliberately left loosely specified. Some properties are:

- - -*/ - -public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { - private static final boolean DEBUG; - - static { - Debug.initSingleton(); - DEBUG = PropertyAccess.isPropertyDefined("jogl.debug.CapabilitiesChooser", true); - } - - private final static int NO_SCORE = -9999999; - private final static int DOUBLE_BUFFER_MISMATCH_PENALTY = 1000; - private final static int OPAQUE_MISMATCH_PENALTY = 750; - private final static int STENCIL_MISMATCH_PENALTY = 500; - private final static int MULTISAMPLE_MISMATCH_PENALTY = 500; - private final static int MULTISAMPLE_EXTENSION_MISMATCH_PENALTY = 250; // just a little drop, no scale - // Pseudo attempt to keep equal rank penalties scale-equivalent - // (e.g., stencil mismatch is 3 * accum because there are 3 accum - // components) - private final static int COLOR_MISMATCH_PENALTY_SCALE = 36; - private final static int DEPTH_MISMATCH_PENALTY_SCALE = 6; - private final static int ACCUM_MISMATCH_PENALTY_SCALE = 1; - private final static int STENCIL_MISMATCH_PENALTY_SCALE = 3; - private final static int MULTISAMPLE_MISMATCH_PENALTY_SCALE = 3; - - @Override - public int chooseCapabilities(final CapabilitiesImmutable desired, - final List available, - final int windowSystemRecommendedChoice) { - if ( null == desired ) { - throw new NativeWindowException("Null desired capabilities"); - } - if ( 0 == available.size() ) { - throw new NativeWindowException("Empty available capabilities"); - } - - final GLCapabilitiesImmutable gldes = (GLCapabilitiesImmutable) desired; - final int availnum = available.size(); - - if (DEBUG) { - ExceptionUtils.dumpStack(System.err); - System.err.println("Desired: " + gldes); - System.err.println("Available: " + availnum); - for (int i = 0; i < available.size(); i++) { - System.err.println(i + ": " + available.get(i)); - } - System.err.println("Window system's recommended choice: " + windowSystemRecommendedChoice); - } - - if (windowSystemRecommendedChoice >= 0 && - windowSystemRecommendedChoice < availnum && - null != available.get(windowSystemRecommendedChoice)) { - if (DEBUG) { - System.err.println("Choosing window system's recommended choice of " + windowSystemRecommendedChoice); - System.err.println(available.get(windowSystemRecommendedChoice)); - } - return windowSystemRecommendedChoice; - } - - // Create score array - final int[] scores = new int[availnum]; - - for (int i = 0; i < scores.length; i++) { - scores[i] = NO_SCORE; - } - final int gldes_samples = gldes.getNumSamples(); - - // Compute score for each - for (int i = 0; i < availnum; i++) { - final GLCapabilitiesImmutable cur = (GLCapabilitiesImmutable) available.get(i); - if (cur == null) { - continue; - } - if (gldes.isOnscreen() && !cur.isOnscreen()) { - continue; // requested onscreen, but n/a - } - if (!gldes.isOnscreen()) { - /** FBO is generic .. - if (gldes.isFBO() && !cur.isFBO()) { - continue; // requested FBO, but n/a - } */ - if (gldes.isPBuffer() && !cur.isPBuffer()) { - continue; // requested pBuffer, but n/a - } - if (gldes.isBitmap() && !cur.isBitmap()) { - continue; // requested pBuffer, but n/a - } - } - if (gldes.getStereo() != cur.getStereo()) { - continue; - } - final int cur_samples = cur.getNumSamples() ; - int score = 0; - - // Compute difference in color depth - // (Note that this decides the direction of all other penalties) - score += (COLOR_MISMATCH_PENALTY_SCALE * - ((cur.getRedBits() + cur.getGreenBits() + cur.getBlueBits() + cur.getAlphaBits()) - - (gldes.getRedBits() + gldes.getGreenBits() + gldes.getBlueBits() + gldes.getAlphaBits()))); - // Compute difference in depth buffer depth - score += (DEPTH_MISMATCH_PENALTY_SCALE * sign(score) * - Math.abs(cur.getDepthBits() - gldes.getDepthBits())); - // Compute difference in accumulation buffer depth - score += (ACCUM_MISMATCH_PENALTY_SCALE * sign(score) * - Math.abs((cur.getAccumRedBits() + cur.getAccumGreenBits() + cur.getAccumBlueBits() + cur.getAccumAlphaBits()) - - (gldes.getAccumRedBits() + gldes.getAccumGreenBits() + gldes.getAccumBlueBits() + gldes.getAccumAlphaBits()))); - // Compute difference in stencil bits - score += STENCIL_MISMATCH_PENALTY_SCALE * sign(score) * (cur.getStencilBits() - gldes.getStencilBits()); - // Compute difference in multisampling bits - score += MULTISAMPLE_MISMATCH_PENALTY_SCALE * sign(score) * (cur_samples - gldes_samples); - // double buffer - if (cur.getDoubleBuffered() != gldes.getDoubleBuffered()) { - score += sign(score) * DOUBLE_BUFFER_MISMATCH_PENALTY; - } - // opaque - if (cur.isBackgroundOpaque() != gldes.isBackgroundOpaque()) { - score += sign(score) * OPAQUE_MISMATCH_PENALTY; - } - if ((gldes.getStencilBits() > 0) && (cur.getStencilBits() == 0)) { - score += sign(score) * STENCIL_MISMATCH_PENALTY; - } - if (gldes_samples > 0) { - if (cur_samples == 0) { - score += sign(score) * MULTISAMPLE_MISMATCH_PENALTY; - } - if (!gldes.getSampleExtension().equals(cur.getSampleExtension())) { - score += sign(score) * MULTISAMPLE_EXTENSION_MISMATCH_PENALTY; - } - } - scores[i] = score; - } - // Now prefer hardware-accelerated visuals by pushing scores of - // non-hardware-accelerated visuals out - boolean gotHW = false; - int maxAbsoluteHWScore = 0; - for (int i = 0; i < availnum; i++) { - final int score = scores[i]; - if (score == NO_SCORE) { - continue; - } - final GLCapabilitiesImmutable cur = (GLCapabilitiesImmutable) available.get(i); - if (cur.getHardwareAccelerated()) { - final int absScore = Math.abs(score); - if (!gotHW || - (absScore > maxAbsoluteHWScore)) { - gotHW = true; - maxAbsoluteHWScore = absScore; - } - } - } - if (gotHW) { - for (int i = 0; i < availnum; i++) { - int score = scores[i]; - if (score == NO_SCORE) { - continue; - } - final GLCapabilitiesImmutable cur = (GLCapabilitiesImmutable) available.get(i); - if (!cur.getHardwareAccelerated()) { - if (score <= 0) { - score -= maxAbsoluteHWScore; - } else if (score > 0) { - score += maxAbsoluteHWScore; - } - scores[i] = score; - } - } - } - - if (DEBUG) { - System.err.print("Scores: ["); - for (int i = 0; i < availnum; i++) { - if (i > 0) { - System.err.print(","); - } - System.err.print(" " + i +": " + scores[i]); - } - System.err.println(" ]"); - } - - // Ready to select. Choose score closest to 0. - int scoreClosestToZero = NO_SCORE; - int chosenIndex = -1; - for (int i = 0; i < availnum; i++) { - final int score = scores[i]; - if (score == NO_SCORE) { - continue; - } - // Don't substitute a positive score for a smaller negative score - if ((scoreClosestToZero == NO_SCORE) || - (Math.abs(score) < Math.abs(scoreClosestToZero) && - ((sign(scoreClosestToZero) < 0) || (sign(score) > 0)))) { - scoreClosestToZero = score; - chosenIndex = i; - } - } - if (chosenIndex < 0) { - throw new NativeWindowException("Unable to select one of the provided GLCapabilities"); - } - if (DEBUG) { - System.err.println("Chosen index: " + chosenIndex); - System.err.println("Chosen capabilities:"); - System.err.println(available.get(chosenIndex)); - } - - return chosenIndex; - } - - private static int sign(final int score) { - if (score < 0) { - return -1; - } - return 1; - } - -} diff --git a/src/jogl/classes/javax/media/opengl/FPSCounter.java b/src/jogl/classes/javax/media/opengl/FPSCounter.java deleted file mode 100644 index a3b7ccb70..000000000 --- a/src/jogl/classes/javax/media/opengl/FPSCounter.java +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Copyright 2011 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 com.jogamp.opengl; - -import java.io.PrintStream; - -/** - * FPSCounter feature.
- * An implementation initially has the FPSCounter feature disabled.
- * Use {@link #setUpdateFPSFrames(int, PrintStream)} to enable and disable the FPSCounter feature. - */ -public interface FPSCounter { - public static final int DEFAULT_FRAMES_PER_INTERVAL = 5*60; - - /** - * @param frames Update interval in frames.
At every rendered frames interval the currentTime and fps values are updated. - * If the frames interval is <= 0, no update will be issued, ie the FPSCounter feature is turned off. You may choose {@link #DEFAULT_FRAMES_PER_INTERVAL}. - * @param out optional print stream where the fps values gets printed if not null at every frames interval - */ - void setUpdateFPSFrames(int frames, PrintStream out); - - /** - * Reset all performance counter (startTime, currentTime, frame number) - */ - void resetFPSCounter(); - - /** - * @return update interval in frames - * - * @see #setUpdateFPSFrames(int, PrintStream) - */ - int getUpdateFPSFrames(); - - /** - * Returns the time of the first display call in milliseconds after enabling this feature via {@link #setUpdateFPSFrames(int, PrintStream)}.
- * This value is reset via {@link #resetFPSCounter()}. - * - * @see #setUpdateFPSFrames(int, PrintStream) - * @see #resetFPSCounter() - */ - long getFPSStartTime(); - - /** - * Returns the time of the last update interval in milliseconds, if this feature is enabled via {@link #setUpdateFPSFrames(int, PrintStream)}.
- * This value is reset via {@link #resetFPSCounter()}. - * - * @see #setUpdateFPSFrames(int, PrintStream) - * @see #resetFPSCounter() - */ - long getLastFPSUpdateTime(); - - /** - * @return Duration of the last update interval in milliseconds. - * - * @see #setUpdateFPSFrames(int, PrintStream) - * @see #resetFPSCounter() - */ - long getLastFPSPeriod(); - - /** - * @return Last update interval's frames per seconds, {@link #getUpdateFPSFrames()} / {@link #getLastFPSPeriod()} - * - * @see #setUpdateFPSFrames(int, PrintStream) - * @see #resetFPSCounter() - */ - float getLastFPS(); - - /** - * @return Number of frame rendered since {@link #getFPSStartTime()} up to {@link #getLastFPSUpdateTime()} - * - * @see #setUpdateFPSFrames(int, PrintStream) - * @see #resetFPSCounter() - */ - int getTotalFPSFrames(); - - /** - * @return Total duration in milliseconds, {@link #getLastFPSUpdateTime()} - {@link #getFPSStartTime()} - * - * @see #setUpdateFPSFrames(int, PrintStream) - * @see #resetFPSCounter() - */ - long getTotalFPSDuration(); - - - /** - * @return Total frames per seconds, {@link #getTotalFPSFrames()} / {@link #getTotalFPSDuration()} - * - * @see #setUpdateFPSFrames(int, PrintStream) - * @see #resetFPSCounter() - */ - float getTotalFPS(); -} diff --git a/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java b/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java deleted file mode 100644 index 549efd569..000000000 --- a/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java +++ /dev/null @@ -1,236 +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 com.jogamp.opengl; - -/** - * An animator control interface, - * which implementation may drive a {@link com.jogamp.opengl.GLAutoDrawable} animation. - */ -public interface GLAnimatorControl extends FPSCounter { - /** - * A {@link GLAnimatorControl#setUncaughtExceptionHandler(UncaughtExceptionHandler) registered} - * {@link UncaughtExceptionHandler} instance is invoked when an {@link GLAnimatorControl animator} abruptly {@link #stop() stops} - * due to an uncaught exception from one of its {@link GLAutoDrawable}s. - * @see #uncaughtException(GLAnimatorControl, GLAutoDrawable, Throwable) - * @see GLAnimatorControl#setUncaughtExceptionHandler(UncaughtExceptionHandler) - * @since 2.2 - */ - public static interface UncaughtExceptionHandler { - /** - * Method invoked when the given {@link GLAnimatorControl} is {@link GLAnimatorControl#stop() stopped} due to the - * given uncaught exception happened on the given {@link GLAutoDrawable}. - *

- * The animator thread can still be retrieved via {@link GLAnimatorControl#getThread()}. - *

- *

- * All {@link GLAnimatorControl} states already reflect its stopped state. - *

- *

- * After this handler method is called, the {@link GLAnimatorControl} is stopped. - *

- *

- * Any exception thrown by this method will be ignored. - *

- * @param animator the {@link GLAnimatorControl} - * @param drawable the causing {@link GLAutoDrawable} - * @param cause the uncaught exception - * @see GLAnimatorControl#setUncaughtExceptionHandler(UncaughtExceptionHandler) - * @since 2.2 - */ - void uncaughtException(final GLAnimatorControl animator, final GLAutoDrawable drawable, final Throwable cause); - } - - /** - * Indicates whether this animator has been {@link #start() started}. - * - * @see #start() - * @see #stop() - * @see #isPaused() - * @see #pause() - * @see #resume() - */ - boolean isStarted(); - - /** - * Indicates whether this animator {@link #isStarted() is started} and {@link #isPaused() is not paused}. - * - * @see #start() - * @see #stop() - * @see #pause() - * @see #resume() - */ - boolean isAnimating(); - - /** - * Indicates whether this animator {@link #isStarted() is started} - * and either {@link #pause() manually paused} or paused - * automatically due to no {@link #add(GLAutoDrawable) added} {@link GLAutoDrawable}s. - * - * @see #start() - * @see #stop() - * @see #pause() - * @see #resume() - */ - boolean isPaused(); - - /** - * @return The animation thread if running, otherwise null. - * - * @see #start() - * @see #stop() - */ - Thread getThread(); - - /** - * Starts this animator, if not running. - *

- * In most situations this method blocks until - * completion, except when called from the animation thread itself - * or in some cases from an implementation-internal thread like the - * AWT event queue thread. - *

- *

- * Note that an animator w/o {@link #add(GLAutoDrawable) added drawables} - * will be paused automatically. - *

- *

- * If started, all counters (time, frames, ..) are reset to zero. - *

- * - * @return true is started due to this call, - * otherwise false, ie started already or unable to start. - * - * @see #stop() - * @see #isAnimating() - * @see #isPaused() - * @see #getThread() - */ - boolean start(); - - /** - * Stops this animator. - *

- * In most situations this method blocks until - * completion, except when called from the animation thread itself - * or in some cases from an implementation-internal thread like the - * AWT event queue thread. - *

- * - * @return true is stopped due to this call, - * otherwise false, ie not started or unable to stop. - * - * @see #start() - * @see #isAnimating() - * @see #getThread() - */ - boolean stop(); - - /** - * Pauses this animator. - *

- * In most situations this method blocks until - * completion, except when called from the animation thread itself - * or in some cases from an implementation-internal thread like the - * AWT event queue thread. - *

- * - * @return false if not started, already paused or failed to pause, otherwise true - * - * @see #resume() - * @see #isAnimating() - */ - boolean pause(); - - /** - * Resumes animation if paused. - *

- * In most situations this method blocks until - * completion, except when called from the animation thread itself - * or in some cases from an implementation-internal thread like the - * AWT event queue thread. - *

- *

- * If resumed, all counters (time, frames, ..) are reset to zero. - *

- * - * @return false if not started, not paused or unable to resume, otherwise true - * - * @see #pause() - * @see #isAnimating() - */ - boolean resume(); - - /** - * Adds a drawable to this animator's list of rendering drawables. - *

- * This allows the animator thread to become {@link #isAnimating() animating}, - * in case the first drawable is added and the animator {@link #isStarted() is started}. - *

- * - * @param drawable the drawable to be added - * @throws IllegalArgumentException if drawable was already added to this animator - */ - void add(GLAutoDrawable drawable); - - /** - * Removes a drawable from the animator's list of rendering drawables. - *

- * This method should get called in case a drawable becomes invalid, - * and will not be recovered. - *

- *

- * This allows the animator thread to become {@link #isAnimating() not animating}, - * in case the last drawable has been removed. - *

- * - * @param drawable the drawable to be removed - * @throws IllegalArgumentException if drawable was not added to this animator - */ - void remove(GLAutoDrawable drawable); - - /** - * Returns the {@link UncaughtExceptionHandler} invoked when this {@link GLAnimatorControl animator} abruptly {@link #stop() stops} - * due to an uncaught exception from one of its {@link GLAutoDrawable}s. - *

- * Default is null. - *

- * @since 2.2 - */ - UncaughtExceptionHandler getUncaughtExceptionHandler(); - - /** - * Set the handler invoked when this {@link GLAnimatorControl animator} abruptly {@link #stop() stops} - * due to an uncaught exception from one of its {@link GLAutoDrawable}s. - * @param handler the {@link UncaughtExceptionHandler} to use as this {@link GLAnimatorControl animator}'s uncaught exception - * handler. Pass null to unset the handler. - * @see UncaughtExceptionHandler#uncaughtException(GLAnimatorControl, GLAutoDrawable, Throwable) - * @since 2.2 - */ - void setUncaughtExceptionHandler(final UncaughtExceptionHandler handler); -} diff --git a/src/jogl/classes/javax/media/opengl/GLArrayData.java b/src/jogl/classes/javax/media/opengl/GLArrayData.java deleted file mode 100644 index ea2dfb0f3..000000000 --- a/src/jogl/classes/javax/media/opengl/GLArrayData.java +++ /dev/null @@ -1,210 +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 com.jogamp.opengl; - -import java.nio.Buffer; - -import com.jogamp.opengl.fixedfunc.GLPointerFunc; - -/** - * - * The total number of bytes hold by the referenced buffer is: - * getComponentSize()* getComponentNumber() * getElementNumber() - * - */ -public interface GLArrayData { - /** - * Implementation and type dependent object association. - *

- * One currently known use case is to associate a {@link com.jogamp.opengl.util.glsl.ShaderState ShaderState} - * to an GLSL aware vertex attribute object, allowing to use the ShaderState to handle it's - * data persistence, location and state change.
- * This is implicitly done via {@link com.jogamp.opengl.util.glsl.ShaderState#ownAttribute(GLArrayData, boolean) shaderState.ownAttribute(GLArrayData, boolean)}. - *

- * @param obj implementation and type dependent association - * @param enable pass true to enable the association and false to disable it. - */ - public void associate(Object obj, boolean enable); - - /** - * Returns true if this data set is intended for a GLSL vertex shader attribute, - * otherwise false, ie intended for fixed function vertex pointer - */ - public boolean isVertexAttribute(); - - /** - * The index of the predefined array index, see list below, - * or -1 in case of a shader attribute array. - * - * @see GLPointerFunc#GL_VERTEX_ARRAY - * @see GLPointerFunc#GL_NORMAL_ARRAY - * @see GLPointerFunc#GL_COLOR_ARRAY - * @see GLPointerFunc#GL_TEXTURE_COORD_ARRAY - */ - public int getIndex(); - - /** - * The name of the reflecting shader array attribute. - */ - public String getName(); - - /** - * Set a new name for this array. - *

- * This clears the location, i.e. sets it to -1. - *

- * @see #setLocation(int) - * @see #setLocation(GL2ES2, int) - */ - public void setName(String newName); - - - /** - * Returns the shader attribute location for this name, - * -1 if not yet determined - */ - public int getLocation(); - - /** - * Sets the given location of the shader attribute - * - * @return the given location - * @see com.jogamp.opengl.util.glsl.ShaderState#vertexAttribPointer(GL2ES2, GLArrayData) - */ - public int setLocation(int v); - - /** - * Retrieves the location of the shader attribute from the linked shader program. - *

- * No validation is performed within the implementation. - *

- * @param gl - * @param program - * @return ≥0 denotes a valid attribute location as found and used in the given shader program. - * <0 denotes an invalid location, i.e. not found or used in the given shader program. - */ - public int setLocation(GL2ES2 gl, int program); - - /** - * Binds the location of the shader attribute to the given location for the unlinked shader program. - *

- * No validation is performed within the implementation. - *

- * @param gl - * @param program - * @return the given location - */ - public int setLocation(GL2ES2 gl, int program, int location); - - /** - * Determines whether the data is server side (VBO) and enabled, - * or a client side array (false). - */ - public boolean isVBO(); - - /** - * The VBO buffer offset or 0 if not a VBO - */ - public long getVBOOffset(); - - /** - * The VBO name or 0 if not a VBO - */ - public int getVBOName(); - - /** - * The VBO usage or 0 if not a VBO - * @return 0 if not a GPU buffer, otherwise {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} - */ - public int getVBOUsage(); - - /** - * The VBO target or 0 if not a VBO - * @return 0 if not a GPU buffer, otherwise {@link GL#GL_ARRAY_BUFFER} or {@link GL#GL_ELEMENT_ARRAY_BUFFER} - */ - public int getVBOTarget(); - - - /** - * The Buffer holding the data, may be null if a GPU buffer without client bound data - */ - public Buffer getBuffer(); - - /** - * The number of components per element - */ - public int getComponentCount(); - - /** - * The component's GL data type, ie. GL_FLOAT - */ - public int getComponentType(); - - /** - * The component's size in bytes - */ - public int getComponentSizeInBytes(); - - /** - * The current number of used elements. - *

- * On element consist out of {@link #getComponentCount()} components. - *

- * In case the buffer's position is 0 (sealed, flipped), it's based on it's limit instead of it's position. - */ - public int getElementCount(); - - /** - * The currently used size in bytes.
- * In case the buffer's position is 0 (sealed, flipped), it's based on it's limit instead of it's position. - */ - public int getSizeInBytes(); - - /** - * True, if GL shall normalize fixed point data while converting - * them into float. - *

- * Default behavior (of the fixed function pipeline) is true - * for fixed point data type and false for floating point data types. - *

- */ - public boolean getNormalized(); - - /** - * @return the byte offset between consecutive components - */ - public int getStride(); - - @Override - public String toString(); - - public void destroy(GL gl); - -} - diff --git a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java deleted file mode 100644 index 385acf082..000000000 --- a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java +++ /dev/null @@ -1,636 +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 com.jogamp.opengl; - -import java.util.List; - -import com.jogamp.nativewindow.NativeSurface; - -import com.jogamp.common.util.locks.RecursiveLock; - -import jogamp.opengl.Debug; - -/** A higher-level abstraction than {@link GLDrawable} which supplies - an event based mechanism ({@link GLEventListener}) for performing - OpenGL rendering. A GLAutoDrawable automatically creates a primary - rendering context which is associated with the GLAutoDrawable for - the lifetime of the object. -

- Since the {@link GLContext} {@link GLContext#makeCurrent makeCurrent} - implementation is synchronized, i.e. blocks if the context - is current on another thread, the internal - {@link GLContext} for the GLAutoDrawable can be used for the event - based rendering mechanism and by end users directly. -

-
GLAutoDrawable Initialization
-

- The implementation shall initialize itself as soon as possible, - which is only possible after the attached {@link com.jogamp.nativewindow.NativeSurface NativeSurface} becomes visible and and is realized.
- The following initialization sequence should be implemented: -

- Note: The last to {@link GLEventListener} actions shall be also performed, when {@link #addGLEventListener(GLEventListener) adding} - a new one to an already initialized {@link GLAutoDrawable}. -

-
GLAutoDrawable Reconfiguration
-

- Another implementation detail is the {@link GLDrawable} reconfiguration. One use case is where a window is being - dragged to another screen with a different pixel configuration, ie {@link GLCapabilities}. The implementation - shall be able to detect such cases in conjunction with the associated {@link com.jogamp.nativewindow.NativeSurface NativeSurface}.
- For example, AWT's {@link java.awt.Canvas} 's {@link java.awt.Canvas#getGraphicsConfiguration getGraphicsConfiguration()} - is capable to determine a display device change. This is demonstrated within {@link com.jogamp.opengl.awt.GLCanvas}'s - and NEWT's AWTCanvas {@link com.jogamp.opengl.awt.GLCanvas#getGraphicsConfiguration getGraphicsConfiguration()} - specialization. Another demonstration is NEWT's {@link com.jogamp.nativewindow.NativeWindow NativeWindow} - implementation on the Windows platform, which utilizes the native platform's MonitorFromWindow(HWND) function.
- All OpenGL resources shall be regenerated, while the drawable's {@link GLCapabilities} has - to be chosen again. The following protocol shall be satisfied. -

- Note: Current graphics driver keep the surface configuration for a given window, even if the window is moved to - a monitor with a different pixel configuration, ie 32bpp to 16bpp. However, it is best to not assume such behavior - and make your application comply with the above protocol. -

- Avoiding breakage with older applications and because of the situation - mentioned above, the boolean system property jogl.screenchange.action will control the - screen change action as follows:
-

-    -Djogl.screenchange.action=false Disable the {@link GLDrawable} reconfiguration (the default)
-    -Djogl.screenchange.action=true  Enable  the {@link GLDrawable} reconfiguration
-    
-

-
GLAutoDrawable Locking
- GLAutoDrawable implementations perform locking in the following order: -
    -
  1. {@link #getUpstreamLock()}.{@link RecursiveLock#lock() lock()}
  2. -
  3. {@link #getNativeSurface()}.{@link NativeSurface#lockSurface() lockSurface()}
  4. -
- and releases the locks accordingly: -
    -
  1. {@link #getNativeSurface()}.{@link NativeSurface#unlockSurface() unlockSurface()}
  2. -
  3. {@link #getUpstreamLock()}.{@link RecursiveLock#unlock() unlock()}
  4. -
- Above locking order is mandatory to guarantee - atomicity of operation and to avoid race-conditions. - A custom implementation or user applications requiring exclusive access - shall follow the locking order. - See: - -

- */ -public interface GLAutoDrawable extends GLDrawable { - /** Flag reflecting whether the {@link GLDrawable} reconfiguration will be issued in - * case a screen device change occurred, e.g. in a multihead environment, - * where you drag the window to another monitor. */ - public static final boolean SCREEN_CHANGE_ACTION_ENABLED = Debug.getBooleanProperty("jogl.screenchange.action", true); - - /** - * If the implementation uses delegation, return the delegated {@link GLDrawable} instance, - * otherwise return this instance. - */ - public GLDrawable getDelegatedDrawable(); - - /** - * Returns the context associated with this drawable. The returned - * context will be synchronized. - * Don't rely on it's identity, the context may change. - */ - public GLContext getContext(); - - /** - * Associate the new context, newtCtx, to this auto-drawable. - *

- * Remarks: - *

- *

- * - * @param newCtx the new context, maybe null for dis-association. - * @param destroyPrevCtx if true, destroy the previous context if exists - * @return the previous GLContext, maybe null - * - * @see GLContext#setGLDrawable(GLDrawable, boolean) - * @see GLContext#setGLReadDrawable(GLDrawable) - * @see jogamp.opengl.GLDrawableHelper#switchContext(GLDrawable, GLContext, boolean, GLContext, int) - */ - public GLContext setContext(GLContext newCtx, boolean destroyPrevCtx); - - /** - * Adds the given {@link GLEventListener listener} to the end of this drawable queue. - * The {@link GLEventListener listeners} are notified of events in the order of the queue. - *

- * The newly added listener's {@link GLEventListener#init(GLAutoDrawable) init(..)} - * method will be called once before any other of it's callback methods. - * See {@link #getGLEventListenerInitState(GLEventListener)} for details. - *

- * @param listener The GLEventListener object to be inserted - */ - public void addGLEventListener(GLEventListener listener); - - /** - * Adds the given {@link GLEventListener listener} at the given index of this drawable queue. - * The {@link GLEventListener listeners} are notified of events in the order of the queue. - *

- * The newly added listener's {@link GLEventListener#init(GLAutoDrawable) init(..)} - * method will be called once before any other of it's callback methods. - * See {@link #getGLEventListenerInitState(GLEventListener)} for details. - *

- * @param index Position where the listener will be inserted. - * Should be within (0 <= index && index <= size()). - * An index value of -1 is interpreted as the end of the list, size(). - * @param listener The GLEventListener object to be inserted - * @throws IndexOutOfBoundsException If the index is not within (0 <= index && index <= size()), or -1 - */ - public void addGLEventListener(int index, GLEventListener listener) throws IndexOutOfBoundsException; - - /** - * Returns the number of {@link GLEventListener} of this drawable queue. - * @return The number of GLEventListener objects of this drawable queue. - */ - public int getGLEventListenerCount(); - - /** - * Returns true if all added {@link GLEventListener} are initialized, otherwise false. - * @since 2.2 - */ - 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()). - * An index value of -1 is interpreted as last listener, size()-1. - * @return The GLEventListener object at the given index. - * @throws IndexOutOfBoundsException If the index is not within (0 <= index && index < size()), or -1 - */ - public GLEventListener getGLEventListener(int index) throws IndexOutOfBoundsException; - - /** - * Retrieves whether the given {@link GLEventListener listener} is initialized or not. - *

- * After {@link #addGLEventListener(GLEventListener) adding} a {@link GLEventListener} it is - * marked uninitialized and added to a list of to be initialized {@link GLEventListener}. - * If such uninitialized {@link GLEventListener}'s handler methods (reshape, display) - * are about to be invoked, it's {@link GLEventListener#init(GLAutoDrawable) init(..)} method is invoked first. - * Afterwards the {@link GLEventListener} is marked initialized - * and removed from the list of to be initialized {@link GLEventListener}. - *

- *

- * This methods returns the {@link GLEventListener} initialized state, - * i.e. returns false if it is included in the list of to be initialized {@link GLEventListener}, - * otherwise true. - *

- * @param listener the GLEventListener object to query it's initialized state. - */ - public boolean getGLEventListenerInitState(GLEventListener listener); - - /** - * Sets the given {@link GLEventListener listener's} initialized state. - *

- * This methods allows manually setting the {@link GLEventListener} initialized state, - * i.e. adding it to, or removing it from the list of to be initialized {@link GLEventListener}. - * See {@link #getGLEventListenerInitState(GLEventListener)} for details. - *

- *

- * Warning: This method does not validate whether the given {@link GLEventListener listener's} - * is member of this drawable queue, i.e. {@link #addGLEventListener(GLEventListener) added}. - *

- *

- * This method is only exposed to allow users full control over the {@link GLEventListener}'s state - * and is usually not recommended to change. - *

- *

- * One use case is moving a {@link GLContext} and their initialized {@link GLEventListener} - * from one {@link GLAutoDrawable} to another, - * where a subsequent {@link GLEventListener#init(GLAutoDrawable) init(..)} call after adding it - * to the new owner is neither required nor desired. - * See {@link com.jogamp.opengl.util.GLDrawableUtil#swapGLContextAndAllGLEventListener(GLAutoDrawable, GLAutoDrawable) swapGLContextAndAllGLEventListener(..)}. - *

- * @param listener the GLEventListener object to perform a state change. - * @param initialized if true, mark the listener initialized, otherwise uninitialized. - */ - public void setGLEventListenerInitState(GLEventListener listener, boolean initialized); - - /** - * Disposes the given {@link GLEventListener listener} via {@link GLEventListener#dispose(GLAutoDrawable) dispose(..)} - * if it has been initialized and added to this queue. - *

- * If remove is true, the {@link GLEventListener} is removed from this drawable queue before disposal, - * otherwise marked uninitialized. - *

- *

- * If an {@link GLAnimatorControl} is being attached and the current thread is different - * than {@link GLAnimatorControl#getThread() the animator's thread}, it is paused during the operation. - *

- *

- * Note that this is an expensive operation, since {@link GLEventListener#dispose(GLAutoDrawable) dispose(..)} - * is decorated by {@link GLContext#makeCurrent()} and {@link GLContext#release()}. - *

- *

- * Use {@link #removeGLEventListener(GLEventListener) removeGLEventListener(listener)} instead - * if you just want to remove the {@link GLEventListener listener} and don't care about the disposal of the it's (OpenGL) resources. - *

- *

- * Also note that this is done from within a particular drawable's - * {@link GLEventListener} handler (reshape, display, etc.), that it is not - * guaranteed that all other listeners will be evaluated properly - * during this update cycle. - *

- * @param listener The GLEventListener object to be disposed and removed if remove is true - * @param remove pass true to have the listener removed from this drawable queue, otherwise pass false - * @return the disposed and/or removed GLEventListener, or null if no action was performed, i.e. listener was not added - */ - public GLEventListener disposeGLEventListener(GLEventListener listener, boolean remove); - - /** - * Removes the given {@link GLEventListener listener} from this drawable queue. - *

- * This is an inexpensive operation, since the removed listener's - * {@link GLEventListener#dispose(GLAutoDrawable) dispose(..)} method will not be called. - *

- *

- * Use {@link #disposeGLEventListener(GLEventListener, boolean) disposeGLEventListener(listener, true)} - * instead to ensure disposal of the {@link GLEventListener listener}'s (OpenGL) resources. - *

- *

- * Note that if this is done from within a particular drawable's - * {@link GLEventListener} handler (reshape, display, etc.), that it is not - * guaranteed that all other listeners will be evaluated properly - * during this update cycle. - *

- * @param listener The GLEventListener object to be removed - * @return the removed GLEventListener, or null if listener was not added - */ - public GLEventListener removeGLEventListener(GLEventListener listener); - - /** - * Registers the usage of an animator, an {@link com.jogamp.opengl.GLAnimatorControl} implementation. - * The animator will be queried whether it's animating, ie periodically issuing {@link #display()} calls or not. - *

- * This method shall be called by an animator implementation only,
- * e.g. {@link com.jogamp.opengl.util.Animator#add(com.jogamp.opengl.GLAutoDrawable)}, passing it's control implementation,
- * and {@link com.jogamp.opengl.util.Animator#remove(com.jogamp.opengl.GLAutoDrawable)}, passing null. - *

- *

- * Impacts {@link #display()} and {@link #invoke(boolean, GLRunnable)} semantics.


- * - * @param animatorControl null reference indicates no animator is using - * this GLAutoDrawable,
- * a valid reference indicates an animator is using this GLAutoDrawable. - * - * @throws GLException if an animator is already registered. - * @see #display() - * @see #invoke(boolean, GLRunnable) - * @see com.jogamp.opengl.GLAnimatorControl - */ - public abstract void setAnimator(GLAnimatorControl animatorControl) throws GLException; - - /** - * @return the registered {@link com.jogamp.opengl.GLAnimatorControl} implementation, using this GLAutoDrawable. - * - * @see #setAnimator(com.jogamp.opengl.GLAnimatorControl) - * @see com.jogamp.opengl.GLAnimatorControl - */ - public GLAnimatorControl getAnimator(); - - /** - * Dedicates this instance's {@link GLContext} to the given thread.
- * The thread will exclusively claim the {@link GLContext} via {@link #display()} and not release it - * until {@link #destroy()} or setExclusiveContextThread(null) has been called. - *

- * Default non-exclusive behavior is requested via setExclusiveContextThread(null), - * which will cause the next call of {@link #display()} on the exclusive thread to - * release the {@link GLContext}. Only after it's async release, {@link #getExclusiveContextThread()} - * will return null. - *

- *

- * To release a previous made exclusive thread, a user issues setExclusiveContextThread(null) - * and may poll {@link #getExclusiveContextThread()} until it returns null, - * while the exclusive thread is still running. - *

- *

- * Note: Setting a new exclusive thread without properly releasing a previous one - * will throw an GLException. - *

- *

- * Note: Utilizing this feature w/ AWT could lead to an AWT-EDT deadlock, depending on the AWT implementation. - * Hence it is advised not to use it with native AWT GLAutoDrawable like GLCanvas. - *

- *

- * One scenario could be to dedicate the context to the {@link GLAnimatorControl#getThread() animator thread} - * and spare redundant context switches, see {@link com.jogamp.opengl.util.AnimatorBase#setExclusiveContext(boolean)}. - *

- * @param t the exclusive thread to claim the context, or null for default operation. - * @return previous exclusive context thread - * @throws GLException If an exclusive thread is still active but a new one is attempted to be set - * @see com.jogamp.opengl.util.AnimatorBase#setExclusiveContext(boolean) - */ - public Thread setExclusiveContextThread(Thread t) throws GLException; - - /** - * @see #setExclusiveContextThread(Thread) - */ - public Thread getExclusiveContextThread(); - - /** - * Enqueues a one-shot {@link GLRunnable}, - * which will be executed within the next {@link #display()} call - * after all registered {@link GLEventListener}s - * {@link GLEventListener#display(GLAutoDrawable) display(GLAutoDrawable)} - * methods have been called. - *

- * If no {@link GLAnimatorControl} is animating (default),
- * or if the current thread is the animator thread,
- * a {@link #display()} call is issued after enqueue the GLRunnable, - * hence the {@link GLRunnable} will be executed right away.
- *

- *

- * If an {@link GLAnimatorControl animator} is running,
- * no explicit {@link #display()} call is issued, allowing the {@link GLAnimatorControl animator} to perform at due time.
- *

- *

- * If wait is true the call blocks until the glRunnable - * has been executed by the {@link GLAnimatorControl animator}, otherwise the method returns immediately. - *

- *

- * If wait is true and - * {@link #isRealized()} returns false or {@link #getContext()} returns null, - * the call is ignored and returns false.
- * This helps avoiding deadlocking the caller. - *

- *

- * The internal queue of {@link GLRunnable}'s is being flushed with {@link #destroy()} - * where all blocked callers are being notified. - *

- *

- * To avoid a deadlock situation which causes an {@link IllegalStateException} one should - * avoid issuing {@link #invoke(boolean, GLRunnable) invoke} while this GLAutoDrawable is being locked.
- * Detected deadlock situations throwing an {@link IllegalStateException} are: - *

- *

- * - * @param wait if true block until execution of glRunnable is finished, otherwise return immediately w/o waiting - * @param glRunnable the {@link GLRunnable} to execute within {@link #display()} - * @return true if the {@link GLRunnable} has been processed or queued, otherwise false. - * @throws IllegalStateException in case of a detected deadlock situation ahead, see above. - * - * @see #setAnimator(GLAnimatorControl) - * @see #display() - * @see GLRunnable - * @see #invoke(boolean, List) - * @see #flushGLRunnables() - */ - public boolean invoke(boolean wait, GLRunnable glRunnable) throws IllegalStateException ; - - /** - * Extends {@link #invoke(boolean, GLRunnable)} functionality - * allowing to inject a list of {@link GLRunnable}s. - * @param wait if true block until execution of the last glRunnable is finished, otherwise return immediately w/o waiting - * @param glRunnables the {@link GLRunnable}s to execute within {@link #display()} - * @return true if the {@link GLRunnable}s has been processed or queued, otherwise false. - * @throws IllegalStateException in case of a detected deadlock situation ahead, see {@link #invoke(boolean, GLRunnable)}. - * @see #invoke(boolean, GLRunnable) - * @see #flushGLRunnables() - */ - public boolean invoke(boolean wait, List glRunnables) throws IllegalStateException; - - /** - * Flushes all {@link #invoke(boolean, GLRunnable) enqueued} {@link GLRunnable} of this {@link GLAutoDrawable} - * including notifying waiting executor. - *

- * The executor which might have been blocked until notified - * will be unblocked and all tasks removed from the queue. - *

- * @see #invoke(boolean, GLRunnable) - * @since 2.2 - */ - public void flushGLRunnables(); - - /** Destroys all resources associated with this GLAutoDrawable, - inclusive the GLContext. - If a window is attached to it's implementation, it shall be closed. - Causes disposing of all OpenGL resources - by calling {@link GLEventListener#dispose dispose(..)} for all - registered {@link GLEventListener}s. Called automatically by the - window system toolkit upon receiving a destroy notification. This - routine may be called manually. */ - public void destroy(); - - /** - *

- * Causes OpenGL rendering to be performed for this GLAutoDrawable - * in the following order: - *

- *

- * May be called periodically by a running {@link com.jogamp.opengl.GLAnimatorControl} implementation,
- * which must register itself with {@link #setAnimator(com.jogamp.opengl.GLAnimatorControl)}.

- *

- * Called automatically by the window system toolkit upon receiving a repaint() request,
- * except an {@link com.jogamp.opengl.GLAnimatorControl} implementation {@link com.jogamp.opengl.GLAnimatorControl#isAnimating()}.

- *

- * This routine may also be called manually for better control over the - * rendering process. It is legal to call another GLAutoDrawable's - * display method from within the {@link GLEventListener#display - * display(..)} callback.

- *

- * In case of a new generated OpenGL context, - * the implementation shall call {@link GLEventListener#init init(..)} for all - * registered {@link GLEventListener}s before making the - * actual {@link GLEventListener#display display(..)} calls, - * in case this has not been done yet.

- * - * @see #setAnimator(com.jogamp.opengl.GLAnimatorControl) - */ - public void display(); - - /** Enables or disables automatic buffer swapping for this drawable. - By default this property is set to true; when true, after all - GLEventListeners have been called for a display() event, the - front and back buffers are swapped, displaying the results of - the render. When disabled, the user is responsible for calling - {@link #swapBuffers(..)} manually. */ - public void setAutoSwapBufferMode(boolean enable); - - /** Indicates whether automatic buffer swapping is enabled for this - drawable. See {@link #setAutoSwapBufferMode}. */ - public boolean getAutoSwapBufferMode(); - - /** - * @param flags Additional context creation flags. - * - * @see GLContext#setContextCreationFlags(int) - * @see GLContext#enableGLDebugMessage(boolean) - */ - public void setContextCreationFlags(int flags); - - /** - * @return Additional context creation flags - */ - public int getContextCreationFlags(); - - /** - * {@inheritDoc} - *

- * This GLAutoDrawable implementation holds it's own GLContext reference, - * thus created a GLContext using this methods won't replace it implicitly. - * To replace or set this GLAutoDrawable's GLContext you need to call {@link #setContext(GLContext, boolean)}. - *

- *

- * The GLAutoDrawable implementation shall also set the - * context creation flags as customized w/ {@link #setContextCreationFlags(int)}. - *

- */ - @Override - public GLContext createContext(GLContext shareWith); - - /** Returns the {@link GL} pipeline object this GLAutoDrawable uses. - If this method is called outside of the {@link - GLEventListener}'s callback methods (init, display, etc.) it may - return null. Users should not rely on the identity of the - returned GL object; for example, users should not maintain a - hash table with the GL object as the key. Additionally, the GL - object should not be cached in client code, but should be - re-fetched from the GLAutoDrawable at the beginning of each call - to init, display, etc. */ - public GL getGL(); - - /** Sets the {@link GL} pipeline object this GLAutoDrawable uses. - This should only be called from within the GLEventListener's - callback methods, and usually only from within the init() - method, in order to install a composable pipeline. See the JOGL - demos for examples. - @return the set GL pipeline or null if not successful */ - public GL setGL(GL gl); - - /** - * Method may return the upstream UI toolkit object - * holding this {@link GLAutoDrawable} instance, if exist. - *

- * Currently known Java UI toolkits and it's known return types are: - * - * - *
Toolkit GLAutoDrawable Implementation ~ Return Type of getUpstreamWidget() - *
NEWT {@link com.jogamp.newt.opengl.GLWindow} has a {@link com.jogamp.newt.Window} - *
SWT {@link com.jogamp.opengl.swt.GLCanvas} is a {@link org.eclipse.swt.widgets.Canvas} - *
AWT {@link com.jogamp.opengl.awt.GLCanvas} is a {@link java.awt.Canvas} - *
AWT {@link com.jogamp.opengl.awt.GLJPanel} is a {@link javax.swing.JPanel} - *
- * However, the result may be other object types than the listed above - * due to new supported toolkits. - *

- *

- * This method may also return null if no UI toolkit is being used, - * as common for offscreen rendering. - *

- */ - public Object getUpstreamWidget(); - - /** - * Returns the recursive lock object of the {@link #getUpstreamWidget() upstream widget} - * to synchronize multithreaded access on top of {@link NativeSurface#lockSurface()}. - *

- * See GLAutoDrawable Locking. - *

- * @since 2.2 - */ - public RecursiveLock getUpstreamLock(); - - /** - * Indicates whether the current thread is capable of - * performing OpenGL-related work. - *

- * Implementation utilizes this knowledge to determine - * whether {@link #display()} performs the OpenGL commands on the current thread directly - * or spawns them on the dedicated OpenGL thread. - *

- * @since 2.2 - */ - public boolean isThreadGLCapable(); - -} diff --git a/src/jogl/classes/javax/media/opengl/GLBase.java b/src/jogl/classes/javax/media/opengl/GLBase.java deleted file mode 100644 index 19b7808fc..000000000 --- a/src/jogl/classes/javax/media/opengl/GLBase.java +++ /dev/null @@ -1,646 +0,0 @@ -/** - * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. - * 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 com.jogamp.opengl; - -/** - *

The base interface from which all GL profiles derive, providing - * checked conversion down to concrete profiles, access to the - * OpenGL context associated with the GL and extension/function - * availability queries as described below.

- * - *

While the APIs for vendor extensions are unconditionally - * exposed, the underlying functions may not be present. The method - * {@link #isFunctionAvailable} should be used to query the - * availability of any non-core function before it is used for the - * first time; for example, - * gl.isFunctionAvailable("glProgramStringARB"). On - * certain platforms (Windows in particular), the most "core" - * functionality is only OpenGL 1.1, so in theory any routines first - * exposed in OpenGL 1.2, 1.3, and 1.4, 1.5, or 2.0 as well as vendor - * extensions should all be queried. Calling an unavailable function - * will cause a {@link GLException} to be raised.

- * - * {@link #isExtensionAvailable} may also be used to determine whether - * a specific extension is available before calling the routines or - * using the functionality it exposes: for example, - * gl.isExtensionAvailable("GL_ARB_vertex_program");. - * However, in this case it is up to the end user to know which - * routines or functionality are associated with which OpenGL - * extensions. It may also be used to test for the availability of a - * particular version of OpenGL: for example, - * gl.isExtensionAvailable("GL_VERSION_1_5");. - * - *

Exceptions to the window system extension naming rules: - * - *

- * - */ -public interface GLBase { - - /** - * Indicates whether this GL object conforms to any of the OpenGL profiles. - */ - public boolean isGL(); - - /** - * Indicates whether this GL object conforms to the OpenGL ≥ 4.0 compatibility profile. - * The GL4 compatibility profile includes the GL2, GL2ES1, GL2ES2, GL3, GL3bc and GL4 profile. - * @see GLContext#isGL4bc() - */ - public boolean isGL4bc(); - - /** - * Indicates whether this GL object conforms to the OpenGL ≥ 4.0 core profile. - * The GL4 core profile includes the GL2ES2, and GL3 profile. - * @see GLContext#isGL4() - */ - public boolean isGL4(); - - /** - * Indicates whether this GL object conforms to the OpenGL ≥ 3.1 compatibility profile. - * The GL3 compatibility profile includes the GL2, GL2ES1, GL2ES2 and GL3 profile. - * @see GLContext#isGL3bc() - */ - public boolean isGL3bc(); - - /** - * Indicates whether this GL object conforms to the OpenGL ≥ 3.1 core profile. - * The GL3 core profile includes the GL2ES2 profile. - * @see GLContext#isGL3() - */ - public boolean isGL3(); - - /** - * Indicates whether this GL object conforms to the OpenGL ≤ 3.0 profile. - * The GL2 profile includes the GL2ES1 and GL2ES2 profile. - * @see GLContext#isGL2() - */ - public boolean isGL2(); - - /** - * Indicates whether this GL object conforms to the OpenGL ES ≥ 1.0 profile. - * @see GLContext#isGLES1() - */ - public boolean isGLES1(); - - /** - * Indicates whether this GL object conforms to the OpenGL ES ≥ 2.0 profile. - *

- * Remark: ES2 compatible desktop profiles are not included. - * To query whether core ES2 functionality is provided, use {@link #isGLES2Compatible()}. - *

- * @see #isGLES2Compatible() - * @see GLContext#isGLES2() - */ - public boolean isGLES2(); - - /** - * Indicates whether this GL object conforms to the OpenGL ES ≥ 3.0 profile. - *

- * Remark: ES3 compatible desktop profiles are not included. - * To query whether core ES3 functionality is provided, use {@link #isGLES3Compatible()}. - *

- * @see #isGLES3Compatible() - * @see GLContext#isGLES3() - */ - public boolean isGLES3(); - - /** - * Indicates whether this GL object conforms to one of the OpenGL ES profiles, - * see {@link #isGLES1()}, {@link #isGLES2()} and {@link #isGLES3()}. - * @see GLContext#isGLES() - */ - public boolean isGLES(); - - /** - * Indicates whether this GL object conforms to a GL2ES1 compatible profile. - * @see GLContext#isGL2ES1() - */ - public boolean isGL2ES1(); - - /** - * Indicates whether this GL object conforms to a GL2ES2 compatible profile. - * @see GLContext#isGL2ES2() - */ - public boolean isGL2ES2(); - - /** - * Indicates whether this GL object conforms to a either a GL2GL3 or GL3ES3 compatible profile. - * @see GLContext#isGL2ES3() - */ - public boolean isGL2ES3(); - - /** - * Indicates whether this GL object conforms to a GL3ES3 compatible profile. - * @see GLContext#isGL3ES3() - */ - public boolean isGL3ES3(); - - /** - * Returns true if this GL object conforms to a GL4ES3 compatible profile, i.e. if {@link #isGLES3Compatible()} returns true. - *

Includes [ GL ≥ 4.3, GL ≥ 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ]

- * @see GLContext#isGL4ES3() - */ - public boolean isGL4ES3(); - - /** - * Indicates whether this GL object conforms to a GL2GL3 compatible profile. - * @see GLContext#isGL2GL3() - */ - public boolean isGL2GL3(); - - /** - * Indicates whether this GL object uses a GL4 core profile.

Includes [ GL4 ].

- * @see GLContext#isGL4core() - */ - public boolean isGL4core(); - - /** - * Indicates whether this GL object uses a GL3 core profile.

Includes [ GL4, GL3 ].

- * @see GLContext#isGL3core() - */ - public boolean isGL3core(); - - /** - * Indicates whether this GL object uses a GL core profile.

Includes [ GL4, GL3, GLES3, GL2ES2 ].

- * @see GLContext#isGLcore() - */ - public boolean isGLcore(); - - /** - * Indicates whether this GL object is compatible with the core OpenGL ES2 functionality. - * @return true if this context is an ES2 context or implements - * the extension GL_ARB_ES2_compatibility, otherwise false - * @see GLContext#isGLES2Compatible() - */ - public boolean isGLES2Compatible(); - - /** - * Indicates whether this GL object is compatible with the core OpenGL ES3 functionality. - *

- * Return true if the underlying context is an ES3 context or implements - * the extension GL_ARB_ES3_compatibility, otherwise false. - *

- *

- * Includes [ GL ≥ 4.3, GL ≥ 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ] - *

- * @see GLContext#isGLES3Compatible() - */ - public boolean isGLES3Compatible(); - - /** - * Indicates whether this GL object supports GLSL. - * @see GLContext#hasGLSL() - */ - public boolean hasGLSL(); - - /** - * Returns the downstream GL instance in case this is a wrapping pipeline, otherwise null. - *

- * See {@link #getRootGL()} for retrieving the implementing root instance. - *

- * @throws GLException if the downstream instance is not null and not a GL implementation - * @see #getRootGL() - */ - public GL getDownstreamGL() throws GLException; - - /** - * Returns the implementing root instance, considering a wrapped pipelined hierarchy, see {@link #getDownstreamGL()}. - *

- * If this instance is not a wrapping pipeline, i.e. has no downstream instance, - * this instance is returned. - *

- * @throws GLException if the root instance is not a GL implementation - */ - public GL getRootGL() throws GLException; - - /** - * Casts this object to the GL interface. - * @throws GLException if this object is not a GL implementation - */ - public GL getGL() throws GLException; - - /** - * Casts this object to the GL4bc interface. - * @throws GLException if this object is not a GL4bc implementation - */ - public GL4bc getGL4bc() throws GLException; - - /** - * Casts this object to the GL4 interface. - * @throws GLException if this object is not a GL4 implementation - */ - public GL4 getGL4() throws GLException; - - /** - * Casts this object to the GL3bc interface. - * @throws GLException if this object is not a GL3bc implementation - */ - public GL3bc getGL3bc() throws GLException; - - /** - * Casts this object to the GL3 interface. - * @throws GLException if this object is not a GL3 implementation - */ - public GL3 getGL3() throws GLException; - - /** - * Casts this object to the GL2 interface. - * @throws GLException if this object is not a GL2 implementation - */ - public GL2 getGL2() throws GLException; - - /** - * Casts this object to the GLES1 interface. - * @throws GLException if this object is not a GLES1 implementation - */ - public GLES1 getGLES1() throws GLException; - - /** - * Casts this object to the GLES2 interface. - * @throws GLException if this object is not a GLES2 implementation - */ - public GLES2 getGLES2() throws GLException; - - /** - * Casts this object to the GLES3 interface. - * @throws GLException if this object is not a GLES3 implementation - */ - public GLES3 getGLES3() throws GLException; - - /** - * Casts this object to the GL2ES1 interface. - * @throws GLException if this object is not a GL2ES1 implementation - */ - public GL2ES1 getGL2ES1() throws GLException; - - /** - * Casts this object to the GL2ES2 interface. - * @throws GLException if this object is not a GL2ES2 implementation - */ - public GL2ES2 getGL2ES2() throws GLException; - - /** - * Casts this object to the GL2ES3 interface. - * @throws GLException if this object is not a GL2ES3 implementation - */ - public GL2ES3 getGL2ES3() throws GLException; - - /** - * Casts this object to the GL3ES3 interface. - * @throws GLException if this object is not a GL3ES3 implementation - */ - public GL3ES3 getGL3ES3() throws GLException; - - /** - * Casts this object to the GL4ES3 interface. - * @throws GLException if this object is not a GL4ES3 implementation - */ - public GL4ES3 getGL4ES3() throws GLException; - - /** - * Casts this object to the GL2GL3 interface. - * @throws GLException if this object is not a GL2GL3 implementation - */ - public GL2GL3 getGL2GL3() throws GLException; - - /** - * Returns the GLProfile associated with this GL object. - */ - public GLProfile getGLProfile(); - - /** - * Returns the GLContext associated which this GL object. - */ - public GLContext getContext(); - - /** - * Returns true if the specified OpenGL core- or extension-function can be - * used successfully through this GL instance given the current host (OpenGL - * client) and display (OpenGL server) configuration.

- * By "successfully" we mean that the function is both callable - * on the machine running the program and available on the current - * display.

- * - * In order to call a function successfully, the function must be both - * callable on the machine running the program and available on - * the display device that is rendering the output (note: on non-networked, - * single-display machines these two conditions are identical; on networked and/or - * multi-display machines this becomes more complicated). These conditions are - * met if the function is either part of the core OpenGL version supported by - * both the host and display, or it is an OpenGL extension function that both - * the host and display support.

- * - * A GL function is callable if it is successfully linked at runtime, - * hence the GLContext must be made current at least once. - * - * @param glFunctionName the name of the OpenGL function (e.g., use - * "glBindRenderbufferEXT" or "glBindRenderbuffer" to check if {@link - * GL#glBindRenderbuffer(int,int)} is available). - */ - public boolean isFunctionAvailable(String glFunctionName); - - /** - * Returns true if the specified OpenGL extension can be - * used successfully through this GL instance given the current host (OpenGL - * client) and display (OpenGL server) configuration.

- * - * @param glExtensionName the name of the OpenGL extension (e.g., - * "GL_ARB_vertex_program"). - */ - public boolean isExtensionAvailable(String glExtensionName); - - /** - * Returns true if basic FBO support is available, otherwise false. - *

- * Basic FBO is supported if the context is either GL-ES >= 2.0, GL >= 3.0 [core, compat] or implements the extensions - * GL_ARB_ES2_compatibility, GL_ARB_framebuffer_object, GL_EXT_framebuffer_object or GL_OES_framebuffer_object. - *

- *

- * Basic FBO support may only include one color attachment and no multisampling, - * as well as limited internal formats for renderbuffer. - *

- * @see GLContext#hasBasicFBOSupport() - */ - public boolean hasBasicFBOSupport(); - - /** - * Returns true if full FBO support is available, otherwise false. - *

- * Full FBO is supported if the context is either GL >= core 3.0 [ES, core, compat] or implements the extensions - * ARB_framebuffer_object, or all of - * EXT_framebuffer_object, EXT_framebuffer_multisample, - * EXT_framebuffer_blit, GL_EXT_packed_depth_stencil. - *

- *

- * Full FBO support includes multiple color attachments and multisampling. - *

- * @see GLContext#hasFullFBOSupport() - */ - public boolean hasFullFBOSupport(); - - /** - * Returns the maximum number of FBO RENDERBUFFER samples - * if {@link #hasFullFBOSupport() full FBO is supported}, otherwise false. - * @see GLContext#getMaxRenderbufferSamples() - */ - public int getMaxRenderbufferSamples(); - - /** - * Returns true if the GL context supports non power of two (NPOT) textures, - * otherwise false. - *

- * NPOT textures are supported in OpenGL >= 3, GLES2 or if the - * 'GL_ARB_texture_non_power_of_two' extension is available. - *

- */ - public boolean isNPOTTextureAvailable(); - - public boolean isTextureFormatBGRA8888Available(); - - /** Provides a platform-independent way to specify the minimum swap - interval for buffer swaps. An argument of 0 disables - sync-to-vertical-refresh completely, while an argument of 1 - causes the application to wait until the next vertical refresh - until swapping buffers. The default, which is platform-specific, - is usually either 0 or 1. This function is not guaranteed to - have an effect, and in particular only affects heavyweight - onscreen components. - - @see #getSwapInterval - @throws GLException if this context is not the current - */ - public void setSwapInterval(int interval); - - /** Provides a platform-independent way to get the swap - interval set by {@link #setSwapInterval}.
- - If the interval is not set by {@link #setSwapInterval} yet, - -1 is returned, indicating that the platforms default - is being used. - - @see #setSwapInterval - */ - public int getSwapInterval(); - - /** - * Returns an object through which platform-specific OpenGL extensions - * (EGL, GLX, WGL, etc.) may be accessed. The data type of the returned - * object and its associated capabilities are undefined. Most - * applications will never need to call this method. It is highly - * recommended that any applications which do call this method perform - * all accesses on the returned object reflectively to guard - * themselves against changes to the implementation. - */ - public Object getPlatformGLExtensions(); - - /** - * Returns an object providing access to the specified OpenGL - * extension. This is intended to provide a mechanism for vendors who - * wish to provide access to new OpenGL extensions without changing - * the public API of the core package. For example, a user may request - * access to extension "GL_VENDOR_foo" and receive back an object - * which implements a vendor-specified interface which can call the - * OpenGL extension functions corresponding to that extension. It is - * up to the vendor to specify both the extension name and Java API - * for accessing it, including which class or interface contains the - * functions. - * - *

- * - * Note: it is the intent to add new extensions as quickly as possible - * to the core GL API. Therefore it is unlikely that most vendors will - * use this extension mechanism, but it is being provided for - * completeness. - */ - public Object getExtension(String extensionName); - - /** Aliased entrypoint of void {@native glClearDepth}(GLclampd depth); and void {@native glClearDepthf}(GLclampf depth); . */ - public void glClearDepth( double depth ); - - /** Aliased entrypoint of void {@native glDepthRange}(GLclampd depth); and void {@native glDepthRangef}(GLclampf depth); . */ - public void glDepthRange(double zNear, double zFar); - - /** - * @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) - */ - public int getBoundBuffer(int target); - - /** - * @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) - */ - public GLBufferStorage getBufferStorage(int bufferName); - - /** - * Returns the {@link GLBufferStorage} instance as mapped via OpenGL's native {@link GL#glMapBuffer(int, int) glMapBuffer(..)} implementation. - *

- * Throws a {@link GLException} if GL-function constraints are not met. - *

- *

- * {@link GL#glMapBuffer(int, int)} wrapper calls this method and returns {@link GLBufferStorage#getMappedBuffer()}. - *

- *

- * A zero {@link GLBufferStorage#getSize()} will avoid a native call and returns the unmapped {@link GLBufferStorage}. - *

- *

- * A null native mapping result indicating an error will - * not cause a GLException but returns the unmapped {@link GLBufferStorage}. - * This allows the user to handle this case. - *

- * @param target denotes the buffer via it's bound target - * @param access the mapping access mode - * @throws GLException if buffer is not bound to target - * @throws GLException if buffer is not tracked - * @throws GLException if buffer is already mapped - * @throws GLException if buffer has invalid store size, i.e. less-than zero - */ - public GLBufferStorage mapBuffer(int target, int access) throws GLException; - - /** - * Returns the {@link GLBufferStorage} instance as mapped via OpenGL's native {@link GL#glMapBufferRange(int, long, long, int) glMapBufferRange(..)} implementation. - *

- * Throws a {@link GLException} if GL-function constraints are not met. - *

- *

- * {@link GL#glMapBufferRange(int, long, long, int)} wrapper calls this method and returns {@link GLBufferStorage#getMappedBuffer()}. - *

- *

- * A zero {@link GLBufferStorage#getSize()} will avoid a native call and returns the unmapped {@link GLBufferStorage}. - *

- *

- * A null native mapping result indicating an error will - * not cause a GLException but returns the unmapped {@link GLBufferStorage}. - * This allows the user to handle this case. - *

- * @param target denotes the buffer via it's bound target - * @param offset offset of the mapped buffer's storage - * @param length length of the mapped buffer's storage - * @param access the mapping access mode - * @throws GLException if buffer is not bound to target - * @throws GLException if buffer is not tracked - * @throws GLException if buffer is already mapped - * @throws GLException if buffer has invalid store size, i.e. less-than zero - * @throws GLException if buffer mapping range does not fit, incl. offset - */ - public GLBufferStorage mapBufferRange(final int target, final long offset, final long length, final int access) throws GLException; - - /** - * @return true if a VBO is bound to {@link GL#GL_ARRAY_BUFFER} via {@link GL#glBindBuffer(int, int)}, otherwise false - */ - public boolean isVBOArrayBound(); - - /** - * @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(); - - /** - * Return the framebuffer name bound to this context, - * see {@link GL#glBindFramebuffer(int, int)}. - *

- * Calls {@link GLContext#getBoundFramebuffer(int)}. - *

- */ - public int getBoundFramebuffer(int target); - - /** - * Return the default draw framebuffer name. - *

- * May differ from it's default zero - * in case an framebuffer object ({@link com.jogamp.opengl.FBObject}) based drawable - * is being used. - *

- *

- * Calls {@link GLContext#getDefaultDrawFramebuffer()}. - *

- */ - public int getDefaultDrawFramebuffer(); - - /** - * Return the default read framebuffer name. - *

- * May differ from it's default zero - * in case an framebuffer object ({@link com.jogamp.opengl.FBObject}) based drawable - * is being used. - *

- *

- * Calls {@link GLContext#getDefaultReadFramebuffer()}. - *

- */ - public int getDefaultReadFramebuffer(); - - /** - * Returns the default color buffer within the current bound - * {@link #getDefaultReadFramebuffer()}, i.e. GL_READ_FRAMEBUFFER, - * which will be used as the source for pixel reading commands, - * like {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer) glReadPixels} etc. - *

- * For offscreen framebuffer objects this is {@link GL#GL_COLOR_ATTACHMENT0}, - * otherwise this is {@link GL#GL_FRONT} for single buffer configurations - * and {@link GL#GL_BACK} for double buffer configurations. - *

- *

- * Note-1: Neither ES1 nor ES2 supports selecting the read buffer via glReadBuffer - * and {@link GL#GL_BACK} is the default. - *

- *

- * Note-2: ES3 only supports {@link GL#GL_BACK}, {@link GL#GL_NONE} or {@link GL#GL_COLOR_ATTACHMENT0}+i - *

- *

- * Note-3: See {@link com.jogamp.opengl.util.GLDrawableUtil#swapBuffersBeforeRead(GLCapabilitiesImmutable) swapBuffersBeforeRead} - * for read-pixels and swap-buffers implications. - *

- *

- * Calls {@link GLContext#getDefaultReadBuffer()}. - *

- */ - public int getDefaultReadBuffer(); -} - diff --git a/src/jogl/classes/javax/media/opengl/GLBufferStorage.java b/src/jogl/classes/javax/media/opengl/GLBufferStorage.java deleted file mode 100644 index 5db97d42f..000000000 --- a/src/jogl/classes/javax/media/opengl/GLBufferStorage.java +++ /dev/null @@ -1,160 +0,0 @@ -/** - * Copyright 2014 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 com.jogamp.opengl; - -import java.nio.ByteBuffer; -import java.nio.IntBuffer; - -/** - * OpenGL buffer storage object reflecting it's - * - *

- * Buffer storage is created via: - *

- * Note that storage recreation as mentioned above also invalidate a previous storage instance, - * i.e. disposed the buffer's current storage if exist and attaches a new storage instance. - *

- *

- * Buffer storage is disposed via: - *

- *

- *

- * GL buffer storage is mapped via - *

- *

- *

- * GL buffer storage is unmapped via - *

- *

- */ -public abstract class GLBufferStorage { - private final int name; - private /* final */ long size; - private /* final */ int mutableUsage; - private /* final */ int immutableFlags; - private ByteBuffer mappedBuffer; - - protected GLBufferStorage(final int name, final long size, final int mutableUsage, final int immutableFlags) { - this.name = name; - this.size = size; - this.mutableUsage = mutableUsage; - this.immutableFlags = immutableFlags; - this.mappedBuffer = null; - } - - protected void reset(final long size, final int mutableUsage, final int immutableFlags) { - this.size = size; - this.mutableUsage = mutableUsage; - this.immutableFlags = immutableFlags; - this.mappedBuffer = null; - } - protected void setMappedBuffer(final ByteBuffer buffer) { - this.mappedBuffer = buffer; - } - - /** Return the buffer name */ - public final int getName() { return name; } - - /** Return the buffer's storage size. */ - public final long getSize() { return size; } - - /** - * Returns true if buffer's storage is mutable, i.e. - * created via {@link GL#glBufferData(int, long, java.nio.Buffer, int)}. - *

- * Returns false if buffer's storage is immutable, i.e. - * created via glBufferStorage. FIXME: Add GL 4.4 support! - *

- * @return - */ - public final boolean isMutableStorage() { return 0 != mutableUsage; } - - /** - * Returns the mutable storage usage or 0 if storage is not {@link #isMutableStorage() mutable}. - */ - public final int getMutableUsage() { return mutableUsage; } - - /** - * Returns the immutable storage flags, invalid if storage is {@link #isMutableStorage() mutable}. - */ - public final int getImmutableFlags() { return immutableFlags; } - - /** - * Returns the mapped ByteBuffer, or null if not mapped. - * Mapping may occur via: - * - */ - public final ByteBuffer getMappedBuffer() { return mappedBuffer; } - - public final String toString() { - return toString(false); - } - public final String toString(final boolean skipMappedBuffer) { - final String s0; - if( isMutableStorage() ) { - s0 = String.format("%s[name %s, size %d, mutable usage 0x%X", msgClazzName, name, size, mutableUsage); - } else { - s0 = String.format("%s[name %s, size %d, immutable flags 0x%X", msgClazzName, name, size, immutableFlags); - } - if(skipMappedBuffer) { - return s0+"]"; - } else { - return s0+", mapped "+mappedBuffer+"]"; - } - } - private static final String msgClazzName = "GLBufferStorage"; -} diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilities.java b/src/jogl/classes/javax/media/opengl/GLCapabilities.java deleted file mode 100644 index 02aa47119..000000000 --- a/src/jogl/classes/javax/media/opengl/GLCapabilities.java +++ /dev/null @@ -1,512 +0,0 @@ -/* - * Copyright (c) 2003-2009 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 com.jogamp.opengl; - -import com.jogamp.nativewindow.Capabilities; -import com.jogamp.nativewindow.CapabilitiesImmutable; - -/** Specifies a set of OpenGL capabilities.
- At creation time of a {@link GLDrawable} using {@link GLDrawableFactory}, - an instance of this class is passed, - describing the desired capabilities that a rendering context - must support, such as the OpenGL profile, color depth and whether stereo is enabled.
- - The actual capabilites of created {@link GLDrawable}s are then reflected by their own - GLCapabilites instance, which can be queried with {@link GLDrawable#getChosenGLCapabilities()}. -
- - It currently contains the minimal number of routines which allow - configuration on all supported window systems. */ -public class GLCapabilities extends Capabilities implements Cloneable, GLCapabilitiesImmutable { - private GLProfile glProfile = null; - private boolean isPBuffer = false; - private boolean isFBO = false; - private boolean doubleBuffered = true; - private boolean stereo = false; - private boolean hardwareAccelerated = true; - private int depthBits = 16; - private int stencilBits = 0; - private int accumRedBits = 0; - private int accumGreenBits = 0; - private int accumBlueBits = 0; - private int accumAlphaBits = 0; - // Shift bits from PIXELFORMATDESCRIPTOR not present because they - // are unlikely to be supported on Windows anyway - - // Support for full-scene antialiasing (FSAA) - private String sampleExtension = DEFAULT_SAMPLE_EXTENSION; - private boolean sampleBuffers = false; - private int numSamples = 2; - - /** 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. - */ - public GLCapabilities(final GLProfile glp) throws GLException { - glProfile = (null!=glp)?glp:GLProfile.getDefault(GLProfile.getDefaultDevice()); - } - - @Override - public Object cloneMutable() { - return clone(); - } - - @Override - public Object clone() { - try { - return super.clone(); - } catch (final RuntimeException e) { - throw new GLException(e); - } - } - - /** - * Copies all {@link GLCapabilitiesImmutable} values - * from source into this instance. - * @return this instance - */ - public GLCapabilities copyFrom(final GLCapabilitiesImmutable source) { - super.copyFrom(source); - glProfile = source.getGLProfile(); - isPBuffer = source.isPBuffer(); - isFBO = source.isFBO(); - doubleBuffered = source.getDoubleBuffered(); - stereo = source.getStereo(); - hardwareAccelerated = source.getHardwareAccelerated(); - depthBits = source.getDepthBits(); - stencilBits = source.getStencilBits(); - accumRedBits = source.getAccumRedBits(); - accumGreenBits = source.getAccumGreenBits(); - accumBlueBits = source.getAccumBlueBits(); - accumAlphaBits = source.getAccumAlphaBits(); - sampleBuffers = source.getSampleBuffers(); - numSamples = source.getNumSamples(); - sampleExtension = source.getSampleExtension(); - return this; - } - - @Override - public int hashCode() { - // 31 * x == (x << 5) - x - int hash = super.hashCode(); - hash = ((hash << 5) - hash) + this.glProfile.hashCode() ; - hash = ((hash << 5) - hash) + ( this.hardwareAccelerated ? 1 : 0 ); - hash = ((hash << 5) - hash) + ( this.stereo ? 1 : 0 ); - hash = ((hash << 5) - hash) + ( this.isFBO ? 1 : 0 ); - hash = ((hash << 5) - hash) + ( this.isPBuffer ? 1 : 0 ); - hash = ((hash << 5) - hash) + ( this.sampleBuffers ? 1 : 0 ); - hash = ((hash << 5) - hash) + this.getNumSamples(); - hash = ((hash << 5) - hash) + this.sampleExtension.hashCode(); - hash = ((hash << 5) - hash) + this.depthBits; - hash = ((hash << 5) - hash) + this.stencilBits; - hash = ((hash << 5) - hash) + this.accumRedBits; - hash = ((hash << 5) - hash) + this.accumGreenBits; - hash = ((hash << 5) - hash) + this.accumBlueBits; - hash = ((hash << 5) - hash) + this.accumAlphaBits; - return hash; - } - - @Override - public boolean equals(final Object obj) { - if(this == obj) { return true; } - if(!(obj instanceof GLCapabilitiesImmutable)) { - return false; - } - final GLCapabilitiesImmutable other = (GLCapabilitiesImmutable)obj; - boolean res = super.equals(obj) && - other.getGLProfile()==glProfile && - other.isPBuffer()==isPBuffer && - other.isFBO()==isFBO && - other.getDoubleBuffered() == doubleBuffered && - other.getStereo()==stereo && - other.getHardwareAccelerated()==hardwareAccelerated && - other.getDepthBits()==depthBits && - other.getStencilBits()==stencilBits && - other.getAccumRedBits()==accumRedBits && - other.getAccumGreenBits()==accumGreenBits && - other.getAccumBlueBits()==accumBlueBits && - other.getAccumAlphaBits()==accumAlphaBits && - other.getSampleBuffers()==sampleBuffers; - if(res && sampleBuffers) { - res = other.getNumSamples()==getNumSamples() && - other.getSampleExtension().equals(sampleExtension) ; - } - return res; - } - - /** comparing hw/sw, stereo, multisample, stencil, RGBA and depth only */ - @Override - public int compareTo(final CapabilitiesImmutable o) { - if ( ! ( o instanceof GLCapabilitiesImmutable ) ) { - final Class c = (null != o) ? o.getClass() : null ; - throw new ClassCastException("Not a GLCapabilitiesImmutable object, but " + c); - } - final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) o; - - if(hardwareAccelerated && !caps.getHardwareAccelerated()) { - return 1; - } else if(!hardwareAccelerated && caps.getHardwareAccelerated()) { - return -1; - } - - if(stereo && !caps.getStereo()) { - return 1; - } else if(!stereo && caps.getStereo()) { - return -1; - } - - if(doubleBuffered && !caps.getDoubleBuffered()) { - return 1; - } else if(!doubleBuffered && caps.getDoubleBuffered()) { - return -1; - } - - final int ms = getNumSamples(); - final int xms = caps.getNumSamples() ; - - if(ms > xms) { - return 1; - } else if( ms < xms ) { - return -1; - } - // ignore the sample extension - - if(stencilBits > caps.getStencilBits()) { - return 1; - } else if(stencilBits < caps.getStencilBits()) { - return -1; - } - - final int sc = super.compareTo(caps); // RGBA - if(0 != sc) { - return sc; - } - - if(depthBits > caps.getDepthBits()) { - return 1; - } else if(depthBits < caps.getDepthBits()) { - return -1; - } - - return 0; // they are equal: hw/sw, stereo, multisample, stencil, RGBA and depth - } - - @Override - public final GLProfile getGLProfile() { - return glProfile; - } - - /** Sets the GL profile you desire */ - public void setGLProfile(final GLProfile profile) { - glProfile=profile; - } - - @Override - public final boolean isPBuffer() { - return isPBuffer; - } - - /** - * Requesting offscreen pbuffer mode. - *

- * If enabled this method also invokes {@link #setOnscreen(boolean) setOnscreen(false)}. - *

- *

- * Defaults to false. - *

- *

- * Requesting offscreen pbuffer mode disables the offscreen auto selection. - *

- */ - public void setPBuffer(final boolean enable) { - if(enable) { - setOnscreen(false); - } - isPBuffer = enable; - } - - @Override - public final boolean isFBO() { - return isFBO; - } - - /** - * Requesting offscreen FBO mode. - *

- * If enabled this method also invokes {@link #setOnscreen(boolean) setOnscreen(false)}. - *

- *

- * Defaults to false. - *

- *

- * Requesting offscreen FBO mode disables the offscreen auto selection. - *

- */ - public void setFBO(final boolean enable) { - if(enable) { - setOnscreen(false); - } - isFBO = enable; - } - - @Override - public final boolean getDoubleBuffered() { - return doubleBuffered; - } - - /** Enables or disables double buffering. */ - public void setDoubleBuffered(final boolean enable) { - doubleBuffered = enable; - } - - @Override - public final boolean getStereo() { - return stereo; - } - - /** Enables or disables stereo viewing. */ - public void setStereo(final boolean enable) { - stereo = enable; - } - - @Override - public final boolean getHardwareAccelerated() { - return hardwareAccelerated; - } - - /** Enables or disables hardware acceleration. */ - public void setHardwareAccelerated(final boolean enable) { - hardwareAccelerated = enable; - } - - @Override - public final int getDepthBits() { - return depthBits; - } - - /** Sets the number of bits requested for the depth buffer. */ - public void setDepthBits(final int depthBits) { - this.depthBits = depthBits; - } - - @Override - public final int getStencilBits() { - return stencilBits; - } - - /** Sets the number of bits requested for the stencil buffer. */ - public void setStencilBits(final int stencilBits) { - this.stencilBits = stencilBits; - } - - @Override - public final int getAccumRedBits() { - return accumRedBits; - } - - /** Sets the number of bits requested for the accumulation buffer's - red component. On some systems only the accumulation buffer - depth, which is the sum of the red, green, and blue bits, is - considered. */ - public void setAccumRedBits(final int accumRedBits) { - this.accumRedBits = accumRedBits; - } - - @Override - public final int getAccumGreenBits() { - return accumGreenBits; - } - - /** Sets the number of bits requested for the accumulation buffer's - green component. On some systems only the accumulation buffer - depth, which is the sum of the red, green, and blue bits, is - considered. */ - public void setAccumGreenBits(final int accumGreenBits) { - this.accumGreenBits = accumGreenBits; - } - - @Override - public final int getAccumBlueBits() { - return accumBlueBits; - } - - /** Sets the number of bits requested for the accumulation buffer's - blue component. On some systems only the accumulation buffer - depth, which is the sum of the red, green, and blue bits, is - considered. */ - public void setAccumBlueBits(final int accumBlueBits) { - this.accumBlueBits = accumBlueBits; - } - - @Override - public final int getAccumAlphaBits() { - return accumAlphaBits; - } - - /** Sets number of bits requested for accumulation buffer's alpha - component. On some systems only the accumulation buffer depth, - which is the sum of the red, green, and blue bits, is - considered. */ - public void setAccumAlphaBits(final int accumAlphaBits) { - this.accumAlphaBits = accumAlphaBits; - } - - /** - * Sets the desired extension for full-scene antialiasing - * (FSAA), default is {@link #DEFAULT_SAMPLE_EXTENSION}. - */ - public void setSampleExtension(final String se) { - sampleExtension = se; - } - - @Override - public final String getSampleExtension() { - return sampleExtension; - } - - /** - * Defaults to false.
- * Indicates whether sample buffers for full-scene antialiasing - * (FSAA) should be allocated for this drawable.
- * Mind that this requires the alpha component.
- * If enabled this method also invokes {@link #setAlphaBits(int) setAlphaBits(1)} - * if {@link #getAlphaBits()} == 0.
- */ - public void setSampleBuffers(final boolean enable) { - sampleBuffers = enable; - if(sampleBuffers && getAlphaBits()==0) { - setAlphaBits(1); - } - } - - @Override - public final boolean getSampleBuffers() { - return sampleBuffers; - } - - /** - * If sample buffers are enabled, indicates the number of buffers - * to be allocated. Defaults to 2. - * @see #getNumSamples() - */ - public void setNumSamples(final int numSamples) { - this.numSamples = numSamples; - } - - @Override - public final int getNumSamples() { - return sampleBuffers ? numSamples : 0; - } - - @Override - public StringBuilder toString(StringBuilder sink) { - if(null == sink) { - sink = new StringBuilder(); - } - - final int samples = sampleBuffers ? numSamples : 0 ; - - super.toString(sink, false); - - sink.append(", accum-rgba ").append(accumRedBits).append(ESEP).append(accumGreenBits).append(ESEP).append(accumBlueBits).append(ESEP).append(accumAlphaBits); - sink.append(", dp/st/ms ").append(depthBits).append(ESEP).append(stencilBits).append(ESEP).append(samples); - if(samples>0) { - sink.append(", sample-ext ").append(sampleExtension); - } - if(doubleBuffered) { - sink.append(", dbl"); - } else { - sink.append(", one"); - } - if(stereo) { - sink.append(", stereo"); - } else { - sink.append(", mono "); - } - if(hardwareAccelerated) { - sink.append(", hw, "); - } else { - sink.append(", sw, "); - } - sink.append(glProfile); - if(isOnscreen()) { - sink.append(", on-scr["); - } else { - sink.append(", offscr["); - } - boolean ns=false; - if(isFBO()) { - sink.append("fbo"); - ns = true; - } - if(isPBuffer()) { - if(ns) { sink.append(CSEP); } - sink.append("pbuffer"); - ns = true; - } - if(isBitmap()) { - if(ns) { sink.append(CSEP); } - sink.append("bitmap"); - ns = true; - } - if(!ns) { // !FBO !PBuffer !Bitmap - if(isOnscreen()) { - sink.append("."); // no additional off-screen modes besides on-screen - } else { - sink.append("auto-cfg"); // auto-config off-screen mode - } - } - sink.append("]"); - - return sink; - } - - /** Returns a textual representation of this GLCapabilities - object. */ - @Override - public String toString() { - final StringBuilder msg = new StringBuilder(); - msg.append("GLCaps["); - toString(msg); - msg.append("]"); - return msg.toString(); - } -} diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java b/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java deleted file mode 100644 index 9911d1314..000000000 --- a/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2003-2009 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 com.jogamp.opengl; - -import java.util.List; - -import com.jogamp.nativewindow.CapabilitiesImmutable; -import com.jogamp.nativewindow.CapabilitiesChooser; - -import com.jogamp.opengl.GLCapabilitiesImmutable; - -/** Provides a mechanism by which applications can customize the - window type selection for a given {@link GLCapabilities}. - Developers can implement this interface and pass an instance into - the appropriate method of {@link GLDrawableFactory}; the chooser - will be called during the OpenGL context creation process. Note - that this is only a marker interface; its signature is the same as - {@link CapabilitiesChooser} and the {@link List} of - objects extending {@link CapabilitiesImmutable} - passed to {@link #chooseCapabilities chooseCapabilities} - is actually a {@link List} of type {@link GLCapabilitiesImmutable}. */ - -public interface GLCapabilitiesChooser extends CapabilitiesChooser { -} diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java b/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java deleted file mode 100644 index 25081a521..000000000 --- a/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java +++ /dev/null @@ -1,178 +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 com.jogamp.opengl; - -import com.jogamp.nativewindow.CapabilitiesImmutable; - -/** - * Specifies an immutable set of OpenGL capabilities.
- * - * @see com.jogamp.opengl.GLCapabilities - * @see com.jogamp.nativewindow.CapabilitiesImmutable - */ -public interface GLCapabilitiesImmutable extends CapabilitiesImmutable { - /** - * One of the platform's default sample extension - * EGL.EGL_SAMPLES, GLX.GLX_SAMPLES, WGLExt.WGL_SAMPLES_ARB - * if available, or any other known fallback one, ie EGLExt.EGL_COVERAGE_SAMPLES_NV - */ - public static final String DEFAULT_SAMPLE_EXTENSION = "default" ; - - /** - * Returns the GL profile you desire or used by the drawable. - */ - GLProfile getGLProfile(); - - /** - * Returns the number of bits for the accumulation - * buffer's alpha component. On some systems only the accumulation - * buffer depth, which is the sum of the red, green, and blue bits, - * is considered. - */ - int getAccumAlphaBits(); - - /** - * Returns the number of bits for the accumulation - * buffer's blue component. On some systems only the accumulation - * buffer depth, which is the sum of the red, green, and blue bits, - * is considered. - */ - int getAccumBlueBits(); - - /** - * Returns the number of bits for the accumulation - * buffer's green component. On some systems only the accumulation - * buffer depth, which is the sum of the red, green, and blue bits, - * is considered. - */ - int getAccumGreenBits(); - - /** - * Returns the number of bits for the accumulation - * buffer's red component. On some systems only the accumulation - * buffer depth, which is the sum of the red, green, and blue bits, - * is considered. - */ - int getAccumRedBits(); - - /** - * Returns the number of depth buffer bits. - */ - int getDepthBits(); - - /** - * Returns whether double-buffering is requested, available or chosen. - *

- * Default is true. - *

- */ - boolean getDoubleBuffered(); - - /** - * Returns whether hardware acceleration is requested, available or chosen. - *

- * Default is true. - *

- */ - boolean getHardwareAccelerated(); - - /** - * Returns the extension for full-scene antialiasing - * (FSAA). - *

- * Default is {@link #DEFAULT_SAMPLE_EXTENSION}. - *

- */ - String getSampleExtension(); - - /** - * Returns whether sample buffers for full-scene antialiasing - * (FSAA) should be allocated for this drawable. - *

- * Default is false. - *

- */ - boolean getSampleBuffers(); - - /** - * Returns the number of sample buffers to be allocated if sample - * buffers are enabled, otherwise returns 0. - *

- * Default is 0 due to disable sample buffers per default. - *

- */ - int getNumSamples(); - - /** - * Returns the number of stencil buffer bits. - *

- * Default is 0. - *

- */ - int getStencilBits(); - - /** - * Returns whether stereo is requested, available or chosen. - *

- * Default is false. - *

- */ - boolean getStereo(); - - /** - * Returns whether pbuffer offscreen mode is requested, available or chosen. - *

- * Default is false. - *

- *

- * For chosen capabilities, only the selected offscreen surface is set to true. - *

- */ - boolean isPBuffer(); - - /** - * Returns whether FBO offscreen mode is requested, available or chosen. - *

- * Default is false. - *

- *

- * For chosen capabilities, only the selected offscreen surface is set to true. - *

- */ - boolean isFBO(); - - @Override - boolean equals(Object obj); - - @Override - int hashCode(); - - @Override - String toString(); -} diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java deleted file mode 100644 index 6366c4e37..000000000 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ /dev/null @@ -1,2038 +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 com.jogamp.opengl; - -import java.nio.IntBuffer; -import java.util.HashMap; -import java.util.IdentityHashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import com.jogamp.nativewindow.AbstractGraphicsDevice; -import com.jogamp.nativewindow.NativeSurface; - -import jogamp.opengl.Debug; -import jogamp.opengl.GLContextImpl; -import jogamp.opengl.GLContextShareSet; - -import com.jogamp.common.os.Platform; -import com.jogamp.common.util.VersionNumber; -import com.jogamp.common.util.VersionNumberString; -import com.jogamp.common.util.locks.LockFactory; -import com.jogamp.common.util.locks.RecursiveLock; -import com.jogamp.opengl.GLExtensions; -import com.jogamp.opengl.GLRendererQuirks; - -/** Abstraction for an OpenGL rendering context. In order to perform - OpenGL rendering, a context must be "made current" on the current - thread. OpenGL rendering semantics specify that only one context - may be current on the current thread at any given time, and also - that a given context may be current on only one thread at any - given time. Because components can be added to and removed from - the component hierarchy at any time, it is possible that the - underlying OpenGL context may need to be destroyed and recreated - multiple times over the lifetime of a given component. This - process is handled by the implementation, and the GLContext - abstraction provides a stable object which clients can use to - refer to a given context. */ -public abstract class GLContext { - - public static final boolean DEBUG = Debug.debug("GLContext"); - public static final boolean TRACE_SWITCH = Debug.isPropertyDefined("jogl.debug.GLContext.TraceSwitch", true); - public static final boolean DEBUG_TRACE_SWITCH = DEBUG || TRACE_SWITCH; - - /** - * If true (default), bootstrapping the available GL profiles - * will use the highest compatible GL context for each profile, - * hence skipping querying lower profiles if a compatible higher one is found: - * - * Otherwise the dedicated GL context would be queried and used: - * - * Using aliasing speeds up initialization about: - *