From 29e70f215069643c740e1b251490aa9edd61d2cb Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Sat, 16 Jun 2012 05:33:45 +0200
Subject: Adapt to GlueGen commit 1468286bf569a493e4fdb887d5f3732f88c8cec3
(IOUtil.createTempFile(..) change)
---
.../classes/jogamp/graph/font/typecast/TypecastFontConstructor.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'src/jogl/classes/jogamp')
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java
index e8b62bdd2..0f762e79c 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java
@@ -71,7 +71,7 @@ public class TypecastFontConstructor implements FontConstructor {
int len=0;
Font f = null;
try {
- tf = IOUtil.createTempFile( "joglfont", ".ttf", null);
+ tf = IOUtil.createTempFile( "jogl.font", ".ttf", false, null);
len = IOUtil.copyURLConn2File(fconn, tf);
if(len==0) {
tf.delete();
--
cgit v1.2.3
From e8078eb70f6f82613d730ae5b8f837ccb46b81fb Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Mon, 18 Jun 2012 03:39:39 +0200
Subject: Texture Unit Tests: AWT/NEWT GL2/ES2 PNGJ/AWT-PNG-Loading and
Rendering (TestPNGTextureFromFile[AWT/NEWT])
Properly test combinations of TextureIO usage w/
- NEWT / AWT usage
- GL2 / ES2 usage
- PNG implementations: PNGJ (internal) and AWT
- adding screenshots of result for later analysis
Misc:
- IOUtil.getResource(..) usage
CLASS.class.getClassLoader() -> this.getClass().getClassLoader()
---
make/scripts/tests.sh | 15 +-
.../jogamp/opengl/util/av/NullGLMediaPlayer.java | 2 +-
.../junit/jogl/demos/TextureDraw01Accessor.java | 35 +++
.../junit/jogl/demos/TextureSequenceDemo01.java | 4 +-
.../jogl/demos/es2/TextureDraw01ES2Listener.java | 249 +++++++++++++++++++++
.../jogl/demos/es2/TextureSequenceCubeES2.java | 19 +-
.../junit/jogl/demos/es2/shader/texture01_xxx.fp | 20 ++
.../junit/jogl/demos/es2/shader/texture01_xxx.vp | 17 ++
.../jogl/demos/gl2/TextureDraw01GL2Listener.java | 104 +++++++++
.../test/junit/jogl/util/TestPNGImage01NEWT.java | 2 +-
.../texture/TestGrayTextureFromFileAWTBug417.java | 149 ------------
.../util/texture/TestPNGTextureFromFileAWT.java | 238 ++++++++++++++++++++
.../util/texture/TestPNGTextureFromFileNEWT.java | 173 ++++++++++++++
.../junit/jogl/util/texture/TestTexture01AWT.java | 3 +-
.../util/texture/TestTextureSequence01NEWT.java | 2 -
.../jogl/util/texture/TextureGL2ListenerDraw1.java | 112 ---------
16 files changed, 859 insertions(+), 285 deletions(-)
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureDraw01Accessor.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw01ES2Listener.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texture01_xxx.fp
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texture01_xxx.vp
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/TextureDraw01GL2Listener.java
delete mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGrayTextureFromFileAWTBug417.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java
create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileNEWT.java
delete mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TextureGL2ListenerDraw1.java
(limited to 'src/jogl/classes/jogamp')
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index da817d33b..c9db61564 100755
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -53,16 +53,16 @@ function jrun() {
swton=$1
shift
- #D_ARGS="-Djogamp.debug.NativeLibrary -Djogamp.debug.NativeLibrary.UseCurrentThreadLibLoader"
- #D_ARGS="-Djogl.1thread=false -Djogl.debug.Threading"
- #D_ARGS="-Djogl.1thread=true -Djogl.debug.Threading"
- #D_ARGS="-Djogl.debug.DebugGL -Djogl.debug.TraceGL -Djogl.debug.GLContext -Djogl.debug.GLContext.TraceSwitch"
- #D_ARGS="-Djogl.debug.DebugGL -Djogl.debug.TraceGL -Djogl.debug.GLContext.TraceSwitch -Djogl.debug=all"
+ #D_ARGS="-Djogl.debug.DebugGL -Djogl.debug.TraceGL"
#D_ARGS="-Djogl.debug.GLDebugMessageHandler"
#D_ARGS="-Djogl.debug.GLDebugMessageHandler -Djogl.debug.DebugGL"
#D_ARGS="-Djogl.debug.GLDebugMessageHandler -Djogl.debug.TraceGL -Djogl.debug.DebugGL -Djogl.debug.GLSLCode -Djogl.debug.GLSLState"
#D_ARGS="-Djogl.debug.GLDebugMessageHandler -Djogl.debug.DebugGL -Djogl.debug.TraceGL"
#D_ARGS="-Djogl.debug.TraceGL -Djogl.debug.DebugGL -Djogl.debug.GLSLCode"
+ #D_ARGS="-Djogamp.debug.NativeLibrary -Djogamp.debug.NativeLibrary.UseCurrentThreadLibLoader"
+ #D_ARGS="-Djogl.1thread=false -Djogl.debug.Threading"
+ #D_ARGS="-Djogl.1thread=true -Djogl.debug.Threading"
+ #D_ARGS="-Djogl.debug.DebugGL -Djogl.debug.TraceGL -Djogl.debug.GLContext.TraceSwitch -Djogl.debug=all"
#D_ARGS="-Djogamp.debug.IOUtil -Djogl.debug.GLSLCode -Djogl.debug.GLMediaPlayer"
#D_ARGS="-Djogl.debug.GLArrayData"
#D_ARGS="-Djogl.debug.EGL -Dnativewindow.debug.GraphicsConfiguration -Djogl.debug.GLDrawable"
@@ -330,11 +330,12 @@ function testawtswt() {
#
#testnoawt com.jogamp.opengl.test.junit.jogl.util.TestPNGImage01NEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.util.texture.TestTexture01AWT
-#testawt com.jogamp.opengl.test.junit.jogl.util.texture.TestGrayTextureFromFileAWTBug417
+testawt com.jogamp.opengl.test.junit.jogl.util.texture.TestPNGTextureFromFileAWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestPNGTextureFromFileNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestGLReadBufferUtilTextureIOWrite01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestGLReadBufferUtilTextureIOWrite02NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestTextureSequence01NEWT $*
-testawt com.jogamp.opengl.test.junit.jogl.util.texture.TestTextureSequence01AWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.util.texture.TestTextureSequence01AWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
diff --git a/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java
index 3d740d6b2..cd48c3962 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java
@@ -110,7 +110,7 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl {
@Override
protected void initGLStreamImpl(GL gl, int[] texNames) throws IOException {
try {
- URLConnection urlConn = IOUtil.getResource("jogl/util/data/av/test-ntsc01-160x90.png", NullGLMediaPlayer.class.getClassLoader());
+ URLConnection urlConn = IOUtil.getResource("jogl/util/data/av/test-ntsc01-160x90.png", this.getClass().getClassLoader());
if(null != urlConn) {
texData = TextureIO.newTextureData(GLProfile.getGL2ES2(), urlConn.getInputStream(), false, TextureIO.PNG);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureDraw01Accessor.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureDraw01Accessor.java
new file mode 100644
index 000000000..b9ac9faad
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureDraw01Accessor.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright 2012 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.test.junit.jogl.demos;
+
+import com.jogamp.opengl.util.texture.Texture;
+
+public interface TextureDraw01Accessor {
+ public Texture getTexture();
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureSequenceDemo01.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureSequenceDemo01.java
index a1d4b4466..6fd47e63f 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureSequenceDemo01.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureSequenceDemo01.java
@@ -6,8 +6,6 @@ import javax.media.opengl.GL;
import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
-import jogamp.opengl.util.av.NullGLMediaPlayer;
-
import com.jogamp.common.util.IOUtil;
import com.jogamp.opengl.util.texture.Texture;
import com.jogamp.opengl.util.texture.TextureData;
@@ -29,7 +27,7 @@ public class TextureSequenceDemo01 implements TextureSequence {
if(null == frame) {
TextureData texData = null;
try {
- URLConnection urlConn = IOUtil.getResource("jogl/util/data/av/test-ntsc01-160x90.png", NullGLMediaPlayer.class.getClassLoader());
+ URLConnection urlConn = IOUtil.getResource("jogl/util/data/av/test-ntsc01-160x90.png", this.getClass().getClassLoader());
if(null != urlConn) {
texData = TextureIO.newTextureData(GLProfile.getGL2ES2(), urlConn.getInputStream(), false, TextureIO.PNG);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw01ES2Listener.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw01ES2Listener.java
new file mode 100644
index 000000000..6e701658c
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw01ES2Listener.java
@@ -0,0 +1,249 @@
+/**
+ * Copyright 2012 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.test.junit.jogl.demos.es2;
+
+import java.nio.FloatBuffer;
+
+import com.jogamp.opengl.test.junit.jogl.demos.TextureDraw01Accessor;
+import com.jogamp.opengl.util.GLArrayDataServer;
+import com.jogamp.opengl.util.PMVMatrix;
+import com.jogamp.opengl.util.glsl.ShaderCode;
+import com.jogamp.opengl.util.glsl.ShaderProgram;
+import com.jogamp.opengl.util.glsl.ShaderState;
+import com.jogamp.opengl.util.texture.Texture;
+import com.jogamp.opengl.util.texture.TextureData;
+import com.jogamp.opengl.util.texture.TextureIO;
+
+import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES2;
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLEventListener;
+import javax.media.opengl.GLException;
+import javax.media.opengl.GLUniformData;
+import javax.media.opengl.fixedfunc.GLMatrixFunc;
+
+public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01Accessor {
+ TextureData textureData;
+ Texture texture;
+
+ ShaderState st;
+ PMVMatrix pmvMatrix;
+ GLUniformData pmvMatrixUniform;
+ GLArrayDataServer interleavedVBO;
+
+
+ public TextureDraw01ES2Listener(TextureData td) {
+ this.textureData = td;
+ }
+
+ static final String[] es2_prelude = { "#version 100\n", "precision mediump float;\n" };
+ static final String gl2_prelude = "#version 110\n";
+ static final String shaderBasename = "texture01_xxx";
+
+ private void initShader(GL2ES2 gl, boolean use_program) {
+ // Create & Compile the shader objects
+ ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(),
+ "shader", "shader/bin", shaderBasename, true);
+ ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(),
+ "shader", "shader/bin", shaderBasename, true);
+
+ // Prelude shader code w/ GLSL profile specifics [ 1. pre-proc, 2. other ]
+ int rsFpPos;
+ if(gl.isGLES2()) {
+ rsVp.insertShaderSource(0, 0, es2_prelude[0]);
+ rsFpPos = rsFp.insertShaderSource(0, 0, es2_prelude[0]);
+ } else {
+ rsVp.insertShaderSource(0, 0, gl2_prelude);
+ rsFpPos = rsFp.insertShaderSource(0, 0, gl2_prelude);
+ }
+ if(gl.isGLES2()) {
+ rsFpPos = rsFp.insertShaderSource(0, rsFpPos, es2_prelude[1]);
+ }
+
+ // Create & Link the shader program
+ ShaderProgram sp = new ShaderProgram();
+ sp.add(rsVp);
+ sp.add(rsFp);
+ if(!sp.link(gl, System.err)) {
+ throw new GLException("Couldn't link program: "+sp);
+ }
+
+ // Let's manage all our states using ShaderState.
+ st = new ShaderState();
+ st.attachShaderProgram(gl, sp, use_program);
+ }
+
+ public void init(GLAutoDrawable glad) {
+ if(null!=textureData) {
+ this.texture = TextureIO.newTexture(glad.getGL(), textureData);
+ }
+ GL2ES2 gl = glad.getGL().getGL2ES2();
+
+ initShader(gl, true);
+
+ // setup mgl_PMVMatrix
+ pmvMatrix = new PMVMatrix();
+ pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
+ pmvMatrix.glLoadIdentity();
+ pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
+ pmvMatrix.glLoadIdentity();
+ pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv
+
+ st.ownUniform(pmvMatrixUniform);
+ if(!st.uniform(gl, pmvMatrixUniform)) {
+ throw new GLException("Error setting PMVMatrix in shader: "+st);
+ }
+ if(!st.uniform(gl, new GLUniformData("mgl_ActiveTexture", 0))) {
+ throw new GLException("Error setting mgl_ActiveTexture in shader: "+st);
+ }
+
+ // fetch the flipped texture coordinates
+ texture.getImageTexCoords().getST_LB_RB_LT_RT(s_quadTexCoords, 0, 1f, 1f);
+
+ interleavedVBO = GLArrayDataServer.createGLSLInterleaved(3+4+2, GL.GL_FLOAT, false, 3*4, GL.GL_STATIC_DRAW);
+ {
+ interleavedVBO.addGLSLSubArray("mgl_Vertex", 3, GL.GL_ARRAY_BUFFER);
+ interleavedVBO.addGLSLSubArray("mgl_Color", 4, GL.GL_ARRAY_BUFFER);
+ //interleavedVBO.addGLSLSubArray("mgl_Normal", 3, GL.GL_ARRAY_BUFFER);
+ interleavedVBO.addGLSLSubArray("mgl_MultiTexCoord", 2, GL.GL_ARRAY_BUFFER);
+
+ FloatBuffer ib = (FloatBuffer)interleavedVBO.getBuffer();
+
+ for(int i=0; i<4; i++) {
+ ib.put(s_quadVertices, i*3, 3);
+ ib.put(s_quadColors, i*4, 4);
+ //ib.put(s_cubeNormals, i*3, 3);
+ ib.put(s_quadTexCoords, i*2, 2);
+ }
+ }
+ interleavedVBO.seal(gl, true);
+ interleavedVBO.enableBuffer(gl, false);
+ st.ownAttribute(interleavedVBO, true);
+
+ // OpenGL Render Settings
+ gl.glClearColor(0, 0, 0, 1);
+ gl.glEnable(GL2ES2.GL_DEPTH_TEST);
+ st.useProgram(gl, false);
+ }
+
+ public Texture getTexture( ) {
+ return this.texture;
+ }
+
+ /**
+ public void setTextureData(GL gl, TextureData textureData ) {
+ if(null!=texture) {
+ texture.disable(gl);
+ texture.destroy(gl);
+ }
+ if(null!=this.textureData) {
+ this.textureData.destroy();
+ }
+ this.textureData = textureData;
+ this.texture = TextureIO.newTexture(this.textureData);
+
+ // fix VBO !
+ } */
+
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ GL2ES2 gl = drawable.getGL().getGL2ES2();
+
+ gl.glViewport(0, 0, width, height);
+
+ // Clear background to white
+ gl.glClearColor(1.0f, 1.0f, 1.0f, 0.4f);
+
+ if(null != st) {
+ pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+ pmvMatrix.glLoadIdentity();
+ pmvMatrix.glOrthof(-1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 10.0f);
+
+ pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+ pmvMatrix.glLoadIdentity();
+
+ st.useProgram(gl, true);
+ st.uniform(gl, pmvMatrixUniform);
+ st.useProgram(gl, false);
+ }
+ }
+
+ public void dispose(GLAutoDrawable drawable) {
+ GL2ES2 gl = drawable.getGL().getGL2ES2();
+ if(null!=texture) {
+ texture.disable(gl);
+ texture.destroy(gl);
+ }
+ if(null!=textureData) {
+ textureData.destroy();
+ }
+
+ pmvMatrixUniform = null;
+ pmvMatrix.destroy();
+ pmvMatrix=null;
+ st.destroy(gl);
+ st=null;
+ }
+
+ public void display(GLAutoDrawable drawable) {
+ GL2ES2 gl = drawable.getGL().getGL2ES2();
+
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
+
+ st.useProgram(gl, true);
+ interleavedVBO.enableBuffer(gl, true);
+ gl.glActiveTexture(GL.GL_TEXTURE0);
+ texture.enable(gl);
+ texture.bind(gl);
+
+ gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4);
+
+ texture.disable(gl);
+ interleavedVBO.enableBuffer(gl, false);
+ st.useProgram(gl, false);
+ }
+
+ private static final float[] s_quadVertices = {
+ -1f, -1f, 0f, // LB
+ 1f, -1f, 0f, // RB
+ -1f, 1f, 0f, // LT
+ 1f, 1f, 0f // RT
+ };
+ private static final float[] s_quadColors = {
+ 1f, 1f, 1f, 1f,
+ 1f, 1f, 1f, 1f,
+ 1f, 1f, 1f, 1f,
+ 1f, 1f, 1f, 1f };
+ private static final float[] s_quadTexCoords = {
+ 0f, 0f, // LB
+ 1f, 0f, // RB
+ 0f, 1f, // LT
+ 1f, 1f // RT
+ };
+}
+
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java
index c2fbc65af..b04bd07c1 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java
@@ -146,9 +146,9 @@ public class TextureSequenceCubeES2 implements GLEventListener {
private void initShader(GL2ES2 gl) {
// Create & Compile the shader objects
- ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, TextureSequenceCubeES2.class,
+ ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(),
"shader", "shader/bin", shaderBasename, true);
- ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, TextureSequenceCubeES2.class,
+ ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(),
"shader", "shader/bin", shaderBasename, true);
// Prelude shader code w/ GLSL profile specifics [ 1. pre-proc, 2. other ]
@@ -205,7 +205,7 @@ public class TextureSequenceCubeES2 implements GLEventListener {
pmvMatrix = new PMVMatrix();
reshapePMV(drawable.getWidth(), drawable.getHeight());
- pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf());
+ pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv
if(!st.uniform(gl, pmvMatrixUniform)) {
throw new GLException("Error setting PMVMatrix in shader: "+st);
}
@@ -214,6 +214,8 @@ public class TextureSequenceCubeES2 implements GLEventListener {
}
+ // calculate centered tex coords w/ aspect ratio
+ float[] fixedCubeTexCoords = new float[s_cubeTexCoords.length];
{
final float aspect = tex.getAspectRatio();
final TextureCoords tc = tex.getImageTexCoords();
@@ -228,17 +230,16 @@ public class TextureSequenceCubeES2 implements GLEventListener {
final float tx = s_cubeTexCoords[i+0];
final float ty = s_cubeTexCoords[i+1];
if(tx!=0) {
- s_cubeTexCoords[i+0] = tc_x1 * ss;
+ fixedCubeTexCoords[i+0] = tc_x1 * ss;
}
if(ty==0 && !tex.getMustFlipVertically() || ty!=0 && tex.getMustFlipVertically()) {
- s_cubeTexCoords[i+1] = 0f + dy;
+ fixedCubeTexCoords[i+1] = 0f + dy;
} else {
- s_cubeTexCoords[i+1] = tc_y1 * ts + dy;
+ fixedCubeTexCoords[i+1] = tc_y1 * ts + dy;
}
}
}
-
-
+
interleavedVBO = GLArrayDataServer.createGLSLInterleaved(3+4+2, GL.GL_FLOAT, false, 3*6*4, GL.GL_STATIC_DRAW);
{
interleavedVBO.addGLSLSubArray("mgl_Vertex", 3, GL.GL_ARRAY_BUFFER);
@@ -252,7 +253,7 @@ public class TextureSequenceCubeES2 implements GLEventListener {
ib.put(s_cubeVertices, i*3, 3);
ib.put(s_cubeColors, i*4, 4);
//ib.put(s_cubeNormals, i*3, 3);
- ib.put(s_cubeTexCoords, i*2, 2);
+ ib.put(fixedCubeTexCoords, i*2, 2);
}
}
interleavedVBO.seal(gl, true);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texture01_xxx.fp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texture01_xxx.fp
new file mode 100644
index 000000000..1a4254163
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texture01_xxx.fp
@@ -0,0 +1,20 @@
+// Copyright 2012 JogAmp Community. All rights reserved.
+
+varying vec2 mgl_texCoord;
+varying vec4 frontColor;
+
+uniform sampler2D mgl_ActiveTexture;
+
+void main (void)
+{
+ vec4 texColor;
+ if(0.0 <= mgl_texCoord.t && mgl_texCoord.t<=1.0) {
+ texColor = texture2D(mgl_ActiveTexture, mgl_texCoord);
+ } else {
+ texColor = vec4(1, 1, 1, 1);
+ }
+
+ // mix frontColor with texture ..
+ gl_FragColor = vec4(frontColor*texColor);
+}
+
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texture01_xxx.vp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texture01_xxx.vp
new file mode 100644
index 000000000..c521e3757
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/texture01_xxx.vp
@@ -0,0 +1,17 @@
+// Copyright 2012 JogAmp Community. All rights reserved.
+
+uniform mat4 mgl_PMVMatrix[2];
+// uniform mat4 mgl_STMatrix;
+attribute vec4 mgl_Vertex;
+attribute vec4 mgl_Color;
+attribute vec4 mgl_MultiTexCoord;
+varying vec4 frontColor;
+varying vec2 mgl_texCoord;
+
+void main(void)
+{
+ frontColor=mgl_Color;
+ // mgl_texCoord = (mgl_STMatrix * mgl_MultiTexCoord).st;
+ mgl_texCoord = mgl_MultiTexCoord.st;
+ gl_Position = mgl_PMVMatrix[0] * mgl_PMVMatrix[1] * mgl_Vertex;
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/TextureDraw01GL2Listener.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/TextureDraw01GL2Listener.java
new file mode 100644
index 000000000..af30c265b
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/TextureDraw01GL2Listener.java
@@ -0,0 +1,104 @@
+/**
+ * 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.test.junit.jogl.demos.gl2;
+
+import com.jogamp.opengl.test.junit.jogl.demos.TextureDraw01Accessor;
+import com.jogamp.opengl.util.texture.Texture;
+import com.jogamp.opengl.util.texture.TextureCoords;
+import com.jogamp.opengl.util.texture.TextureData;
+import com.jogamp.opengl.util.texture.TextureIO;
+import javax.media.opengl.GL2ES1;
+import javax.media.opengl.GL2;
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLEventListener;
+import javax.media.opengl.glu.GLU;
+
+public class TextureDraw01GL2Listener implements GLEventListener, TextureDraw01Accessor {
+ private GLU glu = new GLU();
+ private TextureData textureData;
+ private Texture texture;
+
+ public TextureDraw01GL2Listener(TextureData td) {
+ this.textureData = td;
+ }
+
+ public void init(GLAutoDrawable drawable) {
+ if(null!=textureData) {
+ this.texture = TextureIO.newTexture(drawable.getGL(), textureData);
+ }
+ }
+
+ public Texture getTexture( ) {
+ return this.texture;
+ }
+
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ GL2 gl = drawable.getGL().getGL2();
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
+ gl.glLoadIdentity();
+ glu.gluOrtho2D(0, 1, 0, 1);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
+ gl.glLoadIdentity();
+ }
+
+ public void dispose(GLAutoDrawable drawable) {
+ GL2 gl = drawable.getGL().getGL2();
+ if(null!=texture) {
+ texture.disable(gl);
+ texture.destroy(gl);
+ }
+ if(null!=textureData) {
+ textureData.destroy();
+ }
+ }
+
+ public void display(GLAutoDrawable drawable) {
+ GL2 gl = drawable.getGL().getGL2();
+
+ // draw one quad with the texture
+ if(null!=texture) {
+ texture.enable(gl);
+ texture.bind(gl);
+ gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_REPLACE);
+ TextureCoords coords = texture.getImageTexCoords();
+ gl.glBegin(GL2.GL_QUADS);
+ gl.glTexCoord2f(coords.left(), coords.bottom());
+ gl.glVertex3f(0, 0, 0);
+ gl.glTexCoord2f(coords.right(), coords.bottom());
+ gl.glVertex3f(1, 0, 0);
+ gl.glTexCoord2f(coords.right(), coords.top());
+ gl.glVertex3f(1, 1, 0);
+ gl.glTexCoord2f(coords.left(), coords.top());
+ gl.glVertex3f(0, 1, 0);
+ gl.glEnd();
+ texture.disable(gl);
+ }
+ }
+}
+
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/TestPNGImage01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/TestPNGImage01NEWT.java
index 5a0c18de7..c7e975ff6 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/TestPNGImage01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/TestPNGImage01NEWT.java
@@ -18,7 +18,7 @@ public class TestPNGImage01NEWT extends UITestCase {
final File out1_f=new File(getSimpleTestName(".")+"-PNGImageTest1.png");
final File out2_f=new File(getSimpleTestName(".")+"-PNGImageTest2.png");
final String url_s="jogl/util/data/av/test-ntsc01-160x90.png";
- URLConnection urlConn = IOUtil.getResource(url_s, PNGImage.class.getClassLoader());
+ URLConnection urlConn = IOUtil.getResource(url_s, this.getClass().getClassLoader());
PNGImage image0 = PNGImage.read(urlConn.getInputStream());
System.err.println("PNGImage - Orig: "+image0);
image0.write(out1_f, true);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGrayTextureFromFileAWTBug417.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGrayTextureFromFileAWTBug417.java
deleted file mode 100644
index a1e453fda..000000000
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGrayTextureFromFileAWTBug417.java
+++ /dev/null
@@ -1,149 +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.test.junit.jogl.util.texture;
-
-
-import com.jogamp.opengl.test.junit.util.UITestCase;
-
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.awt.GLCanvas;
-import com.jogamp.opengl.util.texture.TextureIO;
-import com.jogamp.opengl.util.Animator;
-
-import java.awt.Frame;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.junit.Assert;
-import org.junit.After;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Unit test for bug 417, which shows a GLException when reading a grayscale texture.
- * Couldn't duplicate the failure, so it must have been fixed unknowingly sometime
- * after the bug was submitted.
- * @author Wade Walker
- */
-public class TestGrayTextureFromFileAWTBug417 extends UITestCase {
- static GLProfile glp;
- static GLCapabilities caps;
- InputStream textureStream;
-
- @BeforeClass
- public static void initClass() {
- if(!GLProfile.isAvailable(GLProfile.GL2GL3)) {
- UITestCase.setTestSupported(false);
- return;
- }
- glp = GLProfile.getGL2GL3();
- Assert.assertNotNull(glp);
- caps = new GLCapabilities(glp);
- Assert.assertNotNull(caps);
- }
-
- @Before
- public void initTest() {
- textureStream = TestGrayTextureFromFileAWTBug417.class.getResourceAsStream( "grayscale_texture.png" );
- Assert.assertNotNull(textureStream);
- }
-
- @After
- public void cleanupTest() {
- textureStream=null;
- }
-
- @Test
- public void test1() throws InterruptedException {
- final GLCanvas glCanvas = new GLCanvas(caps);
- final Frame frame = new Frame("Texture Test");
- Assert.assertNotNull(frame);
- frame.add(glCanvas);
- frame.setSize( 256, 128 );
-
- // load texture from file inside current GL context to match the way
- // the bug submitter was doing it
- glCanvas.addGLEventListener(new TextureGL2ListenerDraw1( null ) {
- @Override
- public void init(GLAutoDrawable drawable) {
- try {
- setTexture( TextureIO.newTexture( textureStream, true, TextureIO.PNG ) );
- }
- catch(GLException glexception) {
- glexception.printStackTrace();
- Assume.assumeNoException(glexception);
- }
- catch(IOException ioexception) {
- ioexception.printStackTrace();
- Assume.assumeNoException(ioexception);
- }
- }
- });
-
- Animator animator = new Animator(glCanvas);
- frame.setVisible(true);
- animator.start();
-
- Thread.sleep(500); // 500 ms
-
- animator.stop();
- try {
- javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
- public void run() {
- frame.setVisible(false);
- frame.remove(glCanvas);
- frame.dispose();
- }});
- } catch( Throwable throwable ) {
- throwable.printStackTrace();
- Assume.assumeNoException( throwable );
- }
- }
-
- public static void main(String args[]) throws IOException {
- String tstname = TestGrayTextureFromFileAWTBug417.class.getName();
- org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
- tstname,
- "filtertrace=true",
- "haltOnError=false",
- "haltOnFailure=false",
- "showoutput=true",
- "outputtoformatters=true",
- "logfailedtests=true",
- "logtestlistenerevents=true",
- "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter",
- "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } );
- }
-}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java
new file mode 100644
index 000000000..068732696
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java
@@ -0,0 +1,238 @@
+/**
+ * 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.test.junit.jogl.util.texture;
+
+
+import com.jogamp.common.util.IOUtil;
+import com.jogamp.opengl.test.junit.jogl.demos.TextureDraw01Accessor;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.TextureDraw01ES2Listener;
+import com.jogamp.opengl.test.junit.jogl.demos.gl2.TextureDraw01GL2Listener;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLEventListener;
+import javax.media.opengl.GLProfile;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.awt.GLCanvas;
+
+import com.jogamp.opengl.util.texture.TextureData;
+import com.jogamp.opengl.util.texture.TextureIO;
+import com.jogamp.opengl.util.texture.spi.TextureProvider;
+import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.util.GLReadBufferUtil;
+
+import java.awt.Dimension;
+import java.awt.Frame;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URLConnection;
+
+import org.junit.Assert;
+import org.junit.After;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Unit test for bug 417, which shows a GLException when reading a grayscale texture.
+ * Couldn't duplicate the failure, so it must have been fixed unknowingly sometime
+ * after the bug was submitted.
+ * @author Wade Walker, et.al.
+ */
+public class TestPNGTextureFromFileAWT extends UITestCase {
+ static boolean showFPS = false;
+ static long duration = 100; // ms
+ InputStream grayTextureStream;
+ InputStream testTextureStream;
+
+ @BeforeClass
+ public static void initClass() {
+ }
+
+ @Before
+ public void initTest() throws IOException {
+ grayTextureStream = TestPNGTextureFromFileAWT.class.getResourceAsStream( "grayscale_texture.png" );
+ Assert.assertNotNull(grayTextureStream);
+ URLConnection testTextureUrlConn = IOUtil.getResource("jogl/util/data/av/test-ntsc01-160x90.png", this.getClass().getClassLoader());
+ Assert.assertNotNull(testTextureUrlConn);
+ testTextureStream = testTextureUrlConn.getInputStream();
+ Assert.assertNotNull(testTextureStream);
+ }
+
+ @After
+ public void cleanupTest() {
+ grayTextureStream = null;
+ testTextureStream = null;
+ }
+
+ protected void snapshot(GLAutoDrawable drawable, String filename) {
+ GLReadBufferUtil screenshot = new GLReadBufferUtil(false, false);
+ if(screenshot.readPixels(drawable.getGL(), drawable, false)) {
+ screenshot.write(new File(filename));
+ }
+ }
+
+ public void testImpl(boolean useFFP, final InputStream istream, final boolean useAWTIIOP)
+ throws InterruptedException, IOException
+ {
+ GLProfile glp;
+ if(useFFP && GLProfile.isAvailable(GLProfile.GL2GL3)) {
+ glp = GLProfile.getGL2GL3();
+ } else if(!useFFP && GLProfile.isAvailable(GLProfile.GL2ES2)) {
+ glp = GLProfile.getGL2ES2();
+ } else {
+ System.err.println(getSimpleTestName(".")+": GLProfile n/a, useFFP: "+useFFP);
+ return;
+ }
+ final GLCapabilities caps = new GLCapabilities(glp);
+ final TextureData texData;
+ if(useAWTIIOP) {
+ final TextureProvider texProvider = new com.jogamp.opengl.util.texture.spi.awt.IIOTextureProvider();
+ texData = texProvider.newTextureData(glp, istream, 0 /* internalFormat */, 0 /* pixelFormat */, false /* mipmap */, TextureIO.PNG);
+ } else {
+ texData = TextureIO.newTextureData(glp, istream, false /* mipmap */, TextureIO.PNG);
+ }
+ System.err.println("TextureData: "+texData);
+
+ final GLCanvas glc = new GLCanvas(caps);
+ Dimension glc_sz = new Dimension(texData.getWidth(), texData.getHeight());
+ glc.setMinimumSize(glc_sz);
+ glc.setPreferredSize(glc_sz);
+ final Frame frame = new Frame("TestPNGTextureGL2FromFileAWT");
+ Assert.assertNotNull(frame);
+ frame.add(glc);
+
+ // load texture from file inside current GL context to match the way
+ // the bug submitter was doing it
+ final GLEventListener gle = useFFP ? new TextureDraw01GL2Listener( texData ) : new TextureDraw01ES2Listener( texData ) ;
+ glc.addGLEventListener(gle);
+ glc.addGLEventListener(new GLEventListener() {
+ boolean shot = false;
+
+ @Override public void init(GLAutoDrawable drawable) {}
+
+ @Override
+ public void display(GLAutoDrawable drawable) {
+ // 1 snapshot
+ if(null!=((TextureDraw01Accessor)gle).getTexture() && !shot) {
+ shot = true;
+ snapshot(drawable, getSimpleTestName(".")+".png");
+ }
+ }
+
+ @Override public void dispose(GLAutoDrawable drawable) { }
+ @Override public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { }
+ });
+
+ Animator animator = new Animator(glc);
+ animator.setUpdateFPSFrames(60, showFPS ? System.err : null);
+ QuitAdapter quitAdapter = new QuitAdapter();
+ new com.jogamp.newt.event.awt.AWTKeyAdapter(quitAdapter).addTo(glc);
+ new com.jogamp.newt.event.awt.AWTWindowAdapter(quitAdapter).addTo(glc);
+ try {
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.pack();
+ frame.setVisible(true);
+ }});
+ } catch( Throwable throwable ) {
+ throwable.printStackTrace();
+ Assume.assumeNoException( throwable );
+ }
+ animator.start();
+
+ while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()
Date: Thu, 21 Jun 2012 20:14:46 +0200
Subject: JOGL CapabilitiesChooser-API and impl.: Cleanup using generics: 'List
l' -> 'List extends CapabilitiesImmutable> l'
---
.../media/opengl/DefaultGLCapabilitiesChooser.java | 9 ++++----
.../javax/media/opengl/GLCapabilitiesChooser.java | 12 ++++++++---
.../opengl/GLGraphicsConfigurationFactory.java | 2 +-
.../jogamp/opengl/GLGraphicsConfigurationUtil.java | 5 ++---
.../opengl/egl/EGLGraphicsConfiguration.java | 5 +++--
.../egl/EGLGraphicsConfigurationFactory.java | 12 +++++------
.../wgl/WindowsWGLGraphicsConfiguration.java | 24 +++++++++++-----------
.../WindowsWGLGraphicsConfigurationFactory.java | 14 ++++++-------
.../x11/glx/X11GLXGraphicsConfiguration.java | 7 ++++---
.../glx/X11GLXGraphicsConfigurationFactory.java | 4 ++--
.../media/nativewindow/CapabilitiesChooser.java | 2 +-
.../nativewindow/DefaultCapabilitiesChooser.java | 4 ++--
.../test/junit/jogl/caps/MultisampleChooser01.java | 7 ++++++-
13 files changed, 60 insertions(+), 47 deletions(-)
(limited to 'src/jogl/classes/jogamp')
diff --git a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
index f678c709e..b57b85e5c 100644
--- a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
+++ b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
@@ -102,8 +102,9 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
final static int STENCIL_MISMATCH_PENALTY_SCALE = 3;
final static int MULTISAMPLE_MISMATCH_PENALTY_SCALE = 3;
+ @Override
public int chooseCapabilities(final CapabilitiesImmutable desired,
- final List /**/ available,
+ final List extends CapabilitiesImmutable> available,
final int windowSystemRecommendedChoice) {
if ( null == desired ) {
throw new NativeWindowException("Null desired capabilities");
@@ -144,7 +145,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
// Compute score for each
for (int i = 0; i < availnum; i++) {
- GLCapabilitiesImmutable cur = (GLCapabilitiesImmutable) available.get(i);
+ final GLCapabilitiesImmutable cur = (GLCapabilitiesImmutable) available.get(i);
if (cur == null) {
continue;
}
@@ -207,7 +208,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
if (score == NO_SCORE) {
continue;
}
- GLCapabilitiesImmutable cur = (GLCapabilitiesImmutable) available.get(i);
+ final GLCapabilitiesImmutable cur = (GLCapabilitiesImmutable) available.get(i);
if (cur.getHardwareAccelerated()) {
int absScore = Math.abs(score);
if (!gotHW ||
@@ -223,7 +224,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
if (score == NO_SCORE) {
continue;
}
- GLCapabilitiesImmutable cur = (GLCapabilitiesImmutable) available.get(i);
+ final GLCapabilitiesImmutable cur = (GLCapabilitiesImmutable) available.get(i);
if (!cur.getHardwareAccelerated()) {
if (score <= 0) {
score -= maxAbsoluteHWScore;
diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java b/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java
index 73a77de27..5d575c2ee 100644
--- a/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java
+++ b/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java
@@ -40,17 +40,23 @@
package javax.media.opengl;
+import java.util.List;
+
+import javax.media.nativewindow.CapabilitiesImmutable;
import javax.media.nativewindow.CapabilitiesChooser;
+import javax.media.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}, but the array of {@link Capabilities}
- objects passed to {@link #chooseCapabilities chooseCapabilities}
- will actually be an array of {@link GLCapabilities}. */
+ {@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/jogamp/opengl/GLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java
index 6fe9f080c..5c6b475b2 100644
--- a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java
@@ -38,7 +38,7 @@ import javax.media.opengl.DefaultGLCapabilitiesChooser;
public abstract class GLGraphicsConfigurationFactory extends GraphicsConfigurationFactory {
protected static int chooseCapabilities(CapabilitiesChooser chooser, CapabilitiesImmutable capsRequested,
- List /**/ availableCaps, int recommendedIndex) {
+ List extends CapabilitiesImmutable> availableCaps, int recommendedIndex) {
if (null == capsRequested) {
throw new NativeWindowException("Null requested capabilities");
}
diff --git a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java
index d7958c7f1..b7c15bfda 100644
--- a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java
+++ b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java
@@ -28,7 +28,7 @@
package jogamp.opengl;
-import java.util.ArrayList;
+import java.util.List;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLCapabilitiesImmutable;
@@ -87,8 +87,7 @@ public class GLGraphicsConfigurationUtil {
return getWinAttributeBits(caps.isOnscreen(), caps.isPBuffer());
}
- @SuppressWarnings({ "rawtypes", "unchecked" })
- public static final boolean addGLCapabilitiesPermutations(ArrayList capsBucket, GLCapabilitiesImmutable temp, int winattrbits) {
+ public static final boolean addGLCapabilitiesPermutations(List capsBucket, GLCapabilitiesImmutable temp, int winattrbits) {
int preSize = capsBucket.size();
if( 0 != ( WINDOW_BIT & winattrbits ) ) {
GLCapabilities cpy = (GLCapabilities) temp.cloneMutable();
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
index 875bcb95b..56e7a4d22 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
@@ -38,6 +38,7 @@ package jogamp.opengl.egl;
import java.nio.IntBuffer;
import java.util.ArrayList;
+import java.util.List;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.AbstractGraphicsScreen;
@@ -149,7 +150,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
public static EGLGLCapabilities EGLConfig2Capabilities(GLProfile glp, long display, long config,
boolean relaxed, boolean onscreen, boolean usePBuffer, boolean forceTransparentFlag) {
- ArrayList bucket = new ArrayList();
+ List bucket = new ArrayList();
final int winattrmask = GLGraphicsConfigurationUtil.getWinAttributeBits(onscreen, usePBuffer);
if( EGLConfig2Capabilities(bucket, glp, display, config, winattrmask, forceTransparentFlag) ) {
return (EGLGLCapabilities) bucket.get(0);
@@ -159,7 +160,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
return null;
}
- public static boolean EGLConfig2Capabilities(ArrayList capsBucket,
+ public static boolean EGLConfig2Capabilities(List capsBucket,
GLProfile glp, long display, long config,
int winattrmask, boolean forceTransparentFlag) {
final int allDrawableTypeBits = EGLConfigDrawableTypeBits(display, config);
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
index 904110eb2..5ab2632c6 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
@@ -181,7 +181,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
EGLGraphicsDevice eglDevice = sharedResource.getDevice();
long eglDisplay = eglDevice.getHandle();
- List/**/ availableCaps = null;
+ List availableCaps = null;
IntBuffer numConfigs = Buffers.newDirectIntBuffer(1);
if(!EGL.eglGetConfigs(eglDisplay, null, 0, numConfigs)) {
@@ -316,7 +316,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
final boolean onscreen = capsChosen.isOnscreen();
final boolean usePBuffer = capsChosen.isPBuffer();
final int winattrmask = GLGraphicsConfigurationUtil.getWinAttributeBits(onscreen, usePBuffer);
- List/**/ availableCaps = null;
+ List availableCaps = null;
int recommendedIndex = -1;
long recommendedEGLConfig = -1;
IntBuffer numConfigs = Buffers.newDirectIntBuffer(1);
@@ -388,7 +388,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
}
if( VisualIDHolder.VID_UNDEFINED != nativeVisualID ) {
- List/**/ removedCaps = new ArrayList();
+ List removedCaps = new ArrayList();
for(int i=0; i*/ eglConfigs2GLCaps(GLProfile glp, long eglDisplay, PointerBuffer configs, int num, int winattrmask, boolean forceTransparentFlag) {
- ArrayList caps = new ArrayList(num);
+ static List eglConfigs2GLCaps(GLProfile glp, long eglDisplay, PointerBuffer configs, int num, int winattrmask, boolean forceTransparentFlag) {
+ List caps = new ArrayList(num);
for(int i=0; i caps, PrintStream out) {
for(int i=0; i bucket = new ArrayList(1);
+ List bucket = new ArrayList(1);
final int winattrbits = GLGraphicsConfigurationUtil.getWinAttributeBits(onscreen, usePBuffer);
if(AttribList2GLCapabilities(bucket, glp, hdc, pfdID, iattributes, niattribs, iresults, winattrbits)) {
- return bucket.get(0);
+ return (WGLGLCapabilities) bucket.get(0);
}
return null;
}
@@ -372,19 +372,19 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
return pformats;
}
- static List /**/ wglARBPFIDs2GLCapabilities(WindowsWGLDrawableFactory.SharedResource sharedResource,
- long hdc, int[] pfdIDs, GLProfile glp, boolean onscreen, boolean usePBuffer) {
+ static List wglARBPFIDs2GLCapabilities(WindowsWGLDrawableFactory.SharedResource sharedResource,
+ long hdc, int[] pfdIDs, GLProfile glp, boolean onscreen, boolean usePBuffer) {
final int winattrbits = GLGraphicsConfigurationUtil.getWinAttributeBits(onscreen, usePBuffer);
return wglARBPFIDs2GLCapabilitiesImpl(sharedResource, hdc, pfdIDs, glp, winattrbits);
}
- static List /**/ wglARBPFIDs2AllGLCapabilities(WindowsWGLDrawableFactory.SharedResource sharedResource,
- long hdc, int[] pfdIDs, GLProfile glp) {
+ static List wglARBPFIDs2AllGLCapabilities(WindowsWGLDrawableFactory.SharedResource sharedResource,
+ long hdc, int[] pfdIDs, GLProfile glp) {
return wglARBPFIDs2GLCapabilitiesImpl(sharedResource, hdc, pfdIDs, glp, GLGraphicsConfigurationUtil.ALL_BITS);
}
- private static List /**/ wglARBPFIDs2GLCapabilitiesImpl(WindowsWGLDrawableFactory.SharedResource sharedResource,
- long hdc, int[] pfdIDs, GLProfile glp, int winattrbits) {
+ private static List wglARBPFIDs2GLCapabilitiesImpl(WindowsWGLDrawableFactory.SharedResource sharedResource,
+ long hdc, int[] pfdIDs, GLProfile glp, int winattrbits) {
if (!sharedResource.hasARBPixelFormat()) {
return null;
}
@@ -600,7 +600,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
return val;
}
- static boolean AttribList2GLCapabilities( ArrayList extends GLCapabilitiesImmutable> capsBucket,
+ static boolean AttribList2GLCapabilities( List capsBucket,
final GLProfile glp, final long hdc, final int pfdID, final int[] iattribs,
final int niattribs,
final int[] iresults, final int winattrmask) {
@@ -659,14 +659,14 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
static WGLGLCapabilities PFD2GLCapabilities(GLProfile glp, long hdc, int pfdID, boolean onscreen) {
final int winattrmask = GLGraphicsConfigurationUtil.getWinAttributeBits(onscreen, false);
- ArrayList capsBucket = new ArrayList(1);
+ List capsBucket = new ArrayList(1);
if( PFD2GLCapabilities(capsBucket, glp, hdc, pfdID, winattrmask) ) {
- return capsBucket.get(0);
+ return (WGLGLCapabilities) capsBucket.get(0);
}
return null;
}
- static boolean PFD2GLCapabilities(ArrayList extends GLCapabilitiesImmutable> capsBucket, final GLProfile glp, final long hdc, final int pfdID, final int winattrmask) {
+ static boolean PFD2GLCapabilities(List capsBucket, final GLProfile glp, final long hdc, final int pfdID, final int winattrmask) {
PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(hdc, pfdID);
if(null == pfd) {
return false;
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
index 2c8c03185..850b64aa8 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
@@ -115,7 +115,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
WindowsWGLDrawable sharedDrawable = sharedResource.getDrawable();
GLCapabilitiesImmutable capsChosen = sharedDrawable.getChosenGLCapabilities();
WindowsWGLContext sharedContext = sharedResource.getContext();
- List/**/ availableCaps = null;
+ List availableCaps = null;
if ( sharedResource.needsCurrentContext4ARBPFDQueries() ) {
if(GLContext.CONTEXT_NOT_CURRENT == sharedContext.makeCurrent()) {
@@ -149,15 +149,15 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
return availableCaps;
}
- static List/**/ getAvailableGLCapabilitiesARB(long hdc, WindowsWGLDrawableFactory.SharedResource sharedResource, GLProfile glProfile) {
+ static List getAvailableGLCapabilitiesARB(long hdc, WindowsWGLDrawableFactory.SharedResource sharedResource, GLProfile glProfile) {
int[] pformats = WindowsWGLGraphicsConfiguration.wglAllARBPFIDs(sharedResource.getContext(), hdc);
return WindowsWGLGraphicsConfiguration.wglARBPFIDs2AllGLCapabilities(sharedResource, hdc, pformats, glProfile);
}
- static List/**/ getAvailableGLCapabilitiesGDI(long hdc, GLProfile glProfile) {
+ static List getAvailableGLCapabilitiesGDI(long hdc, GLProfile glProfile) {
int[] pformats = WindowsWGLGraphicsConfiguration.wglAllGDIPFIDs(hdc);
int numFormats = pformats.length;
- ArrayList bucket = new ArrayList(numFormats);
+ List bucket = new ArrayList(numFormats);
for (int i = 0; i < numFormats; i++) {
WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(bucket, glProfile, hdc, pformats[i], GLGraphicsConfigurationUtil.ALL_BITS);
}
@@ -370,7 +370,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
}
}
- List /**/ availableCaps =
+ List availableCaps =
WindowsWGLGraphicsConfiguration.wglARBPFIDs2GLCapabilities(sharedResource, hdc, pformats,
glProfile, onscreen, usePBuffer);
if( null == availableCaps || 0 == availableCaps.size() ) {
@@ -431,7 +431,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
boolean onscreen = capsChosen.isOnscreen();
GLProfile glProfile = capsChosen.getGLProfile();
- ArrayList availableCaps = new ArrayList();
+ List availableCaps = new ArrayList();
int pfdID; // chosen or preset PFD ID
WGLGLCapabilities pixelFormatCaps = null; // chosen or preset PFD ID's caps
boolean pixelFormatSet = false; // indicates a preset PFD ID [caps]
@@ -481,7 +481,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
}
return false;
}
- pixelFormatCaps = availableCaps.get(chosenIndex);
+ pixelFormatCaps = (WGLGLCapabilities) availableCaps.get(chosenIndex);
if (DEBUG) {
System.err.println("chosen pfdID (GDI): native recommended "+ (recommendedIndex+1) +
", caps " + pixelFormatCaps);
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
index 0af62394c..b54b5150c 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
@@ -34,6 +34,7 @@
package jogamp.opengl.x11.glx;
import java.util.ArrayList;
+import java.util.List;
import javax.media.nativewindow.GraphicsConfigurationFactory;
import javax.media.opengl.DefaultGLCapabilitiesChooser;
@@ -253,7 +254,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
static X11GLCapabilities GLXFBConfig2GLCapabilities(GLProfile glp, long display, long fbcfg,
boolean relaxed, boolean onscreen, boolean usePBuffer,
boolean isMultisampleAvailable) {
- ArrayList bucket = new ArrayList();
+ ArrayList bucket = new ArrayList();
final int winattrmask = GLGraphicsConfigurationUtil.getWinAttributeBits(onscreen, usePBuffer);
if( GLXFBConfig2GLCapabilities(bucket, glp, display, fbcfg, winattrmask, isMultisampleAvailable) ) {
return (X11GLCapabilities) bucket.get(0);
@@ -271,7 +272,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
return renderPictFmt.getDirect();
}
- static boolean GLXFBConfig2GLCapabilities(ArrayList capsBucket,
+ static boolean GLXFBConfig2GLCapabilities(List capsBucket,
GLProfile glp, long display, long fbcfg,
int winattrmask, boolean isMultisampleAvailable) {
final int allDrawableTypeBits = FBCfgDrawableTypeBits(display, fbcfg);
@@ -388,7 +389,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
return res;
}
- static boolean XVisualInfo2GLCapabilities(ArrayList capsBucket,
+ static boolean XVisualInfo2GLCapabilities(List capsBucket,
GLProfile glp, long display, XVisualInfo info,
final int winattrmask, boolean isMultisampleEnabled) {
final int allDrawableTypeBits = GLGraphicsConfigurationUtil.WINDOW_BIT | GLGraphicsConfigurationUtil.BITMAP_BIT ;
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
index 0ec2f234c..8377d2453 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
@@ -269,7 +269,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
final boolean isMultisampleAvailable = factory.isGLXMultisampleAvailable(absDevice);
int[] attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(capsChosen, true, isMultisampleAvailable, display, screen);
int[] count = { -1 };
- ArrayList/**/ availableCaps = new ArrayList();
+ List availableCaps = new ArrayList();
final int winattrmask = GLGraphicsConfigurationUtil.getWinAttributeBits(onscreen, usePBuffer);
// 1st choice: get GLCapabilities based on users GLCapabilities setting recommendedIndex as preferred choice
@@ -339,7 +339,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
GLProfile glProfile = capsChosen.getGLProfile();
final int winattrmask = GLGraphicsConfigurationUtil.getWinAttributeBits(capsChosen.isOnscreen(), false /* pbuffer */);
- ArrayList availableCaps = new ArrayList();
+ List availableCaps = new ArrayList();
int recommendedIndex = -1;
AbstractGraphicsDevice absDevice = x11Screen.getDevice();
diff --git a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java
index a306363dc..e1fdf4938 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java
@@ -65,6 +65,6 @@ public interface CapabilitiesChooser {
choice to some other CapabilitiesChooser object.
*/
public int chooseCapabilities(CapabilitiesImmutable desired,
- List /**/ available,
+ List extends CapabilitiesImmutable> available,
int windowSystemRecommendedChoice);
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
index 48c4d31ce..9d4b112b1 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
@@ -69,7 +69,7 @@ public class DefaultCapabilitiesChooser implements CapabilitiesChooser {
private static final boolean DEBUG = Debug.isPropertyDefined("nativewindow.debug.CapabilitiesChooser", true);
public int chooseCapabilities(final CapabilitiesImmutable desired,
- final List /**/ available,
+ final List extends CapabilitiesImmutable> available,
final int windowSystemRecommendedChoice) {
if (DEBUG) {
System.err.println("Desired: " + desired);
@@ -99,7 +99,7 @@ public class DefaultCapabilitiesChooser implements CapabilitiesChooser {
}
// Compute score for each
for (int i = 0; i < availnum; i++) {
- CapabilitiesImmutable cur = (CapabilitiesImmutable) available.get(i);
+ final CapabilitiesImmutable cur = available.get(i);
if (cur == null) {
continue;
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleChooser01.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleChooser01.java
index c2182b8b7..efdd2e16d 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleChooser01.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleChooser01.java
@@ -40,12 +40,17 @@
package com.jogamp.opengl.test.junit.jogl.caps;
import java.util.List;
+
+import javax.media.nativewindow.CapabilitiesImmutable;
import javax.media.opengl.DefaultGLCapabilitiesChooser;
import javax.media.opengl.GLCapabilitiesImmutable;
class MultisampleChooser01 extends DefaultGLCapabilitiesChooser {
- public int chooseCapabilities(GLCapabilitiesImmutable desired, List/**/ available, int windowSystemRecommendedChoice) {
+ @Override
+ public int chooseCapabilities(final CapabilitiesImmutable desired,
+ final List extends CapabilitiesImmutable> available,
+ final int windowSystemRecommendedChoice) {
boolean anyHaveSampleBuffers = false;
for (int i = 0; i < available.size(); i++) {
GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) available.get(i);
--
cgit v1.2.3
From a06e40cce89615eb8c4b080842997c9c3ad1130b Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Wed, 27 Jun 2012 05:05:36 +0200
Subject: NativeSurface Cleanup (API Change) - Adapt to GlueGen Lock cleanup
commit: 834b9e530e652b7ff7c5e222720bce3ad2b11c5f
- adapt to GlueGen Lock cleanup
- remove isSurfaceLocked(), use 'null != getSurfaceLockOwner()' instead
Misc:
- remove unused priv./impl. methods
- add @Override
---
src/jogl/classes/jogamp/opengl/GLContextImpl.java | 6 +-
src/jogl/classes/jogamp/opengl/GLDrawableImpl.java | 4 -
src/jogl/classes/jogamp/opengl/GLPbufferImpl.java | 4 -
.../com/jogamp/nativewindow/awt/JAWTWindow.java | 139 ++++++++++++---------
.../javax/media/nativewindow/NativeSurface.java | 15 +--
.../javax/media/nativewindow/ProxySurface.java | 34 +++--
.../classes/com/jogamp/newt/opengl/GLWindow.java | 8 +-
src/newt/classes/jogamp/newt/WindowImpl.java | 34 +++--
8 files changed, 134 insertions(+), 110 deletions(-)
(limited to 'src/jogl/classes/jogamp')
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 51201b3a9..ff1b65520 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -164,7 +164,7 @@ public abstract class GLContextImpl extends GLContext {
if(null!=read && drawable!=read && !isGLReadDrawableAvailable()) {
throw new GLException("GL Read Drawable not available");
}
- boolean lockHeld = lock.isOwner();
+ final boolean lockHeld = lock.isOwner(Thread.currentThread());
if(lockHeld) {
release();
}
@@ -224,8 +224,8 @@ public abstract class GLContextImpl extends GLContext {
if(TRACE_SWITCH) {
System.err.println(getThreadName() +": GLContext.ContextSwitch: - release() - force: "+force+", "+lock);
}
- if ( !lock.isOwner() ) {
- throw new GLException("Context not current on current thread "+Thread.currentThread().getName()+": "+this);
+ if ( !lock.isOwner(Thread.currentThread()) ) {
+ throw new GLException("Context not current on current thread "+Thread.currentThread().getName()+": "+this);
}
final boolean actualRelease = force || lock.getHoldCount() == 1 ;
try {
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
index 36f17e5a1..71624789d 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
@@ -199,10 +199,6 @@ public abstract class GLDrawableImpl implements GLDrawable {
surface.unlockSurface();
}
- public boolean isSurfaceLocked() {
- return surface.isSurfaceLocked();
- }
-
public String toString() {
return getClass().getSimpleName()+"[Realized "+isRealized()+
",\n\tFactory "+getFactory()+
diff --git a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
index 0f4f7f8e2..9a4cf1f94 100644
--- a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
@@ -267,10 +267,6 @@ public class GLPbufferImpl implements GLPbuffer {
recurLock.unlock();
}
- public boolean isSurfaceLocked() {
- return recurLock.isLocked();
- }
-
public int getFloatingPointMode() {
if (floatMode == 0) {
throw new GLException("Pbuffer not initialized, or floating-point support not requested");
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
index 02dd746a0..3437358de 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,7 +29,7 @@
* 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.
@@ -67,7 +67,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
// user properties
protected boolean shallUseOffscreenLayer = false;
-
+
// lifetime: forever
protected Component component;
private AWTGraphicsConfiguration config; // control access due to delegation
@@ -81,13 +81,13 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
protected long drawable;
protected Rectangle bounds;
protected Insets insets;
-
+
private long drawable_old;
-
+
/**
* Constructed by {@link jogamp.nativewindow.NativeWindowFactoryImpl#getNativeWindow(Object, AbstractGraphicsConfiguration)}
* via this platform's specialization (X11, OSX, Windows, ..).
- *
+ *
* @param comp
* @param config
*/
@@ -107,19 +107,22 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
this.component = windowObject;
this.isApplet = false;
}
-
+
+ @Override
public void setShallUseOffscreenLayer(boolean v) {
shallUseOffscreenLayer = v;
}
-
+
+ @Override
public final boolean getShallUseOffscreenLayer() {
return shallUseOffscreenLayer;
}
-
- public final boolean isOffscreenLayerSurfaceEnabled() {
+
+ @Override
+ public final boolean isOffscreenLayerSurfaceEnabled() {
return isOffscreenLayerSurface;
}
-
+
protected synchronized void invalidate() {
invalidateNative();
jawt = null;
@@ -136,7 +139,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
bounds.setY(jawtBounds.getY());
bounds.setWidth(jawtBounds.getWidth());
bounds.setHeight(jawtBounds.getHeight());
-
+
if(component instanceof Container) {
java.awt.Insets contInsets = ((Container)component).getInsets();
insets.setLeftWidth(contInsets.left);
@@ -148,16 +151,17 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
/** @return the JAWT_DrawingSurfaceInfo's (JAWT_Rectangle) bounds, updated with lock */
public final RectangleImmutable getBounds() { return bounds; }
-
+
+ @Override
public final InsetsImmutable getInsets() { return insets; }
public final Component getAWTComponent() {
return component;
}
-
- /**
- * Returns true if the AWT component is parented to an {@link java.applet.Applet},
- * otherwise false. This information is valid only after {@link #lockSurface()}.
+
+ /**
+ * Returns true if the AWT component is parented to an {@link java.applet.Applet},
+ * otherwise false. This information is valid only after {@link #lockSurface()}.
*/
public final boolean isApplet() {
return isApplet;
@@ -168,10 +172,11 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
return jawt;
}
- /**
+ /**
* {@inheritDoc}
*/
- public final void attachSurfaceLayer(final long layerHandle) throws NativeWindowException {
+ @Override
+ public final void attachSurfaceLayer(final long layerHandle) throws NativeWindowException {
if( !isOffscreenLayerSurfaceEnabled() ) {
throw new NativeWindowException("Not an offscreen layer surface");
}
@@ -187,13 +192,14 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
} finally {
unlockSurface();
}
- }
+ }
protected abstract void attachSurfaceLayerImpl(final long layerHandle);
-
- /**
+
+ /**
* {@inheritDoc}
*/
- public final void detachSurfaceLayer(final long layerHandle) throws NativeWindowException {
+ @Override
+ public final void detachSurfaceLayer(final long layerHandle) throws NativeWindowException {
if( !isOffscreenLayerSurfaceEnabled() ) {
throw new java.lang.UnsupportedOperationException("Not an offscreen layer surface");
}
@@ -209,29 +215,33 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
} finally {
unlockSurface();
}
- }
+ }
protected abstract void detachSurfaceLayerImpl(final long layerHandle);
-
+
//
// SurfaceUpdateListener
//
+ @Override
public void addSurfaceUpdatedListener(SurfaceUpdatedListener l) {
surfaceUpdatedHelper.addSurfaceUpdatedListener(l);
}
+ @Override
public void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l) throws IndexOutOfBoundsException {
surfaceUpdatedHelper.addSurfaceUpdatedListener(index, l);
}
+ @Override
public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l) {
surfaceUpdatedHelper.removeSurfaceUpdatedListener(l);
}
+ @Override
public void surfaceUpdated(Object updater, NativeSurface ns, long when) {
surfaceUpdatedHelper.surfaceUpdated(updater, ns, when);
- }
-
+ }
+
//
// NativeSurface
//
@@ -243,14 +253,14 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
c = c.getParent();
}
}
-
+
/**
- * If JAWT offscreen layer is supported,
+ * If JAWT offscreen layer is supported,
* implementation shall respect {@link #getShallUseOffscreenLayer()}
* and may respect {@link #isApplet()}.
- *
+ *
* @return The JAWT instance reflecting offscreen layer support, etc.
- *
+ *
* @throws NativeWindowException
*/
protected abstract JAWT fetchJAWTImpl() throws NativeWindowException;
@@ -266,7 +276,8 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
}
// Thread.dumpStack();
}
-
+
+ @Override
public final int lockSurface() throws NativeWindowException {
surfaceLock.lock();
int res = surfaceLock.getHoldCount() == 1 ? LOCK_SURFACE_NOT_READY : LOCK_SUCCESS; // new lock ?
@@ -282,7 +293,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
res = lockSurfaceImpl();
if(LOCK_SUCCESS == res && drawable_old != drawable) {
res = LOCK_SURFACE_CHANGED;
- if(DEBUG) {
+ if(DEBUG) {
System.err.println("JAWTWindow: surface change 0x"+Long.toHexString(drawable_old)+" -> 0x"+Long.toHexString(drawable));
// Thread.dumpStack();
}
@@ -303,6 +314,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
protected abstract void unlockSurfaceImpl() throws NativeWindowException;
+ @Override
public final void unlockSurface() {
surfaceLock.validateLocked();
drawable_old = drawable;
@@ -318,46 +330,51 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
surfaceLock.unlock();
}
+ @Override
public final boolean isSurfaceLockedByOtherThread() {
return surfaceLock.isLockedByOtherThread();
}
- public final boolean isSurfaceLocked() {
- return surfaceLock.isLocked();
- }
-
+ @Override
public final Thread getSurfaceLockOwner() {
return surfaceLock.getOwner();
}
+ @Override
public boolean surfaceSwap() {
return false;
}
+ @Override
public long getSurfaceHandle() {
return drawable;
}
-
+
public final AWTGraphicsConfiguration getPrivateGraphicsConfiguration() {
return config;
}
-
+
+ @Override
public final AbstractGraphicsConfiguration getGraphicsConfiguration() {
return config.getNativeGraphicsConfiguration();
}
+ @Override
public final long getDisplayHandle() {
return getGraphicsConfiguration().getScreen().getDevice().getHandle();
}
+ @Override
public final int getScreenIndex() {
return getGraphicsConfiguration().getScreen().getIndex();
}
+ @Override
public int getWidth() {
return component.getWidth();
}
+ @Override
public int getHeight() {
return component.getHeight();
}
@@ -366,41 +383,47 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
// NativeWindow
//
+ @Override
public synchronized void destroy() {
- invalidate();
- component = null; // don't dispose the AWT component, since we are merely an immutable uplink
+ invalidate();
+ component = null; // don't dispose the AWT component, since we are merely an immutable uplink
}
+ @Override
public final NativeWindow getParent() {
return null;
}
+ @Override
public long getWindowHandle() {
return drawable;
}
-
+
+ @Override
public final int getX() {
return component.getX();
}
+ @Override
public final int getY() {
return component.getY();
}
-
+
/**
* {@inheritDoc}
- *
+ *
*
- * This JAWT default implementation is currently still using
+ * This JAWT default implementation is currently still using
* a blocking implementation. It first attempts to retrieve the location
* via a native implementation. If this fails, it tries the blocking AWT implementation.
- * If the latter fails due to an external AWT tree-lock, the non block
+ * If the latter fails due to an external AWT tree-lock, the non block
* implementation {@link #getLocationOnScreenNonBlocking(Point, Component)} is being used.
* The latter simply traverse up to the AWT component tree and sums the rel. position.
* We have to determine whether the latter is good enough for all cases,
* currently only OS X utilizes the non blocking method per default.
- *
+ *
*/
+ @Override
public Point getLocationOnScreen(Point storage) {
Point los = getLocationOnScreenNative(storage);
if(null == los) {
@@ -421,7 +444,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
}
return los;
}
-
+
protected Point getLocationOnScreenNative(Point storage) {
int lockRes = lockSurface();
if(LOCK_SURFACE_NOT_READY == lockRes) {
@@ -442,12 +465,12 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
return d;
} finally {
unlockSurface();
- }
+ }
}
protected abstract Point getLocationOnScreenNativeImpl(int x, int y);
- protected static Point getLocationOnScreenNonBlocking(Point storage, Component comp) {
- int x = 0;
+ protected static Point getLocationOnScreenNonBlocking(Point storage, Component comp) {
+ int x = 0;
int y = 0;
while(null != comp) {
x += comp.getX();
@@ -460,11 +483,12 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
}
return new Point(x, y);
}
-
+
+ @Override
public boolean hasFocus() {
return component.hasFocus();
}
-
+
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -487,5 +511,4 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
return sb.toString();
}
-
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java
index b7829cb6d..c58b34b18 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java
@@ -104,15 +104,16 @@ public interface NativeSurface extends SurfaceUpdatedListener {
public void unlockSurface() throws NativeWindowException ;
/**
- * Return if surface is locked by another thread, ie not the current one
+ * Query if surface is locked by another thread, i.e. not the current one.
+ *
+ * Convenient shortcut for:
+ *
+ * final Thread o = getSurfaceLockOwner();
+ * if( null != o && Thread.currentThread() != o ) { .. }
+ *
*/
public boolean isSurfaceLockedByOtherThread();
-
- /**
- * Return if surface is locked
- */
- public boolean isSurfaceLocked();
-
+
/**
* Return the locking owner's Thread, or null if not locked.
*/
diff --git a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java b/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
index 6a36bb130..c8cd78d82 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
@@ -37,7 +37,7 @@ import com.jogamp.common.util.locks.RecursiveLock;
public abstract class ProxySurface implements NativeSurface {
public static final boolean DEBUG = Debug.debug("ProxySurface");
-
+
private SurfaceUpdatedHelper surfaceUpdatedHelper = new SurfaceUpdatedHelper();
private AbstractGraphicsConfiguration config; // control access due to delegation
protected RecursiveLock surfaceLock = LockFactory.createRecursiveLock();
@@ -60,6 +60,7 @@ public abstract class ProxySurface implements NativeSurface {
}
protected abstract void invalidateImpl();
+ @Override
public final long getDisplayHandle() {
return displayHandle;
}
@@ -67,21 +68,26 @@ public abstract class ProxySurface implements NativeSurface {
protected final AbstractGraphicsConfiguration getPrivateGraphicsConfiguration() {
return config;
}
-
+
+ @Override
public final AbstractGraphicsConfiguration getGraphicsConfiguration() {
return config.getNativeGraphicsConfiguration();
}
+ @Override
public final int getScreenIndex() {
return getGraphicsConfiguration().getScreen().getIndex();
}
+ @Override
public abstract long getSurfaceHandle();
+ @Override
public final int getWidth() {
return width;
}
+ @Override
public final int getHeight() {
return height;
}
@@ -91,26 +97,32 @@ public abstract class ProxySurface implements NativeSurface {
this.height = height;
}
+ @Override
public boolean surfaceSwap() {
return false;
}
+ @Override
public void addSurfaceUpdatedListener(SurfaceUpdatedListener l) {
surfaceUpdatedHelper.addSurfaceUpdatedListener(l);
}
+ @Override
public void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l) throws IndexOutOfBoundsException {
surfaceUpdatedHelper.addSurfaceUpdatedListener(index, l);
}
+ @Override
public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l) {
surfaceUpdatedHelper.removeSurfaceUpdatedListener(l);
}
+ @Override
public void surfaceUpdated(Object updater, NativeSurface ns, long when) {
surfaceUpdatedHelper.surfaceUpdated(updater, ns, when);
- }
-
+ }
+
+ @Override
public int lockSurface() throws NativeWindowException {
surfaceLock.lock();
int res = surfaceLock.getHoldCount() == 1 ? LOCK_SURFACE_NOT_READY : LOCK_SUCCESS; // new lock ?
@@ -123,11 +135,11 @@ public abstract class ProxySurface implements NativeSurface {
res = lockSurfaceImpl();
if(LOCK_SUCCESS == res && surfaceHandle_old != getSurfaceHandle()) {
res = LOCK_SURFACE_CHANGED;
- if(DEBUG) {
+ if(DEBUG) {
System.err.println("ProxySurface: surface change 0x"+Long.toHexString(surfaceHandle_old)+" -> 0x"+Long.toHexString(getSurfaceHandle()));
// Thread.dumpStack();
}
- }
+ }
} finally {
if (LOCK_SURFACE_NOT_READY >= res) {
adevice.unlock();
@@ -142,6 +154,7 @@ public abstract class ProxySurface implements NativeSurface {
return res;
}
+ @Override
public final void unlockSurface() {
surfaceLock.validateLocked();
surfaceHandle_old = getSurfaceHandle();
@@ -165,17 +178,16 @@ public abstract class ProxySurface implements NativeSurface {
surfaceLock.validateLocked();
}
- public final boolean isSurfaceLocked() {
- return surfaceLock.isLocked();
- }
-
+ @Override
public final boolean isSurfaceLockedByOtherThread() {
return surfaceLock.isLockedByOtherThread();
}
+ @Override
public final Thread getSurfaceLockOwner() {
return surfaceLock.getOwner();
}
- public abstract String toString();
+ @Override
+ public abstract String toString();
}
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index a3adf5090..1832d4e99 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -842,22 +842,22 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer, FPSC
// NativeWindow completion
//
+ @Override
public final int lockSurface() {
return window.lockSurface();
}
+ @Override
public final void unlockSurface() throws NativeWindowException {
window.unlockSurface();
}
+ @Override
public final boolean isSurfaceLockedByOtherThread() {
return window.isSurfaceLockedByOtherThread();
}
- public final boolean isSurfaceLocked() {
- return window.isSurfaceLocked();
- }
-
+ @Override
public final Thread getSurfaceLockOwner() {
return window.getSurfaceLockOwner();
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index 73bd9ed1c..baad77ffb 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -562,6 +562,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// NativeSurface
//
+ @Override
public final int lockSurface() {
windowLock.lock();
surfaceLock.lock();
@@ -590,6 +591,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
return res;
}
+ @Override
public final void unlockSurface() {
surfaceLock.validateLocked();
windowLock.validateLocked();
@@ -606,30 +608,24 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
windowLock.unlock();
}
- public final boolean isWindowLockedByOtherThread() {
- return windowLock.isLockedByOtherThread();
- }
-
- public final boolean isWindowLocked() {
- return windowLock.isLocked();
- }
-
- public final Thread getWindowLockOwner() {
- return windowLock.getOwner();
- }
-
+ @Override
public final boolean isSurfaceLockedByOtherThread() {
return surfaceLock.isLockedByOtherThread();
}
- public final boolean isSurfaceLocked() {
- return surfaceLock.isLocked();
- }
-
+ @Override
public final Thread getSurfaceLockOwner() {
return surfaceLock.getOwner();
}
+ public final boolean isWindowLockedByOtherThread() {
+ return windowLock.isLockedByOtherThread();
+ }
+
+ public final Thread getWindowLockOwner() {
+ return windowLock.getOwner();
+ }
+
public long getSurfaceHandle() {
return windowHandle; // default: return window handle
}
@@ -1574,7 +1570,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
public void runOnEDTIfAvail(boolean wait, final Runnable task) {
- if(windowLock.isOwner()) {
+ if(windowLock.isOwner(Thread.currentThread())) {
task.run();
} else {
Screen scrn = getScreen();
@@ -1913,7 +1909,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// special repaint treatment
case WindowEvent.EVENT_WINDOW_REPAINT:
// queue repaint event in case window is locked, ie in operation
- if( isWindowLocked() ) {
+ if( null != getWindowLockOwner() ) {
// make sure only one repaint event is queued
if(!repaintQueued) {
repaintQueued=true;
@@ -1932,7 +1928,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// common treatment
case WindowEvent.EVENT_WINDOW_RESIZED:
// queue event in case window is locked, ie in operation
- if( isWindowLocked() ) {
+ if( null != getWindowLockOwner() ) {
final boolean discardTO = QUEUED_EVENT_TO <= System.currentTimeMillis()-e.getWhen();
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.consumeEvent: "+Thread.currentThread().getName()+" - queued "+e+", discard-to "+discardTO);
--
cgit v1.2.3
From 1d9ce79f9e396599b2503f385c74bd132bf88fed Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Wed, 27 Jun 2012 05:24:56 +0200
Subject: Misc cleanup: Add @Override, remove trailing whitespace
---
src/jogl/classes/jogamp/opengl/GLDrawableImpl.java | 43 ++++++++------
.../classes/jogamp/opengl/egl/EGLDrawable.java | 31 ++++++----
.../jogamp/opengl/egl/EGLOnscreenDrawable.java | 16 +++---
.../jogamp/opengl/egl/EGLPbufferDrawable.java | 19 +++---
.../opengl/macosx/cgl/MacOSXCGLDrawable.java | 41 +++++++------
.../macosx/cgl/MacOSXExternalCGLContext.java | 27 ++++++---
.../macosx/cgl/MacOSXOnscreenCGLDrawable.java | 1 +
.../macosx/cgl/MacOSXPbufferCGLDrawable.java | 54 ++++++++++-------
.../windows/wgl/WindowsBitmapWGLDrawable.java | 23 ++++----
.../windows/wgl/WindowsDummyWGLDrawable.java | 18 +++---
.../windows/wgl/WindowsExternalWGLContext.java | 24 +++++---
.../windows/wgl/WindowsExternalWGLDrawable.java | 23 ++++----
.../windows/wgl/WindowsOnscreenWGLDrawable.java | 15 ++---
.../windows/wgl/WindowsPbufferWGLDrawable.java | 67 +++++++++++-----------
.../opengl/windows/wgl/WindowsWGLDrawable.java | 19 +++---
.../jogamp/opengl/x11/glx/X11DummyGLXDrawable.java | 22 +++----
.../opengl/x11/glx/X11ExternalGLXContext.java | 25 +++++---
.../opengl/x11/glx/X11ExternalGLXDrawable.java | 15 ++---
.../jogamp/opengl/x11/glx/X11GLXDrawable.java | 17 +++---
.../opengl/x11/glx/X11OnscreenGLXDrawable.java | 19 +++---
.../opengl/x11/glx/X11PbufferGLXDrawable.java | 27 +++++----
.../opengl/x11/glx/X11PixmapGLXDrawable.java | 21 ++++---
22 files changed, 329 insertions(+), 238 deletions(-)
(limited to 'src/jogl/classes/jogamp')
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
index 71624789d..c843e5571 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -61,7 +61,7 @@ public abstract class GLDrawableImpl implements GLDrawable {
this.requestedCapabilities = (GLCapabilitiesImmutable) surface.getGraphicsConfiguration().getRequestedCapabilities();
}
- /**
+ /**
* Returns the DynamicLookupHelper
*/
public abstract GLDynamicLookupHelper getGLDynamicLookupHelper();
@@ -84,6 +84,7 @@ public abstract class GLDrawableImpl implements GLDrawable {
throw new GLException("Should not call this (should only be called for offscreen GLDrawables)");
}
+ @Override
public final void swapBuffers() throws GLException {
GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable)surface.getGraphicsConfiguration().getChosenCapabilities();
if ( caps.getDoubleBuffered() ) {
@@ -103,7 +104,7 @@ public abstract class GLDrawableImpl implements GLDrawable {
}
} else {
GLContext ctx = GLContext.getCurrent();
- if(null!=ctx && ctx.getGLDrawable()==this) {
+ if(null!=ctx && ctx.getGLDrawable()==this) {
ctx.getGL().glFinish();
}
}
@@ -115,10 +116,12 @@ public abstract class GLDrawableImpl implements GLDrawable {
return "0x" + Long.toHexString(hex);
}
+ @Override
public GLProfile getGLProfile() {
return requestedCapabilities.getGLProfile();
}
+ @Override
public GLCapabilitiesImmutable getChosenGLCapabilities() {
return (GLCapabilitiesImmutable) surface.getGraphicsConfiguration().getChosenCapabilities();
}
@@ -127,24 +130,28 @@ public abstract class GLDrawableImpl implements GLDrawable {
return requestedCapabilities;
}
+ @Override
public NativeSurface getNativeSurface() {
return surface;
}
- /** called with locked surface @ setRealized(false) */
+ /** called with locked surface @ setRealized(false) */
protected void destroyHandle() {}
-
- /** called with locked surface @ setRealized(true) or @ lockSurface(..) when surface changed */
+
+ /** called with locked surface @ setRealized(true) or @ lockSurface(..) when surface changed */
protected void updateHandle() {}
+ @Override
public long getHandle() {
return surface.getSurfaceHandle();
}
+ @Override
public GLDrawableFactory getFactory() {
return factory;
}
+ @Override
public final synchronized void setRealized(boolean realizedArg) {
if ( realized != realizedArg ) {
if(DEBUG) {
@@ -159,7 +166,7 @@ public abstract class GLDrawableImpl implements GLDrawable {
} else {
aDevice.lock();
}
- try {
+ try {
setRealizedImpl();
if(realizedArg) {
updateHandle();
@@ -178,15 +185,18 @@ public abstract class GLDrawableImpl implements GLDrawable {
}
}
protected abstract void setRealizedImpl();
-
+
+ @Override
public synchronized boolean isRealized() {
return realized;
}
+ @Override
public int getWidth() {
return surface.getWidth();
}
-
+
+ @Override
public int getHeight() {
return surface.getHeight();
}
@@ -199,6 +209,7 @@ public abstract class GLDrawableImpl implements GLDrawable {
surface.unlockSurface();
}
+ @Override
public String toString() {
return getClass().getSimpleName()+"[Realized "+isRealized()+
",\n\tFactory "+getFactory()+
@@ -209,7 +220,7 @@ public abstract class GLDrawableImpl implements GLDrawable {
protected static String getThreadName() {
return Thread.currentThread().getName();
}
-
+
protected GLDrawableFactory factory;
protected NativeSurface surface;
protected GLCapabilitiesImmutable requestedCapabilities;
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
index b2119d728..491f22119 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -63,6 +63,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
return eglDisplay;
}
+ @Override
public long getHandle() {
return eglSurface;
}
@@ -71,10 +72,12 @@ public abstract class EGLDrawable extends GLDrawableImpl {
return eglConfig;
}
+ @Override
public GLCapabilitiesImmutable getChosenGLCapabilities() {
return (null==eglConfig)?super.getChosenGLCapabilities():(GLCapabilitiesImmutable)eglConfig.getChosenCapabilities();
}
+ @Override
public abstract GLContext createContext(GLContext shareWith);
protected abstract long createSurface(long eglDpy, long eglNativeCfg, long surfaceHandle);
@@ -90,11 +93,11 @@ public abstract class EGLDrawable extends GLDrawableImpl {
}
eglSurface = createSurface(eglDisplay, eglConfig.getNativeConfig(), surface.getSurfaceHandle());
- int eglError0 = EGL.EGL_SUCCESS;
+ int eglError0 = EGL.EGL_SUCCESS;
if (EGL.EGL_NO_SURFACE == eglSurface) {
eglError0 = EGL.eglGetError();
if(EGL.EGL_BAD_NATIVE_WINDOW == eglError0) {
- // Try window handle if available and differs (Windows HDC / HWND).
+ // Try window handle if available and differs (Windows HDC / HWND).
// ANGLE impl. required HWND on Windows.
if(surface instanceof NativeWindow) {
final NativeWindow nw = (NativeWindow) surface;
@@ -125,7 +128,8 @@ public abstract class EGLDrawable extends GLDrawableImpl {
recreateSurface();
}
}
-
+
+ @Override
protected void setRealizedImpl() {
if (realized) {
AbstractGraphicsConfiguration aConfig = surface.getGraphicsConfiguration();
@@ -195,7 +199,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
} else {
eglConfig = EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(
capsRequested, capsRequested, null, s, aConfig.getVisualID(VIDType.NATIVE), false);
-
+
if (null == eglConfig) {
throw new GLException("Couldn't create EGLGraphicsConfiguration from "+s);
} else if(DEBUG) {
@@ -224,6 +228,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
}
}
+ @Override
protected final void swapBuffersImpl() {
// single-buffer is already filtered out @ GLDrawableImpl#swapBuffers()
if(!EGL.eglSwapBuffers(eglDisplay, eglSurface)) {
@@ -231,9 +236,9 @@ public abstract class EGLDrawable extends GLDrawableImpl {
}
}
- /**
+ /**
* Surface not realizes yet (onscreen) .. Quering EGL surface size only makes sense for external drawable.
- * Leave it here for later impl. of an EGLExternalDrawable.
+ * Leave it here for later impl. of an EGLExternalDrawable.
public int getWidth() {
int[] tmp = new int[1];
if (!EGL.eglQuerySurface(eglDisplay, eglSurface, EGL.EGL_WIDTH, tmp, 0)) {
@@ -250,6 +255,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
return tmp[0];
} */
+ @Override
public GLDynamicLookupHelper getGLDynamicLookupHelper() {
if (getGLProfile().usesNativeGLES2()) {
return getFactoryImpl().getGLDynamicLookupHelper(2);
@@ -260,6 +266,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
}
}
+ @Override
public String toString() {
return getClass().getName()+"[realized "+isRealized()+
",\n\tfactory "+getFactory()+
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java
index 42f067b29..3768f1588 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -48,10 +48,12 @@ public class EGLOnscreenDrawable extends EGLDrawable {
super(factory, component);
}
+ @Override
public GLContext createContext(GLContext shareWith) {
return new EGLOnscreenContext(this, shareWith);
}
+ @Override
protected long createSurface(long eglDpy, long eglNativeCfg, long surfaceHandle) {
return EGL.eglCreateWindowSurface(eglDpy, eglNativeCfg, surfaceHandle, null);
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java
index 28a23d294..f18b8cd02 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -55,10 +55,12 @@ public class EGLPbufferDrawable extends EGLDrawable {
super(factory, target);
}
+ @Override
protected void destroyImpl() {
setRealized(false);
}
-
+
+ @Override
protected long createSurface(long eglDpy, long eglNativeCfg, long surfaceHandle) {
final AbstractGraphicsConfiguration config = getNativeSurface().getGraphicsConfiguration();
final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
@@ -85,6 +87,7 @@ public class EGLPbufferDrawable extends EGLDrawable {
return surf;
}
+ @Override
public GLContext createContext(GLContext shareWith) {
return new EGLPbufferContext(this, shareWith);
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
index 7b5efc31a..cae60702b 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -82,10 +82,10 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
// lifetime of a given GLPbuffer. This is not a fully general
// solution (for example, you can't share textures among a
// GLPbuffer, a GLJPanel and a GLCanvas simultaneously) but should
- // be enough to get things off the ground.
+ // be enough to get things off the ground.
public enum GLBackendType {
- NSOPENGL(0), CGL(1);
-
+ NSOPENGL(0), CGL(1);
+
public final int id;
GLBackendType(int id){
@@ -93,22 +93,23 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
}
}
private List> createdContexts = new ArrayList>();
-
+
private boolean haveSetOpenGLMode = false;
private GLBackendType openGLMode = GLBackendType.NSOPENGL;
-
+
public MacOSXCGLDrawable(GLDrawableFactory factory, NativeSurface comp, boolean realized) {
super(factory, comp, realized);
initOpenGLImpl(getOpenGLMode());
}
-
+
+ @Override
protected void setRealizedImpl() {
}
protected long getNSViewHandle() {
return GLBackendType.NSOPENGL == openGLMode ? getHandle() : 0;
}
-
+
protected void registerContext(MacOSXCGLContext ctx) {
// NOTE: we need to keep track of the created contexts in order to
// implement swapBuffers() because of how Mac OS X implements its
@@ -117,6 +118,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
createdContexts.add(new WeakReference(ctx));
}
}
+ @Override
protected final void swapBuffersImpl() {
// single-buffer is already filtered out @ GLDrawableImpl#swapBuffers()
synchronized (createdContexts) {
@@ -130,8 +132,9 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
}
}
}
- }
-
+ }
+
+ @Override
public GLDynamicLookupHelper getGLDynamicLookupHelper() {
return getFactoryImpl().getGLDynamicLookupHelper(0);
}
@@ -148,17 +151,17 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
if (haveSetOpenGLMode) {
throw new GLException("Can't switch between using NSOpenGLPixelBuffer and CGLPBufferObj more than once");
}
-
+
destroyImpl();
if (DEBUG) {
System.err.println("MacOSXCGLDrawable: Switching context mode " + openGLMode + " -> " + mode);
}
initOpenGLImpl(mode);
openGLMode = mode;
- haveSetOpenGLMode = true;
+ haveSetOpenGLMode = true;
}
public final GLBackendType getOpenGLMode() { return openGLMode; }
protected void initOpenGLImpl(GLBackendType backend) { /* nop */ }
-
+
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
index 58cea4ade..ad4c06af2 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -112,17 +112,19 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext {
if(0 == currentDrawable) {
// set a fake marker stating a valid drawable
- currentDrawable = 1;
+ currentDrawable = 1;
}
WrappedSurface ns = new WrappedSurface(cfg);
ns.setSurfaceHandle(currentDrawable);
return new MacOSXExternalCGLContext(new Drawable(factory, ns), isNSContext, contextHandle);
}
+ @Override
protected boolean createImpl(GLContextImpl shareWith) throws GLException {
return true;
}
+ @Override
public int makeCurrent() throws GLException {
// Save last context if necessary to allow external GLContexts to
// talk to other GLContexts created by this library
@@ -132,20 +134,24 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext {
setCurrent(null);
}
return super.makeCurrent();
- }
+ }
+ @Override
public void release() throws GLException {
super.release();
setCurrent(lastContext);
lastContext = null;
}
+ @Override
protected void makeCurrentImpl() throws GLException {
}
+ @Override
protected void releaseImpl() throws GLException {
}
+ @Override
protected void destroyImpl() throws GLException {
}
@@ -155,14 +161,17 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext {
super(factory, comp, true);
}
+ @Override
public GLContext createContext(GLContext shareWith) {
throw new GLException("Should not call this");
}
+ @Override
public int getWidth() {
throw new GLException("Should not call this");
}
+ @Override
public int getHeight() {
throw new GLException("Should not call this");
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
index 80c54042f..07d30a488 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
@@ -50,6 +50,7 @@ public class MacOSXOnscreenCGLDrawable extends MacOSXCGLDrawable {
super(factory, component, false);
}
+ @Override
public GLContext createContext(GLContext shareWith) {
final MacOSXOnscreenCGLContext ctx= new MacOSXOnscreenCGLContext(this, shareWith);
registerContext(ctx);
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
index 1e49d1fc9..33021c521 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -45,6 +45,7 @@ import javax.media.nativewindow.NativeSurface;
import javax.media.nativewindow.SurfaceChangeable;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
+import javax.media.opengl.GL2GL3;
import javax.media.opengl.GLCapabilitiesImmutable;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
@@ -54,7 +55,7 @@ import javax.media.opengl.GLProfile;
import com.jogamp.common.nio.PointerBuffer;
import com.jogamp.opengl.util.GLBuffers;
-public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
+public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
// Abstract interface for implementation of this drawable (either
// NSOpenGL-based or CGL-based)
interface GLBackendImpl {
@@ -64,7 +65,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
// Implementation object (either NSOpenGL-based or CGL-based)
protected GLBackendImpl impl;
-
+
// State for render-to-texture and render-to-texture-rectangle support
// private int textureTarget; // e.g. GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE_NV
// private int texture; // actual texture object
@@ -78,10 +79,12 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
super(factory, target, false);
}
+ @Override
protected void destroyImpl() {
- setRealized(false);
+ setRealized(false);
}
-
+
+ @Override
protected void setRealizedImpl() {
if(realized) {
createPbuffer();
@@ -90,6 +93,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
}
}
+ @Override
public GLContext createContext(GLContext shareWith) {
final MacOSXPbufferCGLContext ctx = new MacOSXPbufferCGLContext(this, shareWith);
registerContext(ctx);
@@ -101,16 +105,16 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
// pbuffer handle is NSOpenGLPixelBuffer
return 0;
}
-
+
@Override
public long getHandle() {
return pBuffer;
}
-
+
protected int getTextureTarget() { return pBufferTexTarget; }
protected int getTextureWidth() { return pBufferTexWidth; }
protected int getTextureHeight() { return pBufferTexHeight; }
-
+
protected void destroyPbuffer() {
if (this.pBuffer != 0) {
NativeSurface ns = getNativeSurface();
@@ -126,7 +130,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
final GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getChosenCapabilities();
final GLProfile glProfile = capabilities.getGLProfile();
MacOSXCGLDrawableFactory.SharedResource sr = ((MacOSXCGLDrawableFactory)factory).getOrCreateOSXSharedResource(config.getScreen().getDevice());
-
+
if (DEBUG) {
System.out.println("Pbuffer config: " + config);
if(null != sr) {
@@ -138,11 +142,11 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
}
if ( capabilities.getPbufferRenderToTextureRectangle() && null!=sr && sr.isRECTTextureAvailable() ) {
- pBufferTexTarget = GL2.GL_TEXTURE_RECTANGLE;
+ pBufferTexTarget = GL2GL3.GL_TEXTURE_RECTANGLE;
} else {
pBufferTexTarget = GL.GL_TEXTURE_2D;
}
- if ( GL2.GL_TEXTURE_RECTANGLE == pBufferTexTarget || ( null!=sr && sr.isNPOTTextureAvailable() ) ) {
+ if ( GL2GL3.GL_TEXTURE_RECTANGLE == pBufferTexTarget || ( null!=sr && sr.isNPOTTextureAvailable() ) ) {
pBufferTexWidth = getWidth();
pBufferTexHeight = getHeight();
} else {
@@ -161,7 +165,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
default: throw new GLException("Invalid floating-point bit depth (only 16 and 32 supported)");
}
}
-
+
pBuffer = impl.create(pBufferTexTarget, internalFormat, getWidth(), getHeight());
if(DEBUG) {
System.err.println("MacOSXPbufferCGLDrawable tex: target "+toHexString(pBufferTexTarget)+
@@ -178,11 +182,13 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
((SurfaceChangeable)ns).setSurfaceHandle(pBuffer);
}
+ @Override
public void setOpenGLMode(GLBackendType mode) {
super.setOpenGLMode(mode);
createPbuffer(); // recreate
}
+ @Override
protected void initOpenGLImpl(GLBackendType backend) {
switch (backend) {
case NSOPENGL:
@@ -194,14 +200,16 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
default:
throw new InternalError("Illegal implementation mode " + backend);
}
- }
-
+ }
+
// NSOpenGLPixelBuffer implementation
class NSOpenGLImpl implements GLBackendImpl {
+ @Override
public long create(int renderTarget, int internalFormat, int width, int height) {
return CGL.createPBuffer(renderTarget, internalFormat, width, height);
}
+ @Override
public void destroy(long pbuffer) {
CGL.destroyPBuffer(pbuffer);
}
@@ -209,6 +217,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
// CGL implementation
class CGLImpl implements GLBackendImpl {
+ @Override
public long create(int renderTarget, int internalFormat, int width, int height) {
PointerBuffer pbuffer = PointerBuffer.allocateDirect(1);
int res = CGL.CGLCreatePBuffer(width, height, renderTarget, internalFormat, 0, pbuffer);
@@ -218,12 +227,13 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
return pbuffer.get(0);
}
+ @Override
public void destroy(long pbuffer) {
int res = CGL.CGLDestroyPBuffer(pbuffer);
if (res != CGL.kCGLNoError) {
throw new GLException("Error destroying CGL-based pbuffer: error code " + res);
}
}
- }
-
+ }
+
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java
index 574226570..02da1e667 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -60,10 +60,12 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable {
super(factory, target, false);
}
+ @Override
protected void destroyImpl() {
setRealized(false);
}
-
+
+ @Override
protected void setRealizedImpl() {
if(realized) {
createBitmap();
@@ -72,6 +74,7 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable {
}
}
+ @Override
public GLContext createContext(GLContext shareWith) {
return new WindowsBitmapWGLContext(this, shareWith);
}
@@ -152,10 +155,10 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable {
hdc = 0;
throw new GLException("Error selecting bitmap into new device context");
}
-
+
config.updateGraphicsConfiguration(getFactory(), ns, null);
}
-
+
protected void destroyBitmap() {
NativeSurface ns = getNativeSurface();
if (ns.getSurfaceHandle() != 0) {
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java
index 3ba5508ab..2c1bcc265 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsDummyWGLDrawable.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -60,7 +60,7 @@ public class WindowsDummyWGLDrawable extends WindowsWGLDrawable {
private WindowsDummyWGLDrawable(GLDrawableFactory factory, GDISurface ns, boolean handleHwndLifecycle) {
super(factory, ns, true);
this.handleHwndLifecycle = handleHwndLifecycle;
-
+
if(NativeSurface.LOCK_SURFACE_NOT_READY >= ns.lockSurface()) {
throw new GLException("WindowsDummyWGLDrawable: surface not ready (lockSurface)");
}
@@ -90,11 +90,13 @@ public class WindowsDummyWGLDrawable extends WindowsWGLDrawable {
return new WindowsDummyWGLDrawable(factory, ns, handleWindowLifecycle);
}
+ @Override
public GLContext createContext(GLContext shareWith) {
// FIXME: figure out how to hook back in the Java 2D / JOGL bridge
return new WindowsWGLContext(this, shareWith);
}
+ @Override
protected void destroyImpl() {
if (handleHwndLifecycle && hwnd != 0) {
GDI.ShowWindow(hwnd, GDI.SW_HIDE);
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java
index 745782085..86441c688 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -106,6 +106,7 @@ public class WindowsExternalWGLContext extends WindowsWGLContext {
return new WindowsExternalWGLContext(new Drawable(factory, new WrappedSurface(cfg, hdc)), ctx, cfg);
}
+ @Override
public int makeCurrent() throws GLException {
// Save last context if necessary to allow external GLContexts to
// talk to other GLContexts created by this library
@@ -115,20 +116,24 @@ public class WindowsExternalWGLContext extends WindowsWGLContext {
setCurrent(null);
}
return super.makeCurrent();
- }
+ }
+ @Override
public void release() throws GLException {
super.release();
setCurrent(lastContext);
lastContext = null;
}
+ @Override
protected void makeCurrentImpl() throws GLException {
}
+ @Override
protected void releaseImpl() throws GLException {
}
+ @Override
protected void destroyImpl() throws GLException {
}
@@ -138,14 +143,17 @@ public class WindowsExternalWGLContext extends WindowsWGLContext {
super(factory, comp, true);
}
+ @Override
public GLContext createContext(GLContext shareWith) {
throw new GLException("Should not call this");
}
+ @Override
public int getWidth() {
throw new GLException("Should not call this");
}
+ @Override
public int getHeight() {
throw new GLException("Should not call this");
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java
index ad2e91bed..90a3ebba9 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -75,19 +75,22 @@ public class WindowsExternalWGLDrawable extends WindowsWGLDrawable {
}
+ @Override
public GLContext createContext(GLContext shareWith) {
return new WindowsWGLContext(this, shareWith);
}
-
+
public void setSize(int newWidth, int newHeight) {
throw new GLException("Should not call this");
}
+ @Override
public int getWidth() {
throw new GLException("Should not call this");
- }
+ }
+ @Override
public int getHeight() {
throw new GLException("Should not call this");
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java
index 6ad330ccc..2fe4d618e 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -48,6 +48,7 @@ public class WindowsOnscreenWGLDrawable extends WindowsWGLDrawable {
super(factory, component, false);
}
+ @Override
public GLContext createContext(GLContext shareWith) {
return new WindowsOnscreenWGLContext(this, shareWith);
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java
index 0988f3eca..3f3f3ccc4 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -62,15 +62,17 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
private long buffer; // pbuffer handle
private int floatMode;
-
+
protected WindowsPbufferWGLDrawable(GLDrawableFactory factory, NativeSurface target) {
super(factory, target, false);
}
+ @Override
protected void destroyImpl() {
setRealized(false);
}
-
+
+ @Override
protected void setRealizedImpl() {
if(realized) {
createPbuffer();
@@ -79,6 +81,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
}
}
+ @Override
public GLContext createContext(GLContext shareWith) {
return new WindowsPbufferWGLContext(this, shareWith);
}
@@ -125,41 +128,41 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
try {
long sharedHdc = sharedSurface.getSurfaceHandle();
WGLExt wglExt = sharedResource.getContext().getWGLExt();
-
+
if (DEBUG) {
System.out.println("Pbuffer config: " + config);
}
-
+
int[] iattributes = new int [2*WindowsWGLGraphicsConfiguration.MAX_ATTRIBS];
float[] fattributes = new float[1];
int[] floatModeTmp = new int[1];
int niattribs = 0;
int width, height;
-
+
GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable)config.getChosenCapabilities();
GLProfile glProfile = chosenCaps.getGLProfile();
-
+
if (DEBUG) {
System.out.println("Pbuffer parentHdc = " + toHexString(sharedHdc));
System.out.println("Pbuffer chosenCaps: " + chosenCaps);
}
-
+
if(!WindowsWGLGraphicsConfiguration.GLCapabilities2AttribList(chosenCaps,
iattributes, sharedResource, -1, floatModeTmp)){
throw new GLException("Pbuffer-related extensions not supported");
}
-
+
floatMode = floatModeTmp[0];
boolean rtt = chosenCaps.getPbufferRenderToTexture();
boolean rect = chosenCaps.getPbufferRenderToTextureRectangle();
boolean useFloat = chosenCaps.getPbufferFloatingPointBuffers();
// boolean ati = false;
-
+
/**
if (useFloat) {
ati = (floatMode == GLPbuffer.ATI_FLOAT);
} */
-
+
int[] pformats = new int[WindowsWGLGraphicsConfiguration.MAX_PFORMATS];
int nformats;
int[] nformatsTmp = new int[1];
@@ -175,7 +178,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
if (nformats <= 0) {
throw new GLException("pbuffer creation error: Couldn't find a suitable pixel format");
}
-
+
if (DEBUG) {
System.err.println("" + nformats + " suitable pixel formats found");
for (int i = 0; i < nformats; i++) {
@@ -183,7 +186,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
System.err.println("pixel format " + pformats[i] + " (index " + i + "): " + dbgCaps);
}
}
-
+
int pfdid = 0;
long tmpBuffer = 0;
{
@@ -191,10 +194,10 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
// Loop is a workaround for bugs in NVidia's recent drivers
for (whichFormat = 0; whichFormat < nformats; whichFormat++) {
int format = pformats[whichFormat];
-
+
// Create the p-buffer.
niattribs = 0;
-
+
if (rtt) {
iattributes[niattribs++] = WGLExt.WGL_TEXTURE_FORMAT_ARB;
if (useFloat) {
@@ -202,45 +205,45 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
} else {
iattributes[niattribs++] = WGLExt.WGL_TEXTURE_RGBA_ARB;
}
-
+
iattributes[niattribs++] = WGLExt.WGL_TEXTURE_TARGET_ARB;
iattributes[niattribs++] = rect ? WGLExt.WGL_TEXTURE_RECTANGLE_NV : WGLExt.WGL_TEXTURE_2D_ARB;
-
+
iattributes[niattribs++] = WGLExt.WGL_MIPMAP_TEXTURE_ARB;
iattributes[niattribs++] = GL.GL_FALSE;
-
+
iattributes[niattribs++] = WGLExt.WGL_PBUFFER_LARGEST_ARB;
iattributes[niattribs++] = GL.GL_FALSE;
}
-
+
iattributes[niattribs++] = 0;
-
+
tmpBuffer = wglExt.wglCreatePbufferARB(sharedHdc, format, getWidth(), getHeight(), iattributes, 0);
if (tmpBuffer != 0) {
// Done
break;
}
}
-
+
if (0 == tmpBuffer) {
throw new GLException("pbuffer creation error: wglCreatePbuffer() failed: tried " + nformats +
" pixel formats, last error was: " + wglGetLastError());
}
pfdid = pformats[whichFormat];
}
-
+
// Get the device context.
long tmpHdc = wglExt.wglGetPbufferDCARB(tmpBuffer);
if (tmpHdc == 0) {
throw new GLException("pbuffer creation error: wglGetPbufferDC() failed");
}
-
+
NativeSurface ns = getNativeSurface();
// Set up instance variables
buffer = tmpBuffer;
((SurfaceChangeable)ns).setSurfaceHandle(tmpHdc);
- cachedWGLExt = wglExt;
-
+ cachedWGLExt = wglExt;
+
// Re-query chosen pixel format
{
WGLGLCapabilities newCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedResource, sharedHdc, pfdid, glProfile, false, true);
@@ -252,7 +255,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
}
config.setCapsPFD(newCaps);
}
-
+
// Determine the actual width and height we were able to create.
int[] tmp = new int[1];
wglExt.wglQueryPbufferARB( buffer, WGLExt.WGL_PBUFFER_WIDTH_ARB, tmp, 0 );
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java
index 579b11940..ddcb898a9 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -60,6 +60,7 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl {
super(factory, comp, realized);
}
+ @Override
protected void setRealizedImpl() {
if(!realized) {
return; // nothing todo ..
@@ -73,8 +74,9 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl {
}
}
+ @Override
protected final void swapBuffersImpl() {
- // single-buffer is already filtered out @ GLDrawableImpl#swapBuffers()
+ // single-buffer is already filtered out @ GLDrawableImpl#swapBuffers()
final long t0;
if (PROFILING) {
t0 = System.currentTimeMillis();
@@ -97,6 +99,7 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl {
}
}
+ @Override
public GLDynamicLookupHelper getGLDynamicLookupHelper() {
return getFactoryImpl().getGLDynamicLookupHelper(0);
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11DummyGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11DummyGLXDrawable.java
index a1039e552..73f9871ea 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11DummyGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11DummyGLXDrawable.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package jogamp.opengl.x11.glx;
import javax.media.opengl.*;
@@ -34,20 +34,19 @@ import com.jogamp.nativewindow.WrappedSurface;
import com.jogamp.nativewindow.x11.X11GraphicsDevice;
import com.jogamp.nativewindow.x11.X11GraphicsScreen;
-import jogamp.nativewindow.*;
import jogamp.nativewindow.x11.*;
public class X11DummyGLXDrawable extends X11OnscreenGLXDrawable {
private static final int f_dim = 64;
private long dummyWindow = 0;
- /**
+ /**
* Due to the ATI Bug https://bugzilla.mozilla.org/show_bug.cgi?id=486277,
- * we cannot switch the Display as we please,
- * hence we reuse the target's screen configuration.
+ * we cannot switch the Display as we please,
+ * hence we reuse the target's screen configuration.
*/
public X11DummyGLXDrawable(X11GraphicsScreen screen, GLDrawableFactory factory, GLCapabilitiesImmutable caps) {
- super(factory,
+ super(factory,
new WrappedSurface(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(
caps, caps, null, screen)));
this.realized = true;
@@ -75,14 +74,17 @@ public class X11DummyGLXDrawable extends X11OnscreenGLXDrawable {
public void setSize(int width, int height) {
}
+ @Override
public int getWidth() {
return 1;
}
+ @Override
public int getHeight() {
return 1;
}
+ @Override
protected void destroyImpl() {
if(0!=dummyWindow) {
destroyHandle();
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
index 700b25662..53776386c 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -102,10 +102,12 @@ public class X11ExternalGLXContext extends X11GLXContext {
return new X11ExternalGLXContext(new Drawable(factory, ns), ctx);
}
+ @Override
protected boolean createImpl(GLContextImpl shareWith) {
return true;
}
+ @Override
public int makeCurrent() throws GLException {
// Save last context if necessary to allow external GLContexts to
// talk to other GLContexts created by this library
@@ -115,20 +117,24 @@ public class X11ExternalGLXContext extends X11GLXContext {
setCurrent(null);
}
return super.makeCurrent();
- }
+ }
+ @Override
public void release() throws GLException {
super.release();
setCurrent(lastContext);
lastContext = null;
}
+ @Override
protected void makeCurrentImpl() throws GLException {
}
+ @Override
protected void releaseImpl() throws GLException {
}
+ @Override
protected void destroyImpl() throws GLException {
}
@@ -138,14 +144,17 @@ public class X11ExternalGLXContext extends X11GLXContext {
super(factory, comp, true);
}
+ @Override
public GLContext createContext(GLContext shareWith) {
throw new GLException("Should not call this");
}
+ @Override
public int getWidth() {
throw new GLException("Should not call this");
}
+ @Override
public int getHeight() {
throw new GLException("Should not call this");
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java
index 4d0276163..83d15a0a2 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* 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.
*/
@@ -94,6 +94,7 @@ public class X11ExternalGLXDrawable extends X11GLXDrawable {
return new X11ExternalGLXDrawable(factory, ns);
}
+ @Override
public GLContext createContext(GLContext shareWith) {
return new Context(this, shareWith);
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java
index 61f2ef9c9..2c53ce6f3 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -50,10 +50,12 @@ public abstract class X11GLXDrawable extends GLDrawableImpl {
super(factory, comp, realized);
}
+ @Override
public GLDynamicLookupHelper getGLDynamicLookupHelper() {
return getFactoryImpl().getGLDynamicLookupHelper(0);
}
+ @Override
protected void setRealizedImpl() {
if(realized) {
X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration();
@@ -65,6 +67,7 @@ public abstract class X11GLXDrawable extends GLDrawableImpl {
}
}
+ @Override
protected final void swapBuffersImpl() {
// single-buffer is already filtered out @ GLDrawableImpl#swapBuffers()
GLX.glXSwapBuffers(getNativeSurface().getDisplayHandle(), getHandle());
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java
index b2a8326cb..6b7a65159 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -59,8 +59,8 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable {
@Override
public long getHandle() {
if(USE_GLXWINDOW && useGLXWindow) {
- return glXWindow;
- }
+ return glXWindow;
+ }
return super.getHandle();
}
@@ -95,6 +95,7 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable {
}
}
+ @Override
public GLContext createContext(GLContext shareWith) {
return new X11OnscreenGLXContext(this, shareWith);
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java
index da7b535cb..cf801b0db 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -45,16 +45,18 @@ import javax.media.nativewindow.*;
public class X11PbufferGLXDrawable extends X11GLXDrawable {
protected X11PbufferGLXDrawable(GLDrawableFactory factory, NativeSurface target) {
- /* GLCapabilities caps,
+ /* GLCapabilities caps,
GLCapabilitiesChooser chooser,
int width, int height */
super(factory, target, false);
}
+ @Override
protected void destroyImpl() {
setRealized(false);
}
-
+
+ @Override
protected void setRealizedImpl() {
if(realized) {
createPbuffer();
@@ -63,6 +65,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
}
}
+ @Override
public GLContext createContext(GLContext shareWith) {
return new X11PbufferGLXContext(this, shareWith);
}
@@ -90,7 +93,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
}
NativeSurface ns = getNativeSurface();
-
+
GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable)config.getChosenCapabilities();
if (chosenCaps.getPbufferRenderToTexture()) {
@@ -119,7 +122,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
// Set up instance variables
((SurfaceChangeable)ns).setSurfaceHandle(pbuffer);
-
+
// Determine the actual width and height we were able to create.
int[] tmp = new int[1];
GLX.glXQueryDrawable(display, pbuffer, GLX.GLX_WIDTH, tmp, 0);
@@ -127,7 +130,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
GLX.glXQueryDrawable(display, pbuffer, GLX.GLX_HEIGHT, tmp, 0);
int height = tmp[0];
((SurfaceChangeable)ns).surfaceSizeChanged(width, height);
-
+
if (DEBUG) {
System.err.println("Created pbuffer " + this);
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java
index 7dae20f80..d884df39d 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -51,10 +51,12 @@ public class X11PixmapGLXDrawable extends X11GLXDrawable {
super(factory, target, false);
}
+ @Override
protected void destroyImpl() {
setRealized(false);
}
-
+
+ @Override
protected void setRealizedImpl() {
if(realized) {
createPixmap();
@@ -63,10 +65,11 @@ public class X11PixmapGLXDrawable extends X11GLXDrawable {
}
}
+ @Override
public GLContext createContext(GLContext shareWith) {
return new X11PixmapGLXContext(this, shareWith);
}
-
+
private void createPixmap() {
NativeSurface ns = getNativeSurface();
X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration) ns.getGraphicsConfiguration();
--
cgit v1.2.3
From 4e2fb5389d22f2b16c1678843d4e31dd948c7902 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Wed, 27 Jun 2012 05:40:32 +0200
Subject: Misc cleanup: Add @Override, remove trailing whitespace
---
src/jogl/classes/javax/media/opengl/GLContext.java | 217 ++++++++---------
src/jogl/classes/jogamp/opengl/GLContextImpl.java | 265 ++++++++++++---------
src/jogl/classes/jogamp/opengl/egl/EGLContext.java | 47 ++--
.../jogamp/opengl/egl/EGLExternalContext.java | 21 +-
.../jogamp/opengl/egl/EGLOnscreenContext.java | 19 +-
.../jogamp/opengl/egl/EGLPbufferContext.java | 20 +-
.../jogamp/opengl/macosx/cgl/MacOSXCGLContext.java | 165 ++++++++-----
.../macosx/cgl/MacOSXOffscreenCGLContext.java | 22 +-
.../macosx/cgl/MacOSXOnscreenCGLContext.java | 28 +--
.../opengl/macosx/cgl/MacOSXPbufferCGLContext.java | 21 +-
.../windows/wgl/WindowsBitmapWGLContext.java | 19 +-
.../windows/wgl/WindowsOnscreenWGLContext.java | 20 +-
.../windows/wgl/WindowsPbufferWGLContext.java | 20 +-
.../opengl/windows/wgl/WindowsWGLContext.java | 71 ++++--
.../jogamp/opengl/x11/glx/X11GLXContext.java | 62 +++--
.../opengl/x11/glx/X11OnscreenGLXContext.java | 14 +-
.../opengl/x11/glx/X11PbufferGLXContext.java | 17 +-
.../jogamp/opengl/x11/glx/X11PixmapGLXContext.java | 19 +-
18 files changed, 603 insertions(+), 464 deletions(-)
(limited to 'src/jogl/classes/jogamp')
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index e23fa74f9..19501e589 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -66,14 +66,14 @@ import jogamp.opengl.GLContextImpl;
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 DEBUG = Debug.debug("GLContext");
public static final boolean TRACE_SWITCH = Debug.isPropertyDefined("jogl.debug.GLContext.TraceSwitch", true);
-
+
/** Reflects property jogl.debug.DebugGL. If true, the debug pipeline is enabled at context creation. */
public final static boolean DEBUG_GL = Debug.isPropertyDefined("jogl.debug.DebugGL", true);
/** Reflects property jogl.debug.TraceGL. If true, the trace pipeline is enabled at context creation. */
public final static boolean TRACE_GL = Debug.isPropertyDefined("jogl.debug.TraceGL", true);
-
+
/** Indicates that the context was not made current during the last call to {@link #makeCurrent makeCurrent}. */
public static final int CONTEXT_NOT_CURRENT = 0;
/** Indicates that the context was made current during the last call to {@link #makeCurrent makeCurrent}. */
@@ -93,19 +93,19 @@ public abstract class GLContext {
protected static final int CTX_OPTION_FORWARD = 1 << 4;
/** ARB_create_context related: flag debug. Not a cache key. */
public static final int CTX_OPTION_DEBUG = 1 << 5;
-
+
/** GL_ARB_ES2_compatibility implementation related: Context is compatible w/ ES2. Not a cache key. */
protected static final int CTX_IMPL_ES2_COMPAT = 1 << 8;
/** Context uses software rasterizer, otherwise hardware rasterizer. Cache key value. */
protected static final int CTX_IMPL_ACCEL_SOFT = 1 << 15;
-
+
private static ThreadLocal currentContext = new ThreadLocal();
private HashMap attachedObjectsByString = new HashMap();
private IntObjectHashMap attachedObjectsByInt = new IntObjectHashMap();
- // RecursiveLock maintains a queue of waiting Threads, ensuring the longest waiting thread will be notified at unlock.
+ // RecursiveLock maintains a queue of waiting Threads, ensuring the longest waiting thread will be notified at unlock.
protected RecursiveLock lock = LockFactory.createRecursiveLock();
/** The underlying native OpenGL context */
@@ -114,7 +114,7 @@ public abstract class GLContext {
protected GLContext() {
resetStates();
}
-
+
protected int ctxMajorVersion;
protected int ctxMinorVersion;
protected int ctxOptions;
@@ -188,7 +188,7 @@ public abstract class GLContext {
* the underlying drawable has not ben realized on the display) ,
* a value of CONTEXT_NOT_CURRENT is returned.
*
- *
+ *
* If the context is in use by another thread at the time of the
* call, then if isSynchronized() is true the call will
* block. If isSynchronized() is false, an exception will be
@@ -196,7 +196,7 @@ public abstract class GLContext {
*
*
* The drawable's surface is being locked at entry
- * and unlocked at {@link #release()}
+ * and unlocked at {@link #release()}
*
*
* @return CONTEXT_CURRENT if the context was successfully made current
@@ -216,7 +216,7 @@ public abstract class GLContext {
* Releases control of this GLContext from the current thread.
*
* The drawable's surface is being unlocked at exit,
- * assumed to be locked by {@link #makeCurrent()}.
+ * assumed to be locked by {@link #makeCurrent()}.
*
*
* @throws GLException if the context had not previously been made
@@ -284,18 +284,18 @@ public abstract class GLContext {
* @return true if this GLContext is current on this thread
*/
public final boolean isCurrent() {
- return getCurrent() == this ;
+ return getCurrent() == this ;
}
/**
* @throws GLException if this GLContext is not current on this thread
*/
- public final void validateCurrent() throws GLException {
+ public final void validateCurrent() throws GLException {
if(getCurrent() != this) {
throw new GLException(getThreadName()+": This context is not current. Current context: "+getCurrent()+", this context "+this);
}
}
-
+
/**
* Sets the thread-local variable returned by {@link #getCurrent}
* and has no other side-effects. For use by third parties adding
@@ -307,14 +307,14 @@ public abstract class GLContext {
}
currentContext.set(cur);
}
-
+
/**
* Destroys this OpenGL context and frees its associated
* resources.
*
* The context may be current w/o recursion when calling destroy(),
* in which case this method destroys the context and releases the lock.
- *
+ *
*/
public abstract void destroy();
@@ -337,8 +337,8 @@ public abstract class GLContext {
*/
public final long getHandle() { return contextHandle; }
- /**
- * Indicates whether the underlying OpenGL context has been created.
+ /**
+ * Indicates whether the underlying OpenGL context has been created.
*/
public final boolean isCreated() {
return 0 != contextHandle;
@@ -369,7 +369,7 @@ public abstract class GLContext {
public final Object detachObject(int name) {
return attachedObjectsByInt.remove(name);
}
-
+
/**
* Sets the attached user object for the given name to this GLContext.
* Returns the previously set object or null.
@@ -381,10 +381,11 @@ public abstract class GLContext {
public final Object detachObject(String name) {
return attachedObjectsByString.remove(name);
}
-
+
/**
* Classname, GL, GLDrawable
*/
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
@@ -433,7 +434,7 @@ public abstract class GLContext {
* javax.media.opengl.GL#glPolygonOffset(float,float)} is available).
*/
public abstract boolean isFunctionAvailable(String glFunctionName);
-
+
/**
* Returns true if the specified OpenGL extension can be
* successfully called using this GL context given the current host (OpenGL
@@ -445,10 +446,10 @@ public abstract class GLContext {
* "GL_VERTEX_PROGRAM_ARB").
*/
public abstract boolean isExtensionAvailable(String glExtensionName);
-
+
/** Returns the number of platform extensions */
public abstract int getPlatformExtensionCount();
-
+
/** Returns a non-null (but possibly empty) string containing the
space-separated list of available platform-dependent (e.g., WGL,
GLX) extensions. Can only be called while this context is
@@ -457,7 +458,7 @@ public abstract class GLContext {
/** Returns the number of OpenGL extensions */
public abstract int getGLExtensionCount();
-
+
/** Returns a non-null (but possibly empty) string containing the
space-separated list of available extensions.
Can only be called while this context is current.
@@ -479,8 +480,8 @@ public abstract class GLContext {
* @see GLAutoDrawable#setContextCreationFlags(int)
*/
public abstract void setContextCreationFlags(int flags);
-
- /**
+
+ /**
* Returns a valid OpenGL version string, ie
*
* major.minor ([option]?[options,]*) - gl-version
@@ -509,7 +510,7 @@ public abstract class GLContext {
*
row 2, cell 1
*
row 2, cell 2
*
- *
+ *
*
*
*
ES2
2.0 (ES profile, ES2 compatible, hardware) - 2.0 ES Profile
@@ -520,7 +521,7 @@ public abstract class GLContext {
*
+ *
*/
public final String getGLVersion() {
return ctxVersionString;
@@ -533,28 +534,28 @@ public abstract class GLContext {
public final boolean isGLForwardCompatible() { return ( 0 != ( CTX_OPTION_FORWARD & ctxOptions ) ); }
public final boolean isGLDebugEnabled() { return ( 0 != ( CTX_OPTION_DEBUG & ctxOptions ) ); }
public final boolean isCreatedWithARBMethod() { return ( 0 != ( CTX_IS_ARB_CREATED & ctxOptions ) ); }
-
+
/**
- * @return true if this context is an ES2 context or implements
- * the extension GL_ARB_ES2_compatibility, otherwise false
+ * @return true if this context is an ES2 context or implements
+ * the extension GL_ARB_ES2_compatibility, otherwise false
*/
public final boolean isGLES2Compatible() {
return 0 != ( ctxOptions & CTX_IMPL_ES2_COMPAT ) ;
}
-
+
public final boolean hasGLSL() {
return isGL2ES2() ;
}
-
+
/** Note: The GL impl. may return a const value, ie {@link GLES2#isNPOTTextureAvailable()} always returns true. */
public boolean isNPOTTextureAvailable() {
return isGL3() || isGLES2Compatible() || isExtensionAvailable(GL_ARB_texture_non_power_of_two);
}
private static final String GL_ARB_texture_non_power_of_two = "GL_ARB_texture_non_power_of_two";
-
+
public boolean isTextureFormatBGRA8888Available() {
- return isGL2GL3() ||
- isExtensionAvailable("GL_EXT_texture_format_BGRA8888") ||
+ return isGL2GL3() ||
+ isExtensionAvailable("GL_EXT_texture_format_BGRA8888") ||
isExtensionAvailable("GL_IMG_texture_format_BGRA8888") ;
}
@@ -610,11 +611,11 @@ public abstract class GLContext {
/**
* Set the swap interval if the current context.
- * @param interval Should be ≥ 0. 0 Disables the vertical synchronisation,
+ * @param interval Should be ≥ 0. 0 Disables the vertical synchronisation,
* where ≥ 1 is the number of vertical refreshes before a swap buffer occurs.
* A value < 0 is ignored.
- * @return true if the operation was successful, otherwise false
- *
+ * @return true if the operation was successful, otherwise false
+ *
* @throws GLException if the context is not current.
*/
public final boolean setSwapInterval(int interval) throws GLException {
@@ -627,16 +628,16 @@ public abstract class GLContext {
}
return false;
}
- protected boolean setSwapIntervalImpl(int interval) {
- return false;
- }
- /** Return the current swap interval.
+ protected boolean setSwapIntervalImpl(int interval) {
+ return false;
+ }
+ /** Return the current swap interval.
*
* If the context has not been made current at all,
* the default value -1 is returned.
*
*
- * The default value for a valid context is 1 for
+ * The default value for a valid context is 1 for
* an EGL based profile (ES1 or ES2) and -1 (undefined)
* for desktop.
*
@@ -652,9 +653,9 @@ public abstract class GLContext {
currentSwapInterval = 1;
} else {
currentSwapInterval = -1;
- }
+ }
}
-
+
public final boolean queryMaxSwapGroups(int[] maxGroups, int maxGroups_offset,
int[] maxBarriers, int maxBarriers_offset) {
validateCurrent();
@@ -667,21 +668,21 @@ public abstract class GLContext {
return joinSwapGroupImpl(group);
}
protected boolean joinSwapGroupImpl(int group) { /** nop per default .. **/ return false; }
- protected int currentSwapGroup = -1; // default: not set yet ..
+ protected int currentSwapGroup = -1; // default: not set yet ..
public int getSwapGroup() {
return currentSwapGroup;
}
public final boolean bindSwapBarrier(int group, int barrier) {
validateCurrent();
- return bindSwapBarrierImpl(group, barrier);
+ return bindSwapBarrierImpl(group, barrier);
}
protected boolean bindSwapBarrierImpl(int group, int barrier) { /** nop per default .. **/ return false; }
-
+
/**
- * @return The extension implementing the GLDebugOutput feature,
- * either GL_ARB_debug_output or GL_AMD_debug_output.
- * If unavailable or called before initialized via {@link #makeCurrent()}, null is returned.
+ * @return The extension implementing the GLDebugOutput feature,
+ * either GL_ARB_debug_output or GL_AMD_debug_output.
+ * If unavailable or called before initialized via {@link #makeCurrent()}, null is returned.
*/
public abstract String getGLDebugMessageExtension();
@@ -690,84 +691,84 @@ public abstract class GLContext {
* @see #setSynchronous(boolean)
*/
public abstract boolean isGLDebugSynchronous();
-
+
/**
* Enables or disables the synchronous debug behavior via
- * {@link GL2GL3#GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB glEnable/glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB)},
+ * {@link GL2GL3#GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB glEnable/glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB)},
* if extension is {@link #GL_ARB_debug_output}.
* There is no equivalent for {@link #GL_AMD_debug_output}.
- *
The default is true, ie {@link GL2GL3#GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB}.
+ *
The default is true, ie {@link GL2GL3#GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB}.
*/
public abstract void setGLDebugSynchronous(boolean synchronous);
-
+
/**
* @return true if the GLDebugOutput feature is enabled or not.
*/
public abstract boolean isGLDebugMessageEnabled();
-
+
/**
- * Enables or disables the GLDebugOutput feature of extension GL_ARB_debug_output
+ * Enables or disables the GLDebugOutput feature of extension GL_ARB_debug_output
* or GL_AMD_debug_output, if available.
- *
+ *
*
To enable the GLDebugOutput feature {@link #enableGLDebugMessage(boolean) enableGLDebugMessage(true)}
* or {@link #setContextCreationFlags(int) setContextCreationFlags}({@link GLContext#CTX_OPTION_DEBUG})
* shall be called before context creation via {@link #makeCurrent()}!
- *
- *
In case {@link GLAutoDrawable} are being used,
+ *
+ *
In case {@link GLAutoDrawable} are being used,
* {@link GLAutoDrawable#setContextCreationFlags(int) glAutoDrawable.setContextCreationFlags}({@link GLContext#CTX_OPTION_DEBUG})
* shall be issued before context creation via {@link #makeCurrent()}!
- *
+ *
*
After context creation, the GLDebugOutput feature may be enabled or disabled at any time using this method.
- *
+ *
* @param enable If true enables, otherwise disables the GLDebugOutput feature.
- *
+ *
* @throws GLException if this context is not current or GLDebugOutput registration failed (enable)
- *
+ *
* @see #setContextCreationFlags(int)
* @see #addGLDebugListener(GLDebugListener)
* @see GLAutoDrawable#setContextCreationFlags(int)
*/
public abstract void enableGLDebugMessage(boolean enable) throws GLException;
-
+
/**
* Add {@link GLDebugListener}.
- *
+ *
* @param listener {@link GLDebugListener} handling {@GLDebugMessage}s
- * @see #enableGLDebugMessage(boolean)
+ * @see #enableGLDebugMessage(boolean)
* @see #removeGLDebugListener(GLDebugListener)
*/
public abstract void addGLDebugListener(GLDebugListener listener);
-
+
/**
* Remove {@link GLDebugListener}.
- *
+ *
* @param listener {@link GLDebugListener} handling {@GLDebugMessage}s
- * @see #enableGLDebugMessage(boolean)
+ * @see #enableGLDebugMessage(boolean)
* @see #addGLDebugListener(GLDebugListener)
*/
public abstract void removeGLDebugListener(GLDebugListener listener);
-
+
/**
- * Generic entry for {@link GL2GL3#glDebugMessageControlARB(int, int, int, int, IntBuffer, boolean)}
+ * Generic entry for {@link GL2GL3#glDebugMessageControlARB(int, int, int, int, IntBuffer, boolean)}
* and {@link GL2GL3#glDebugMessageEnableAMD(int, int, int, IntBuffer, boolean)} of the GLDebugOutput feature.
- * @see #enableGLDebugMessage(boolean)
+ * @see #enableGLDebugMessage(boolean)
*/
public abstract void glDebugMessageControl(int source, int type, int severity, int count, IntBuffer ids, boolean enabled);
-
+
/**
- * Generic entry for {@link GL2GL3#glDebugMessageControlARB(int, int, int, int, int[], int, boolean)}
- * and {@link GL2GL3#glDebugMessageEnableAMD(int, int, int, int[], int, boolean)} of the GLDebugOutput feature.
- * @see #enableGLDebugMessage(boolean)
+ * Generic entry for {@link GL2GL3#glDebugMessageControlARB(int, int, int, int, int[], int, boolean)}
+ * and {@link GL2GL3#glDebugMessageEnableAMD(int, int, int, int[], int, boolean)} of the GLDebugOutput feature.
+ * @see #enableGLDebugMessage(boolean)
*/
public abstract void glDebugMessageControl(int source, int type, int severity, int count, int[] ids, int ids_offset, boolean enabled);
-
+
/**
- * Generic entry for {@link GL2GL3#glDebugMessageInsertARB(int, int, int, int, int, String)}
+ * Generic entry for {@link GL2GL3#glDebugMessageInsertARB(int, int, int, int, int, String)}
* and {@link GL2GL3#glDebugMessageInsertAMD(int, int, int, int, String)} of the GLDebugOutput feature.
- * @see #enableGLDebugMessage(boolean)
+ * @see #enableGLDebugMessage(boolean)
*/
public abstract void glDebugMessageInsert(int source, int type, int id, int severity, String buf);
-
+
public static final int GL_VERSIONS[][] = {
/* 0.*/ { -1 },
/* 1.*/ { 0, 1, 2, 3, 4, 5 },
@@ -832,7 +833,7 @@ public abstract class GLContext {
//
/**
- * @see #getDeviceVersionAvailableKey(javax.media.nativewindow.AbstractGraphicsDevice, int, int)
+ * @see #getDeviceVersionAvailableKey(javax.media.nativewindow.AbstractGraphicsDevice, int, int)
*/
protected static /*final*/ HashMap deviceVersionAvailable = new HashMap();
@@ -863,11 +864,11 @@ public abstract class GLContext {
}
}
}
-
+
/** clears the device/context mappings as well as the GL/GLX proc address tables. */
protected static void shutdown() {
deviceVersionAvailable.clear();
- deviceVersionsAvailableSet.clear();
+ deviceVersionsAvailableSet.clear();
GLContextImpl.shutdownImpl(); // well ..
}
@@ -919,7 +920,7 @@ public abstract class GLContext {
* @param minor if not null, returns the used minor version
* @param ctp if not null, returns the used context profile
*/
- protected static boolean getAvailableGLVersion(AbstractGraphicsDevice device, int reqMajor, int reqProfile,
+ protected static boolean getAvailableGLVersion(AbstractGraphicsDevice device, int reqMajor, int reqProfile,
int[] major, int minor[], int ctp[]) {
Integer valI = getAvailableGLVersion(device, reqMajor, reqProfile);
@@ -940,34 +941,34 @@ public abstract class GLContext {
}
return true;
}
-
- /**
+
+ /**
* returns the highest GLProfile string regarding the implementation version and context profile bits.
* @throws GLException if version and context profile bits could not be mapped to a GLProfile
*/
- protected static String getGLProfile(int major, int minor, int ctp)
+ protected static String getGLProfile(int major, int minor, int ctp)
throws GLException {
- if(0 != ( CTX_PROFILE_COMPAT & ctp )) {
+ if(0 != ( CTX_PROFILE_COMPAT & ctp )) {
if(major >= 4) { return GLProfile.GL4bc; }
else if(major == 3 && minor >= 1) { return GLProfile.GL3bc; }
- else { return GLProfile.GL2; }
+ else { return GLProfile.GL2; }
} else if(0 != ( CTX_PROFILE_CORE & ctp )) {
if(major >= 4) { return GLProfile.GL4; }
- else if(major == 3 && minor >= 1) { return GLProfile.GL3; }
+ else if(major == 3 && minor >= 1) { return GLProfile.GL3; }
} else if(0 != ( CTX_PROFILE_ES & ctp )) {
if(major == 2) { return GLProfile.GLES2; }
- else if(major == 1) { return GLProfile.GLES1; }
+ else if(major == 1) { return GLProfile.GLES1; }
}
throw new GLException("Unhandled OpenGL version/profile: "+GLContext.getGLVersion(major, minor, ctp, null));
}
-
- /**
+
+ /**
* @param major Key Value either 1, 2, 3 or 4
* @param profile Key Value either {@link #CTX_PROFILE_COMPAT}, {@link #CTX_PROFILE_CORE} or {@link #CTX_PROFILE_ES}
* @return the highest GLProfile string regarding the version and profile bits.
* @throws GLException if version and context profile bits could not be mapped to a GLProfile
- */
- public static String getAvailableGLProfile(AbstractGraphicsDevice device, int reqMajor, int reqProfile)
+ */
+ public static String getAvailableGLProfile(AbstractGraphicsDevice device, int reqMajor, int reqProfile)
throws GLException {
int major[] = { 0 };
int minor[] = { 0 };
@@ -1046,9 +1047,9 @@ public abstract class GLContext {
needColon = appendString(sb, "ES profile", needColon, 0 != ( CTX_PROFILE_ES & ctp ));
needColon = appendString(sb, "Compatibility profile", needColon, 0 != ( CTX_PROFILE_COMPAT & ctp ));
needColon = appendString(sb, "Core profile", needColon, 0 != ( CTX_PROFILE_CORE & ctp ));
- needColon = appendString(sb, "forward", needColon, 0 != ( CTX_OPTION_FORWARD & ctp ));
+ needColon = appendString(sb, "forward", needColon, 0 != ( CTX_OPTION_FORWARD & ctp ));
needColon = appendString(sb, "arb", needColon, 0 != ( CTX_IS_ARB_CREATED & ctp ));
- needColon = appendString(sb, "debug", needColon, 0 != ( CTX_OPTION_DEBUG & ctp ));
+ needColon = appendString(sb, "debug", needColon, 0 != ( CTX_OPTION_DEBUG & ctp ));
needColon = appendString(sb, "ES2 compatible", needColon, 0 != ( CTX_IMPL_ES2_COMPAT & ctp ));
if( 0 != ( CTX_IMPL_ACCEL_SOFT & ctp ) ) {
needColon = appendString(sb, "software", needColon, true);
@@ -1064,9 +1065,9 @@ public abstract class GLContext {
}
//
- // internal string utils
+ // internal string utils
//
-
+
protected static String toHexString(int hex) {
return "0x" + Integer.toHexString(hex);
}
@@ -1085,7 +1086,7 @@ public abstract class GLContext {
}
return needColon;
}
-
+
protected static String getThreadName() {
return Thread.currentThread().getName();
}
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index ff1b65520..8c1b56dbd 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -56,7 +56,7 @@ import javax.media.nativewindow.AbstractGraphicsConfiguration;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.NativeSurface;
import javax.media.opengl.GL;
-import javax.media.opengl.GL3;
+import javax.media.opengl.GL2GL3;
import javax.media.opengl.GLCapabilitiesImmutable;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDebugListener;
@@ -74,7 +74,7 @@ public abstract class GLContextImpl extends GLContext {
private String contextFQN;
private int additionalCtxCreationFlags;
-
+
// Cache of the functions that are available to be called at the current
// moment in time
protected ExtensionAvailabilityCache extensionAvailability;
@@ -84,14 +84,14 @@ public abstract class GLContextImpl extends GLContext {
private String glRenderer;
private String glRendererLowerCase;
-
+
// Tracks creation and initialization of buffer objects to avoid
// repeated glGet calls upon glMapBuffer operations
private GLBufferSizeTracker bufferSizeTracker; // Singleton - Set by GLContextShareSet
private GLBufferStateTracker bufferStateTracker = new GLBufferStateTracker();
private GLStateTracker glStateTracker = new GLStateTracker();
private GLDebugMessageHandler glDebugHandler = null;
-
+
protected GLDrawableImpl drawable;
protected GLDrawableImpl drawableRead;
@@ -112,9 +112,9 @@ public abstract class GLContextImpl extends GLContext {
public static void shutdownImpl() {
mappedExtensionAvailabilityCache.clear();
mappedGLProcAddress.clear();
- mappedGLXProcAddress.clear();
+ mappedGLXProcAddress.clear();
}
-
+
public GLContextImpl(GLDrawableImpl drawable, GLContext shareWith) {
super();
@@ -125,7 +125,7 @@ public abstract class GLContextImpl extends GLContext {
this.drawable = drawable;
this.drawableRead = drawable;
-
+
this.glDebugHandler = new GLDebugMessageHandler(this);
}
@@ -156,10 +156,11 @@ public abstract class GLContextImpl extends GLContext {
glRenderer = "";
glRendererLowerCase = glRenderer;
-
+
super.resetStates();
}
+ @Override
public final void setGLReadDrawable(GLDrawable read) {
if(null!=read && drawable!=read && !isGLReadDrawableAvailable()) {
throw new GLException("GL Read Drawable not available");
@@ -174,10 +175,12 @@ public abstract class GLContextImpl extends GLContext {
}
}
+ @Override
public final GLDrawable getGLReadDrawable() {
return drawableRead;
}
+ @Override
public final GLDrawable getGLDrawable() {
return drawable;
}
@@ -186,10 +189,12 @@ public abstract class GLContextImpl extends GLContext {
return (GLDrawableImpl) getGLDrawable();
}
+ @Override
public final GL getGL() {
return gl;
}
+ @Override
public GL setGL(GL gl) {
if(DEBUG) {
String sgl1 = (null!=this.gl)?this.gl.getClass().getSimpleName()+", "+this.gl.toString():"";
@@ -204,12 +209,12 @@ public abstract class GLContextImpl extends GLContext {
/**
* Call this method to notify the OpenGL context
* that the drawable has changed (size or position).
- *
+ *
*
- * This is currently being used and overridden by Mac OSX,
+ * This is currently being used and overridden by Mac OSX,
* which issues the {@link jogamp.opengl.macosx.cgl.CGL#updateContext(long) NSOpenGLContext update()} call.
*
- *
+ *
* @throws GLException
*/
protected void drawableUpdatedNotify() throws GLException { }
@@ -217,6 +222,7 @@ public abstract class GLContextImpl extends GLContext {
public abstract Object getPlatformGLExtensions();
// Note: the surface is locked within [makeCurrent .. swap .. release]
+ @Override
public void release() throws GLException {
release(false);
}
@@ -228,7 +234,7 @@ public abstract class GLContextImpl extends GLContext {
throw new GLException("Context not current on current thread "+Thread.currentThread().getName()+": "+this);
}
final boolean actualRelease = force || lock.getHoldCount() == 1 ;
- try {
+ try {
if( actualRelease ) {
if (contextHandle != 0) { // allow dbl-release
releaseImpl();
@@ -248,8 +254,9 @@ public abstract class GLContextImpl extends GLContext {
}
protected abstract void releaseImpl() throws GLException;
+ @Override
public final void destroy() {
- if (DEBUG || TRACE_SWITCH) {
+ if (DEBUG || TRACE_SWITCH) {
System.err.println(getThreadName() + ": GLContextImpl.destroy.0: " + toHexString(contextHandle) +
", isShared "+GLContextShareSet.isShared(this)+" - "+lock);
}
@@ -268,7 +275,7 @@ public abstract class GLContextImpl extends GLContext {
if ( lock.getHoldCount() > 2 ) {
throw new GLException(getThreadName() + ": Lock was hold more than once - makeCurrent/release imbalance: "+lock);
}
- try {
+ try {
// release current context
if(null != glDebugHandler) {
if(lock.getHoldCount() == 1) {
@@ -279,7 +286,7 @@ public abstract class GLContextImpl extends GLContext {
}
if(lock.getHoldCount() > 1) {
// pending release() after makeCurrent()
- release(true);
+ release(true);
}
destroyImpl();
contextHandle = 0;
@@ -303,6 +310,7 @@ public abstract class GLContextImpl extends GLContext {
}
protected abstract void destroyImpl() throws GLException;
+ @Override
public final void copy(GLContext source, int mask) throws GLException {
if (source.getHandle() == 0) {
throw new GLException("Source OpenGL context has not been created");
@@ -364,6 +372,7 @@ public abstract class GLContextImpl extends GLContext {
* @see #mapVersionAvailable
* @see #destroyContextARBImpl
*/
+ @Override
public int makeCurrent() throws GLException {
boolean unlockContextAndDrawable = false;
int res = CONTEXT_NOT_CURRENT;
@@ -377,9 +386,9 @@ public abstract class GLContextImpl extends GLContext {
if (NativeSurface.LOCK_SURFACE_CHANGED == lockRes) {
drawable.updateHandle();
}
-
+
lock.lock();
- try {
+ try {
// One context can only be current by one thread,
// and one thread can only have one context current!
final GLContext current = getCurrent();
@@ -395,13 +404,13 @@ public abstract class GLContextImpl extends GLContext {
} else {
current.release();
}
- }
+ }
if (0 == drawable.getHandle()) {
throw new GLException("drawable has invalid handle: "+drawable);
}
res = makeCurrentWithinLock(lockRes);
unlockContextAndDrawable = CONTEXT_NOT_CURRENT == res;
-
+
/**
* FIXME: refactor dependence on Java 2D / JOGL bridge
if ((tracker != null) &&
@@ -416,7 +425,7 @@ public abstract class GLContextImpl extends GLContext {
} finally {
if (unlockContextAndDrawable) {
lock.unlock();
- }
+ }
}
} catch (RuntimeException e) {
unlockContextAndDrawable = true;
@@ -424,9 +433,9 @@ public abstract class GLContextImpl extends GLContext {
} finally {
if (unlockContextAndDrawable) {
drawable.unlockSurface();
- }
+ }
}
-
+
if (res == CONTEXT_NOT_CURRENT) {
if(TRACE_SWITCH) {
System.err.println(getThreadName() +": GLContext.ContextSwitch: - switch - CONTEXT_NOT_CURRENT - "+lock);
@@ -435,9 +444,9 @@ public abstract class GLContextImpl extends GLContext {
setCurrent(this);
if(res == CONTEXT_CURRENT_NEW) {
// check if the drawable's and the GL's GLProfile are equal
- // throws an GLException if not
+ // throws an GLException if not
getGLDrawable().getGLProfile().verifyEquality(gl.getGLProfile());
-
+
glDebugHandler.init( isGL2GL3() && isGLDebugEnabled() );
if(DEBUG_GL) {
@@ -448,7 +457,7 @@ public abstract class GLContextImpl extends GLContext {
}
if(TRACE_GL) {
gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) );
- }
+ }
if(DEBUG || TRACE_SWITCH) {
System.err.println(getThreadName() +": GLContext.ContextSwitch: - switch - CONTEXT_CURRENT_NEW - "+lock);
}
@@ -474,7 +483,7 @@ public abstract class GLContextImpl extends GLContext {
// only impacts w/ createContextARB(..)
additionalCtxCreationFlags |= GLContext.CTX_OPTION_DEBUG ;
}
-
+
final GLContextImpl shareWith = (GLContextImpl) GLContextShareSet.getShareContext(this);
if (null != shareWith) {
shareWith.getDrawableImpl().lockSurface();
@@ -485,7 +494,7 @@ public abstract class GLContextImpl extends GLContext {
} finally {
if (null != shareWith) {
shareWith.getDrawableImpl().unlockSurface();
- }
+ }
}
if (DEBUG) {
if(created) {
@@ -493,16 +502,16 @@ public abstract class GLContextImpl extends GLContext {
} else {
System.err.println(getThreadName() + ": Create GL context FAILED for " + getClass().getName());
}
- }
+ }
if(!created) {
return CONTEXT_NOT_CURRENT;
}
-
+
// finalize mapping the available GLVersions, in case it's not done yet
- {
+ {
final AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice device = config.getScreen().getDevice();
-
+
if( !GLContext.getAvailableGLVersionsSet(device) ) {
final int reqMajor;
final int reqProfile;
@@ -511,7 +520,7 @@ public abstract class GLContextImpl extends GLContext {
reqMajor = ctxMajorVersion;
reqProfile = GLContext.CTX_PROFILE_ES;
} else {
- if(ctxMajorVersion<3 || ctxMajorVersion==3 && ctxMinorVersion==0) {
+ if(ctxMajorVersion<3 || ctxMajorVersion==3 && ctxMinorVersion==0) {
reqMajor = 2;
} else {
reqMajor = ctxMajorVersion;
@@ -537,30 +546,30 @@ public abstract class GLContextImpl extends GLContext {
return CONTEXT_CURRENT;
}
protected abstract void makeCurrentImpl() throws GLException;
-
- /**
+
+ /**
* Platform dependent entry point for context creation.
*
* This method is called from {@link #makeCurrentWithinLock()} .. {@link #makeCurrent()} .
*
- * The implementation shall verify this context with a
+ * The implementation shall verify this context with a
* MakeContextCurrent call.
*
* The implementation must leave the context current.
- *
+ *
* @param share the shared context or null
* @return the valid and current context if successful, or null
* @throws GLException
*/
protected abstract boolean createImpl(GLContextImpl sharedWith) throws GLException ;
- /**
+ /**
* Platform dependent but harmonized implementation of the ARB_create_context
* mechanism to create a context.
*
* This method is called from {@link #createContextARB}, {@link #createImpl(GLContextImpl)} .. {@link #makeCurrent()} .
*
- * The implementation shall verify this context with a
+ * The implementation shall verify this context with a
* MakeContextCurrent call.
*
* The implementation must leave the context current.
@@ -582,7 +591,7 @@ public abstract class GLContextImpl extends GLContext {
* @see #createContextARBImpl
* @see #destroyContextARBImpl
*/
- protected abstract long createContextARBImpl(long share, boolean direct, int ctxOptionFlags,
+ protected abstract long createContextARBImpl(long share, boolean direct, int ctxOptionFlags,
int major, int minor);
/**
@@ -616,7 +625,7 @@ public abstract class GLContextImpl extends GLContext {
* @see #createContextARBImpl
* @see #destroyContextARBImpl
*/
- protected final long createContextARB(long share, boolean direct)
+ protected final long createContextARB(long share, boolean direct)
{
AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration();
AbstractGraphicsDevice device = config.getScreen().getDevice();
@@ -631,7 +640,7 @@ public abstract class GLContextImpl extends GLContext {
if ( !GLContext.getAvailableGLVersionsSet(device) ) {
if(!mapGLVersions(device)) {
- // none of the ARB context creation calls was successful, bail out
+ // none of the ARB context creation calls was successful, bail out
return 0;
}
}
@@ -662,13 +671,13 @@ public abstract class GLContextImpl extends GLContext {
return _ctx;
}
- private final boolean mapGLVersions(AbstractGraphicsDevice device) {
+ private final boolean mapGLVersions(AbstractGraphicsDevice device) {
synchronized (GLContext.deviceVersionAvailable) {
boolean success = false;
// Following GLProfile.GL_PROFILE_LIST_ALL order of profile detection { GL4bc, GL3bc, GL2, GL4, GL3, GL2GL3, GLES2, GL2ES2, GLES1, GL2ES1 }
success |= createContextARBMapVersionsAvailable(4, true /* compat */); // GL4bc
success |= createContextARBMapVersionsAvailable(3, true /* compat */); // GL3bc
- success |= createContextARBMapVersionsAvailable(2, true /* compat */); // GL2
+ success |= createContextARBMapVersionsAvailable(2, true /* compat */); // GL2
success |= createContextARBMapVersionsAvailable(4, false /* core */); // GL4
success |= createContextARBMapVersionsAvailable(3, false /* core */); // GL3
if(success) {
@@ -676,7 +685,7 @@ public abstract class GLContextImpl extends GLContext {
GLContext.setAvailableGLVersionsSet(device);
} else if (DEBUG) {
System.err.println(getThreadName() + ": createContextARB-MapVersions NONE for :"+device);
- }
+ }
return success;
}
}
@@ -704,12 +713,12 @@ public abstract class GLContextImpl extends GLContext {
majorMax=3; minorMax=GLContext.getMaxMinor(majorMax);
majorMin=3; minorMin=1;
} else /* if( glp.isGL2() ) */ {
- // our minimum desktop OpenGL runtime requirements are 1.1,
- // nevertheless we restrict ARB context creation to 2.0 to spare us futile attempts
+ // our minimum desktop OpenGL runtime requirements are 1.1,
+ // nevertheless we restrict ARB context creation to 2.0 to spare us futile attempts
majorMax=3; minorMax=0;
majorMin=2; minorMin=0;
}
- _context = createContextARBVersions(0, true, ctp,
+ _context = createContextARBVersions(0, true, ctp,
/* max */ majorMax, minorMax,
/* min */ majorMin, minorMin,
/* res */ major, minor);
@@ -718,7 +727,7 @@ public abstract class GLContextImpl extends GLContext {
// try w/ FORWARD instead of CORE
ctp &= ~CTX_PROFILE_CORE ;
ctp |= CTX_OPTION_FORWARD ;
- _context = createContextARBVersions(0, true, ctp,
+ _context = createContextARBVersions(0, true, ctp,
/* max */ majorMax, minorMax,
/* min */ majorMin, minorMin,
/* res */ major, minor);
@@ -727,15 +736,15 @@ public abstract class GLContextImpl extends GLContext {
ctp &= ~CTX_PROFILE_CORE ;
ctp &= ~CTX_OPTION_FORWARD ;
ctp |= CTX_PROFILE_COMPAT ;
- _context = createContextARBVersions(0, true, ctp,
+ _context = createContextARBVersions(0, true, ctp,
/* max */ majorMax, minorMax,
/* min */ majorMin, minorMin,
/* res */ major, minor);
}
}
if(0!=_context) {
- AbstractGraphicsDevice device = drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice();
- // ctxMajorVersion, ctxMinorVersion, ctxOptions is being set by
+ AbstractGraphicsDevice device = drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice();
+ // ctxMajorVersion, ctxMinorVersion, ctxOptions is being set by
// createContextARBVersions(..) -> setGLFunctionAvailbility(..) -> setContextVersion(..)
GLContext.mapAvailableGLVersion(device, reqMajor, reqProfile, ctxMajorVersion, ctxMinorVersion, ctxOptions);
destroyContextARBImpl(_context);
@@ -743,19 +752,19 @@ public abstract class GLContextImpl extends GLContext {
System.err.println(getThreadName() + ": createContextARB-MapVersionsAvailable HAVE: " +reqMajor+"."+reqProfile+ " -> "+getGLVersion());
}
// only reset [and hence modify] this context state if ARB context creation was successful
- resetStates();
+ resetStates();
return true;
} else {
if (DEBUG) {
System.err.println(getThreadName() + ": createContextARB-MapVersionsAvailable NOPE: "+reqMajor+"."+reqProfile);
- }
+ }
return false;
}
}
- private final long createContextARBVersions(long share, boolean direct, int ctxOptionFlags,
- int majorMax, int minorMax,
- int majorMin, int minorMin,
+ private final long createContextARBVersions(long share, boolean direct, int ctxOptionFlags,
+ int majorMax, int minorMax,
+ int majorMin, int minorMin,
int major[], int minor[]) {
major[0]=majorMax;
minor[0]=minorMax;
@@ -773,15 +782,15 @@ public abstract class GLContextImpl extends GLContext {
if(0 != _context) {
ok = true;
- setGLFunctionAvailability(true, major[0], minor[0], ctxOptionFlags);
+ setGLFunctionAvailability(true, major[0], minor[0], ctxOptionFlags);
} else {
- ok = false;
+ ok = false;
}
-
+
if(ok && major[0]>=3) {
int[] hasMajor = new int[1]; int[] hasMinor = new int[1];
- gl.glGetIntegerv(GL3.GL_MAJOR_VERSION, hasMajor, 0);
- gl.glGetIntegerv(GL3.GL_MINOR_VERSION, hasMinor, 0);
+ gl.glGetIntegerv(GL2GL3.GL_MAJOR_VERSION, hasMajor, 0);
+ gl.glGetIntegerv(GL2GL3.GL_MINOR_VERSION, hasMinor, 0);
ok = hasMajor[0]>major[0] || ( hasMajor[0]==major[0] && hasMinor[0]>=minor[0] ) ;
if(!ok) {
removeCachedVersion(major[0], minor[0], ctxOptionFlags);
@@ -792,7 +801,7 @@ public abstract class GLContextImpl extends GLContext {
System.err.println(getThreadName() + ": createContextARBVersions: version verification - expected "+major[0]+"."+minor[0]+", has "+hasMajor[0]+"."+hasMinor[0]+" == "+ok);
}
}
-
+
if(!ok) {
if(!GLContext.decrementGLVersion(major, minor)) break;
}
@@ -805,8 +814,8 @@ public abstract class GLContextImpl extends GLContext {
// As a last resort, the GL_VERSION string may be used ..
//
- /**
- * If major > 0 || minor > 0 : Use passed values, determined at creation time
+ /**
+ * If major > 0 || minor > 0 : Use passed values, determined at creation time
* If major==0 && minor == 0 : Use GL_VERSION
* Otherwise .. don't touch ..
*/
@@ -870,7 +879,7 @@ public abstract class GLContextImpl extends GLContext {
/** Create the GL for this context. */
protected GL createGL(GLProfile glp) {
GL gl = (GL) createInstance(glp, "Impl", new Class[] { GLProfile.class, GLContextImpl.class }, new Object[] { glp, this } );
-
+
/* FIXME: refactor dependence on Java 2D / JOGL bridge
if (tracker != null) {
gl.setObjectTracker(tracker);
@@ -878,11 +887,11 @@ public abstract class GLContextImpl extends GLContext {
*/
return gl;
}
-
+
public final ProcAddressTable getGLProcAddressTable() {
return glProcAddressTable;
}
-
+
/**
* Shall return the platform extension ProcAddressTable,
* ie for GLXExt, EGLExt, ..
@@ -918,8 +927,8 @@ public abstract class GLContextImpl extends GLContext {
/** Maps the given "platform-independent" extension name to a real
function name. Currently this is only used to map
- "GL_ARB_pbuffer" to "WGL_ARB_pbuffer/GLX_SGIX_pbuffer" and
- "GL_ARB_pixel_format" to "WGL_ARB_pixel_format/n.a."
+ "GL_ARB_pbuffer" to "WGL_ARB_pbuffer/GLX_SGIX_pbuffer" and
+ "GL_ARB_pixel_format" to "WGL_ARB_pixel_format/n.a."
*/
protected final String mapToRealGLExtensionName(String glExtensionName) {
Map map = getExtensionNameMap();
@@ -943,24 +952,24 @@ public abstract class GLContextImpl extends GLContext {
if(0 == _glGetString) {
// FIXME
System.err.println("Warning: Entry point to 'glGetString' is NULL.");
- Thread.dumpStack();
+ Thread.dumpStack();
} else {
final String _glRenderer = glGetStringInt(GL.GL_RENDERER, _glGetString);
if(null == _glRenderer) {
// FIXME
System.err.println("Warning: GL_RENDERER is NULL.");
- Thread.dumpStack();
+ Thread.dumpStack();
} else {
glRenderer = _glRenderer;
glRendererLowerCase = glRenderer.toLowerCase();
}
}
}
-
+
protected final String getGLRendererString(boolean lowerCase) {
return lowerCase ? glRendererLowerCase : glRenderer;
}
-
+
/**
* Sets the OpenGL implementation class and
* the cache of which GL functions are available for calling through this
@@ -975,7 +984,7 @@ public abstract class GLContextImpl extends GLContext {
* @param major OpenGL major version
* @param minor OpenGL minor version
* @param ctxProfileBits OpenGL context profile and option bits, see {@link javax.media.opengl.GLContext#CTX_OPTION_ANY}
- *
+ *
* @see #setContextVersion
* @see javax.media.opengl.GLContext#CTX_OPTION_ANY
* @see javax.media.opengl.GLContext#CTX_PROFILE_COMPAT
@@ -992,13 +1001,13 @@ public abstract class GLContextImpl extends GLContext {
updateGLXProcAddressTable();
initGLRendererStrings();
-
+
if(!isCurrentContextHardwareRasterizer()) {
ctxProfileBits |= GLContext.CTX_IMPL_ACCEL_SOFT;
- }
+ }
final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
-
+
contextFQN = getContextFQN(adevice, major, minor, ctxProfileBits);
if (DEBUG) {
System.err.println(getThreadName() + ": Context FQN: "+contextFQN+" - "+GLContext.getGLVersion(major, minor, ctxProfileBits, null));
@@ -1011,7 +1020,7 @@ public abstract class GLContextImpl extends GLContext {
synchronized(mappedContextTypeObjectLock) {
table = mappedGLProcAddress.get( contextFQN );
if(null != table && !verifyInstance(gl.getGLProfile(), "ProcAddressTable", table)) {
- throw new InternalError("GLContext GL ProcAddressTable mapped key("+contextFQN+" - " + GLContext.getGLVersion(major, minor, ctxProfileBits, null)+
+ throw new InternalError("GLContext GL ProcAddressTable mapped key("+contextFQN+" - " + GLContext.getGLVersion(major, minor, ctxProfileBits, null)+
") -> "+ table.getClass().getName()+" not matching "+gl.getGLProfile().getGLImplBaseClassName());
}
}
@@ -1032,7 +1041,7 @@ public abstract class GLContextImpl extends GLContext {
}
}
}
-
+
//
// Update ExtensionAvailabilityCache
//
@@ -1055,16 +1064,16 @@ public abstract class GLContextImpl extends GLContext {
System.err.println(getThreadName() + ": GLContext GL ExtensionAvailabilityCache mapping key("+contextFQN+") -> "+toHexString(extensionAvailability.hashCode()) + " - entries: "+extensionAvailability.getTotalExtensionCount());
}
}
- }
+ }
if( isExtensionAvailable("GL_ARB_ES2_compatibility") ) {
ctxProfileBits |= CTX_IMPL_ES2_COMPAT;
}
-
+
//
// Set GL Version (complete w/ version string)
//
setContextVersion(major, minor, ctxProfileBits, true);
-
+
setDefaultSwapInterval();
}
@@ -1074,7 +1083,7 @@ public abstract class GLContextImpl extends GLContext {
}
final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
-
+
contextFQN = getContextFQN(adevice, major, minor, ctxProfileBits);
if (DEBUG) {
System.err.println(getThreadName() + ": RM Context FQN: "+contextFQN+" - "+GLContext.getGLVersion(major, minor, ctxProfileBits, null));
@@ -1097,26 +1106,27 @@ public abstract class GLContextImpl extends GLContext {
private final boolean isCurrentContextHardwareRasterizer() {
boolean isHardwareRasterizer = true;
-
+
if(!drawable.getChosenGLCapabilities().getHardwareAccelerated()) {
isHardwareRasterizer = false;
} else {
isHardwareRasterizer = ! ( glRendererLowerCase.contains("software") /* Mesa3D */ ||
glRendererLowerCase.contains("mesa x11") /* Mesa3D*/ ||
glRendererLowerCase.contains("softpipe") /* Gallium */ ||
- glRendererLowerCase.contains("llvmpipe") /* Gallium */
+ glRendererLowerCase.contains("llvmpipe") /* Gallium */
);
}
return isHardwareRasterizer;
}
-
+
/**
* Updates the platform's 'GLX' function cache
*/
protected abstract void updateGLXProcAddressTable();
protected abstract StringBuilder getPlatformExtensionsStringImpl();
-
+
+ @Override
public final boolean isFunctionAvailable(String glFunctionName) {
// Check GL 1st (cached)
if(null!=glProcAddressTable) { // null if this context wasn't not created
@@ -1128,8 +1138,8 @@ public abstract class GLContextImpl extends GLContext {
}
// Check platform extensions 2nd (cached) - context had to be enabled once
- final ProcAddressTable pTable = getPlatformExtProcAddressTable();
- if(null!=pTable) {
+ final ProcAddressTable pTable = getPlatformExtProcAddressTable();
+ if(null!=pTable) {
try {
if(0!=pTable.getAddressFor(glFunctionName)) {
return true;
@@ -1154,6 +1164,7 @@ public abstract class GLContextImpl extends GLContext {
return false;
}
+ @Override
public boolean isExtensionAvailable(String glExtensionName) {
if(null!=extensionAvailability) {
return extensionAvailability.isExtensionAvailable(mapToRealGLExtensionName(glExtensionName));
@@ -1161,10 +1172,12 @@ public abstract class GLContextImpl extends GLContext {
return false;
}
+ @Override
public final int getPlatformExtensionCount() {
return null != extensionAvailability ? extensionAvailability.getPlatformExtensionCount() : 0;
}
-
+
+ @Override
public final String getPlatformExtensionsString() {
if(null!=extensionAvailability) {
return extensionAvailability.getPlatformExtensionsString();
@@ -1172,10 +1185,12 @@ public abstract class GLContextImpl extends GLContext {
return null;
}
+ @Override
public final int getGLExtensionCount() {
return null != extensionAvailability ? extensionAvailability.getGLExtensionCount() : 0;
}
-
+
+ @Override
public final String getGLExtensionsString() {
if(null!=extensionAvailability) {
return extensionAvailability.getGLExtensionsString();
@@ -1189,11 +1204,11 @@ public abstract class GLContextImpl extends GLContext {
}
return false;
}
-
+
protected static String getContextFQN(AbstractGraphicsDevice device, int major, int minor, int ctxProfileBits) {
// remove non-key values
- ctxProfileBits &= ~( GLContext.CTX_OPTION_DEBUG | GLContext.CTX_IMPL_ES2_COMPAT ) ;
-
+ ctxProfileBits &= ~( GLContext.CTX_OPTION_DEBUG | GLContext.CTX_IMPL_ES2_COMPAT ) ;
+
return device.getUniqueID() + "-" + toHexString(composeBits(major, minor, ctxProfileBits));
}
@@ -1220,7 +1235,7 @@ public abstract class GLContextImpl extends GLContext {
//----------------------------------------------------------------------
// Helpers for buffer object optimizations
-
+
public void setBufferSizeTracker(GLBufferSizeTracker bufferSizeTracker) {
this.bufferSizeTracker = bufferSizeTracker;
}
@@ -1245,35 +1260,42 @@ public abstract class GLContextImpl extends GLContext {
public boolean hasWaiters() {
return lock.getQueueLength()>0;
}
-
+
//---------------------------------------------------------------------------
// GL_ARB_debug_output, GL_AMD_debug_output helpers
//
+ @Override
public final String getGLDebugMessageExtension() {
return glDebugHandler.getExtension();
}
+ @Override
public final boolean isGLDebugMessageEnabled() {
return glDebugHandler.isEnabled();
}
-
+
+ @Override
public final int getContextCreationFlags() {
- return additionalCtxCreationFlags;
+ return additionalCtxCreationFlags;
}
+ @Override
public final void setContextCreationFlags(int flags) {
if(!isCreated()) {
additionalCtxCreationFlags = flags & GLContext.CTX_OPTION_DEBUG;
}
}
-
- public final boolean isGLDebugSynchronous() { return glDebugHandler.isSynchronous(); }
-
+
+ @Override
+ public final boolean isGLDebugSynchronous() { return glDebugHandler.isSynchronous(); }
+
+ @Override
public final void setGLDebugSynchronous(boolean synchronous) {
glDebugHandler.setSynchronous(synchronous);
}
-
+
+ @Override
public final void enableGLDebugMessage(boolean enable) throws GLException {
if(!isCreated()) {
if(enable) {
@@ -1286,23 +1308,27 @@ public abstract class GLContextImpl extends GLContext {
glDebugHandler.enable(enable);
}
}
-
- public final void addGLDebugListener(GLDebugListener listener) {
+
+ @Override
+ public final void addGLDebugListener(GLDebugListener listener) {
glDebugHandler.addListener(listener);
}
-
+
+ @Override
public final void removeGLDebugListener(GLDebugListener listener) {
glDebugHandler.removeListener(listener);
- }
-
+ }
+
+ @Override
public final void glDebugMessageControl(int source, int type, int severity, int count, IntBuffer ids, boolean enabled) {
if(glDebugHandler.isExtensionARB()) {
gl.getGL2GL3().glDebugMessageControlARB(source, type, severity, count, ids, enabled);
} else if(glDebugHandler.isExtensionAMD()) {
gl.getGL2GL3().glDebugMessageEnableAMD(GLDebugMessage.translateARB2AMDCategory(source, type), severity, count, ids, enabled);
- }
+ }
}
-
+
+ @Override
public final void glDebugMessageControl(int source, int type, int severity, int count, int[] ids, int ids_offset, boolean enabled) {
if(glDebugHandler.isExtensionARB()) {
gl.getGL2GL3().glDebugMessageControlARB(source, type, severity, count, ids, ids_offset, enabled);
@@ -1310,16 +1336,17 @@ public abstract class GLContextImpl extends GLContext {
gl.getGL2GL3().glDebugMessageEnableAMD(GLDebugMessage.translateARB2AMDCategory(source, type), severity, count, ids, ids_offset, enabled);
}
}
-
+
+ @Override
public final void glDebugMessageInsert(int source, int type, int id, int severity, String buf) {
final int len = (null != buf) ? buf.length() : 0;
if(glDebugHandler.isExtensionARB()) {
gl.getGL2GL3().glDebugMessageInsertARB(source, type, id, severity, len, buf);
} else if(glDebugHandler.isExtensionAMD()) {
gl.getGL2GL3().glDebugMessageInsertAMD(GLDebugMessage.translateARB2AMDCategory(source, type), severity, id, len, buf);
- }
+ }
}
-
+
/** Internal bootstraping glGetString(GL_RENDERER) */
protected static native String glGetStringInt(int name, long procAddress);
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
index f5f9f62c4..06cd550b4 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 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:
- *
+ *
* - 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -75,7 +75,8 @@ public abstract class EGLContext extends GLContextImpl {
// no inner state _eglExt = null;
super.resetStates();
}
-
+
+ @Override
public Object getPlatformGLExtensions() {
return getEGLExt();
}
@@ -87,6 +88,7 @@ public abstract class EGLContext extends GLContextImpl {
return _eglExt;
}
+ @Override
public final ProcAddressTable getPlatformExtProcAddressTable() {
return eglExtProcAddressTable;
}
@@ -95,14 +97,18 @@ public abstract class EGLContext extends GLContextImpl {
return eglExtProcAddressTable;
}
+ @Override
protected Map getFunctionNameMap() { return null; }
+ @Override
protected Map getExtensionNameMap() { return null; }
+ @Override
public final boolean isGLReadDrawableAvailable() {
return true;
}
+ @Override
protected void makeCurrentImpl() throws GLException {
if(EGL.EGL_NO_DISPLAY==((EGLDrawable)drawable).getDisplay() ) {
throw new GLException("drawable not properly initialized, NO DISPLAY: "+drawable);
@@ -118,6 +124,7 @@ public abstract class EGLContext extends GLContextImpl {
}
}
+ @Override
protected void releaseImpl() throws GLException {
if (!EGL.eglMakeCurrent(((EGLDrawable)drawable).getDisplay(),
EGL.EGL_NO_SURFACE,
@@ -128,6 +135,7 @@ public abstract class EGLContext extends GLContextImpl {
}
}
+ @Override
protected void destroyImpl() throws GLException {
if (!EGL.eglDestroyContext(((EGLDrawable)drawable).getDisplay(), contextHandle)) {
final int eglError = EGL.eglGetError();
@@ -138,14 +146,17 @@ public abstract class EGLContext extends GLContextImpl {
}
}
+ @Override
protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) {
return 0; // FIXME
}
+ @Override
protected void destroyContextARBImpl(long _context) {
// FIXME
}
+ @Override
protected boolean createImpl(GLContextImpl shareWith) throws GLException {
long eglDisplay = ((EGLDrawable)drawable).getDisplay();
EGLGraphicsConfiguration config = ((EGLDrawable)drawable).getGraphicsConfiguration();
@@ -178,7 +189,7 @@ public abstract class EGLContext extends GLContextImpl {
}
}
- final IntBuffer contextAttrsNIO;
+ final IntBuffer contextAttrsNIO;
{
final int[] contextAttrs = new int[] {
EGL.EGL_CONTEXT_CLIENT_VERSION, -1,
@@ -200,7 +211,7 @@ public abstract class EGLContext extends GLContextImpl {
}
if (DEBUG) {
System.err.println(getThreadName() + ": Created OpenGL context 0x" +
- Long.toHexString(contextHandle) +
+ Long.toHexString(contextHandle) +
",\n\twrite surface 0x" + Long.toHexString(drawable.getHandle()) +
",\n\tread surface 0x" + Long.toHexString(drawableRead.getHandle())+
",\n\t"+this+
@@ -218,13 +229,14 @@ public abstract class EGLContext extends GLContextImpl {
if(glProfile.usesNativeGLES2()) {
ctp |= CTX_IMPL_ES2_COMPAT;
major = 2;
- } else {
+ } else {
major = 1;
}
setGLFunctionAvailability(true, major, 0, ctp);
return true;
}
+ @Override
protected final void updateGLXProcAddressTable() {
final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
@@ -255,16 +267,17 @@ public abstract class EGLContext extends GLContextImpl {
}
}
}
-
+
+ @Override
protected final StringBuilder getPlatformExtensionsStringImpl() {
- StringBuilder sb = new StringBuilder();
+ StringBuilder sb = new StringBuilder();
if (!eglQueryStringInitialized) {
eglQueryStringAvailable =
getDrawableImpl().getGLDynamicLookupHelper().dynamicLookupFunction("eglQueryString") != 0;
eglQueryStringInitialized = true;
}
if (eglQueryStringAvailable) {
- final String ret = EGL.eglQueryString(((EGLDrawable)drawable).getDisplay(),
+ final String ret = EGL.eglQueryString(((EGLDrawable)drawable).getDisplay(),
EGL.EGL_EXTENSIONS);
if (DEBUG) {
System.err.println("EGL extensions: " + ret);
@@ -289,8 +302,10 @@ public abstract class EGLContext extends GLContextImpl {
return EGL.eglSwapInterval(((EGLDrawable)drawable).getDisplay(), interval);
}
+ @Override
public abstract void bindPbufferToTexture();
+ @Override
public abstract void releasePbufferFromTexture();
protected static String toHexString(int hex) {
@@ -299,24 +314,28 @@ public abstract class EGLContext extends GLContextImpl {
protected static String toHexString(long hex) {
return GLContext.toHexString(hex);
}
-
+
//----------------------------------------------------------------------
// Currently unimplemented stuff
//
+ @Override
protected void copyImpl(GLContext source, int mask) throws GLException {
throw new GLException("Not yet implemented");
}
+ @Override
public ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) {
throw new GLException("Should not call this");
}
+ @Override
public boolean offscreenImageNeedsVerticalFlip() {
throw new GLException("Should not call this");
}
+ @Override
public int getOffscreenContextPixelDataType() {
throw new GLException("Should not call this");
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java
index ff60a5262..0a451e5eb 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,7 +28,7 @@
* 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.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -49,6 +49,7 @@ public class EGLExternalContext extends EGLContext {
getGLStateTracker().setEnabled(false); // external context usage can't track state in Java
}
+ @Override
public int makeCurrent() throws GLException {
// Save last context if necessary to allow external GLContexts to
// talk to other GLContexts created by this library
@@ -58,27 +59,33 @@ public class EGLExternalContext extends EGLContext {
setCurrent(null);
}
return super.makeCurrent();
- }
+ }
+ @Override
public void release() throws GLException {
super.release();
setCurrent(lastContext);
lastContext = null;
}
+ @Override
protected void makeCurrentImpl() throws GLException {
}
+ @Override
protected void releaseImpl() throws GLException {
}
+ @Override
protected void destroyImpl() throws GLException {
}
+ @Override
public void bindPbufferToTexture() {
throw new GLException("Should not call this");
}
+ @Override
public void releasePbufferFromTexture() {
throw new GLException("Should not call this");
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenContext.java
index dd0a3db3a..eae47fa92 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenContext.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,29 +28,26 @@
* 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.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
package jogamp.opengl.egl;
-import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import jogamp.opengl.*;
-import com.jogamp.gluegen.runtime.ProcAddressTable;
-import java.nio.*;
-import java.util.*;
public class EGLOnscreenContext extends EGLContext {
public EGLOnscreenContext(EGLOnscreenDrawable drawable, GLContext shareWith) {
super(drawable, shareWith);
}
+ @Override
public void bindPbufferToTexture() {
throw new GLException("Should not call this");
}
+ @Override
public void releasePbufferFromTexture() {
throw new GLException("Should not call this");
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferContext.java
index 2cad7daac..7175d516f 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferContext.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,33 +28,31 @@
* 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.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
package jogamp.opengl.egl;
-import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import jogamp.opengl.*;
-import com.jogamp.gluegen.runtime.ProcAddressTable;
-import java.nio.*;
-import java.util.*;
public class EGLPbufferContext extends EGLContext {
public EGLPbufferContext(EGLPbufferDrawable drawable, GLContext shareWith) {
super(drawable, shareWith);
}
+ @Override
public int getFloatingPointMode() {
return 0; // FIXME ??
}
+ @Override
public void bindPbufferToTexture() {
throw new GLException("Not yet implemented");
}
+ @Override
public void releasePbufferFromTexture() {
throw new GLException("Not yet implemented");
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index 3cd4b340c..aa66aa9d1 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -65,7 +65,7 @@ import com.jogamp.gluegen.runtime.ProcAddressTable;
import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver;
public abstract class MacOSXCGLContext extends GLContextImpl
-{
+{
// Abstract interface for implementation of this context (either
// NSOpenGL-based or CGL-based)
protected interface GLBackendImpl {
@@ -78,7 +78,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
boolean setSwapInterval(int interval);
boolean swapBuffers();
}
-
+
/* package */ static final boolean isTigerOrLater;
/* package */ static final boolean isLionOrLater;
@@ -91,7 +91,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
static boolean isGLProfileSupported(int ctp, int major, int minor) {
boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ;
boolean ctCore = 0 != ( CTX_PROFILE_CORE & ctp ) ;
-
+
// We exclude 3.0, since we would map it's core to GL2. Hence we force mapping 2.1 to GL2
if(3==major && 1<=minor && minor<=2) {
// [3.1..3.2] -> GL3*
@@ -119,26 +119,26 @@ public abstract class MacOSXCGLContext extends GLContextImpl
return CGL.kCGLOGLPVersion_3_2_Core;
} else {
return CGL.kCGLOGLPVersion_Legacy;
- }
- }
+ }
+ }
private boolean haveSetOpenGLMode = false;
private GLBackendType openGLMode = GLBackendType.NSOPENGL;
-
+
// Implementation object (either NSOpenGL-based or CGL-based)
protected GLBackendImpl impl;
-
+
private CGLExt _cglExt;
// Table that holds the addresses of the native C-language entry points for
// CGL extension functions.
private CGLExtProcAddressTable cglExtProcAddressTable;
-
+
protected MacOSXCGLContext(GLDrawableImpl drawable,
GLContext shareWith) {
super(drawable, shareWith);
initOpenGLImpl(getOpenGLMode());
}
-
+
@Override
protected void resetStates() {
// no inner state _cglExt = null;
@@ -146,12 +146,13 @@ public abstract class MacOSXCGLContext extends GLContextImpl
super.resetStates();
}
+ @Override
public Object getPlatformGLExtensions() {
return getCGLExt();
}
- protected boolean isNSContext() {
- return (null != impl) ? impl.isNSContext() : this.openGLMode == GLBackendType.NSOPENGL;
+ protected boolean isNSContext() {
+ return (null != impl) ? impl.isNSContext() : this.openGLMode == GLBackendType.NSOPENGL;
}
public CGLExt getCGLExt() {
@@ -161,6 +162,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
return _cglExt;
}
+ @Override
public final ProcAddressTable getPlatformExtProcAddressTable() {
return getCGLExtProcAddressTable();
}
@@ -169,10 +171,13 @@ public abstract class MacOSXCGLContext extends GLContextImpl
return cglExtProcAddressTable;
}
+ @Override
protected Map getFunctionNameMap() { return null; }
+ @Override
protected Map getExtensionNameMap() { return null; }
+ @Override
protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) {
if(!isGLProfileSupported(ctp, major, minor)) {
if(DEBUG) {
@@ -200,11 +205,13 @@ public abstract class MacOSXCGLContext extends GLContextImpl
return ctx;
}
+ @Override
protected void destroyContextARBImpl(long _context) {
impl.release(_context);
impl.destroy(_context);
}
+ @Override
public final boolean isGLReadDrawableAvailable() {
return false;
}
@@ -219,7 +226,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
throw new GLException("GLContextShareSet returned a NULL OpenGL context");
}
}
-
+
MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration();
GLCapabilitiesImmutable capabilitiesChosen = (GLCapabilitiesImmutable) config.getChosenCapabilities();
if (capabilitiesChosen.getPbufferFloatingPointBuffers() && !isTigerOrLater) {
@@ -229,40 +236,45 @@ public abstract class MacOSXCGLContext extends GLContextImpl
if(glp.isGLES1() || glp.isGLES2() || glp.isGL4() || glp.isGL3() && !isLionOrLater) {
throw new GLException("OpenGL profile not supported on MacOSX "+Platform.getOSVersionNumber()+": "+glp);
}
-
+
if (DEBUG) {
System.err.println("Share context is " + toHexString(share) + " for " + this);
}
- return share;
+ return share;
}
-
+
+ @Override
protected boolean createImpl(GLContextImpl shareWith) throws GLException {
long share = createImplPreset(shareWith);
contextHandle = createContextARB(share, true);
return 0 != contextHandle;
}
-
+
+ @Override
protected void makeCurrentImpl() throws GLException {
if (getOpenGLMode() != ((MacOSXCGLDrawable)drawable).getOpenGLMode()) {
setOpenGLMode(((MacOSXCGLDrawable)drawable).getOpenGLMode());
}
if (!impl.makeCurrent(contextHandle)) {
throw new GLException("Error making Context current: "+this);
- }
+ }
}
-
+
+ @Override
protected void releaseImpl() throws GLException {
if (!impl.release(contextHandle)) {
throw new GLException("Error releasing OpenGL Context: "+this);
}
}
+ @Override
protected void destroyImpl() throws GLException {
if(!impl.destroy(contextHandle)) {
throw new GLException("Error destroying OpenGL Context: "+this);
}
}
+ @Override
protected void copyImpl(GLContext source, int mask) throws GLException {
if( isNSContext() != ((MacOSXCGLContext)source).isNSContext() ) {
throw new GLException("Source/Destination OpenGL Context tyoe mismatch: source "+source+", dest: "+this);
@@ -275,7 +287,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
protected void swapBuffers() {
// single-buffer is already filtered out @ GLDrawableImpl#swapBuffers()
if(!impl.swapBuffers()) {
- throw new GLException("Error swapping buffers: "+this);
+ throw new GLException("Error swapping buffers: "+this);
}
}
@@ -284,11 +296,13 @@ public abstract class MacOSXCGLContext extends GLContextImpl
return impl.setSwapInterval(interval);
}
+ @Override
public ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) {
// FIXME: apparently the Apple extension doesn't require a custom memory allocator
throw new GLException("Not yet implemented");
}
+ @Override
protected final void updateGLXProcAddressTable() {
final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
@@ -316,11 +330,13 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
}
}
-
+
+ @Override
protected final StringBuilder getPlatformExtensionsStringImpl() {
return new StringBuilder();
}
-
+
+ @Override
public boolean isExtensionAvailable(String glExtensionName) {
if (glExtensionName.equals("GL_ARB_pbuffer") ||
glExtensionName.equals("GL_ARB_pixel_format")) {
@@ -328,7 +344,8 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
return super.isExtensionAvailable(glExtensionName);
}
-
+
+ @Override
public int getOffscreenContextPixelDataType() {
throw new GLException("Should not call this");
}
@@ -337,18 +354,21 @@ public abstract class MacOSXCGLContext extends GLContextImpl
throw new GLException("Should not call this");
}
+ @Override
public boolean offscreenImageNeedsVerticalFlip() {
throw new GLException("Should not call this");
}
+ @Override
public void bindPbufferToTexture() {
throw new GLException("Should not call this");
}
-
+
+ @Override
public void releasePbufferFromTexture() {
throw new GLException("Should not call this");
}
-
+
// Support for "mode switching" as described in MacOSXCGLDrawable
public void setOpenGLMode(GLBackendType mode) {
if (mode == openGLMode) {
@@ -364,10 +384,10 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
initOpenGLImpl(mode);
openGLMode = mode;
- haveSetOpenGLMode = true;
+ haveSetOpenGLMode = true;
}
public final GLBackendType getOpenGLMode() { return openGLMode; }
-
+
protected void initOpenGLImpl(GLBackendType backend) {
switch (backend) {
case NSOPENGL:
@@ -379,8 +399,9 @@ public abstract class MacOSXCGLContext extends GLContextImpl
default:
throw new InternalError("Illegal implementation mode " + backend);
}
- }
-
+ }
+
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
@@ -391,22 +412,24 @@ public abstract class MacOSXCGLContext extends GLContextImpl
sb.append("] ");
return sb.toString();
}
-
+
// NSOpenGLContext-based implementation
class NSOpenGLImpl implements GLBackendImpl {
long nsOpenGLLayer = 0;
long nsOpenGLLayerPFmt = 0;
float screenVSyncTimeout; // microSec
int vsyncTimeout; // microSec - for nsOpenGLLayer mode
-
+
+ @Override
public boolean isNSContext() { return true; }
- public long create(long share, int ctp, int major, int minor) {
+ @Override
+ public long create(long share, int ctp, int major, int minor) {
long ctx = 0;
final MacOSXCGLDrawable drawable = (MacOSXCGLDrawable) MacOSXCGLContext.this.drawable;
final NativeSurface surface = drawable.getNativeSurface();
final MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) surface.getGraphicsConfiguration();
- final OffscreenLayerSurface backingLayerHost = NativeWindowFactory.getOffscreenLayerSurface(surface, true);
+ final OffscreenLayerSurface backingLayerHost = NativeWindowFactory.getOffscreenLayerSurface(surface, true);
final GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
long pixelFormat = MacOSXCGLGraphicsConfiguration.GLCapabilities2NSPixelFormat(chosenCaps, ctp, major, minor);
if (pixelFormat == 0) {
@@ -417,7 +440,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
config.setChosenPixelFormat(pixelFormat);
int sRefreshRate = CGL.getScreenRefreshRate(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getIndex());
- screenVSyncTimeout = 1000000f / (float)sRefreshRate;
+ screenVSyncTimeout = 1000000f / sRefreshRate;
if(DEBUG) {
System.err.println("NS create OSX>=lion "+isLionOrLater);
System.err.println("NS create backendType: "+drawable.getOpenGLMode());
@@ -444,7 +467,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
return 0;
}
-
+
if (!chosenCaps.isPBuffer() && !chosenCaps.isBackgroundOpaque()) {
// Set the context opacity
CGL.setContextOpacity(ctx, 0);
@@ -456,7 +479,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
GLCapabilitiesImmutable fixedCaps = MacOSXCGLGraphicsConfiguration.NSPixelFormat2GLCapabilities(chosenCaps.getGLProfile(), pixelFormat);
fixedCaps = GLGraphicsConfigurationUtil.fixOpaqueGLCapabilities(fixedCaps, chosenCaps.isBackgroundOpaque());
- config.setChosenCapabilities(fixedCaps);
+ config.setChosenCapabilities(fixedCaps);
if(DEBUG) {
System.err.println("NS create fixedCaps: "+fixedCaps);
}
@@ -466,7 +489,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
//
// handled layered surface
- //
+ //
if(null != backingLayerHost) {
nsOpenGLLayerPFmt = pixelFormat;
pixelFormat = 0;
@@ -477,8 +500,8 @@ public abstract class MacOSXCGLContext extends GLContextImpl
texHeight = osxPDrawable.getTextureHeight();
} else {
texWidth = drawable.getWidth();
- texHeight = drawable.getHeight();
- }
+ texHeight = drawable.getHeight();
+ }
nsOpenGLLayer = CGL.createNSOpenGLLayer(ctx, nsOpenGLLayerPFmt, drawable.getHandle(), fixedCaps.isBackgroundOpaque(), texWidth, texHeight);
if(0>=texWidth || 0>=texHeight || !drawable.isRealized()) {
throw new GLException("Drawable not realized yet or invalid texture size, texSize "+texWidth+"x"+texHeight+", "+drawable);
@@ -494,9 +517,10 @@ public abstract class MacOSXCGLContext extends GLContextImpl
CGL.deletePixelFormat(pixelFormat);
}
}
- return ctx;
+ return ctx;
}
-
+
+ @Override
public boolean destroy(long ctx) {
if(0 != nsOpenGLLayer) {
final NativeSurface surface = drawable.getNativeSurface();
@@ -516,11 +540,13 @@ public abstract class MacOSXCGLContext extends GLContextImpl
return CGL.deleteContext(ctx, true);
}
+ @Override
public boolean copyImpl(long src, int mask) {
CGL.copyContext(contextHandle, src, mask);
return true;
}
-
+
+ @Override
public boolean makeCurrent(long ctx) {
final long cglCtx = CGL.getCGLContext(ctx);
if(0 == cglCtx) {
@@ -535,13 +561,14 @@ public abstract class MacOSXCGLContext extends GLContextImpl
return false;
}
+ @Override
public boolean release(long ctx) {
try {
gl.glFlush(); // w/o glFlush()/glFinish() OSX < 10.7 (NVidia driver) may freeze
} catch (GLException gle) {
if(DEBUG) {
System.err.println("MacOSXCGLContext.NSOpenGLImpl.release: INFO: glFlush() catched exception:");
- gle.printStackTrace();
+ gle.printStackTrace();
}
}
final boolean res = CGL.clearCurrentContext(ctx);
@@ -552,10 +579,11 @@ public abstract class MacOSXCGLContext extends GLContextImpl
final int err = CGL.CGLUnlockContext(cglCtx);
if(DEBUG && CGL.kCGLNoError != err) {
System.err.println("CGL: Could not unlock context: err 0x"+Integer.toHexString(err)+": "+this);
- }
+ }
return res && CGL.kCGLNoError == err;
}
+ @Override
public boolean setSwapInterval(int interval) {
if(0 != nsOpenGLLayer) {
CGL.setNSOpenGLLayerSwapInterval(nsOpenGLLayer, interval);
@@ -565,11 +593,12 @@ public abstract class MacOSXCGLContext extends GLContextImpl
CGL.setSwapInterval(contextHandle, interval);
return true;
}
-
+
+ @Override
public boolean swapBuffers() {
if( 0 != nsOpenGLLayer ) {
- // If v-sync is disabled, frames will be drawn as quickly as possible
- // w/o delay but in sync w/ CALayer. Otherwise wait until next swap interval (v-sync).
+ // If v-sync is disabled, frames will be drawn as quickly as possible
+ // w/o delay but in sync w/ CALayer. Otherwise wait until next swap interval (v-sync).
CGL.waitUntilNSOpenGLLayerIsReady(nsOpenGLLayer, vsyncTimeout);
}
if(CGL.flushBuffer(contextHandle)) {
@@ -584,8 +613,10 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
class CGLImpl implements GLBackendImpl {
+ @Override
public boolean isNSContext() { return false; }
-
+
+ @Override
public long create(long share, int ctp, int major, int minor) {
long ctx = 0;
MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration();
@@ -595,7 +626,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
throw new GLException("Unable to allocate pixel format with requested GLCapabilities");
}
config.setChosenPixelFormat(pixelFormat);
- try {
+ try {
// Create new context
PointerBuffer ctxPB = PointerBuffer.allocateDirect(1);
if (DEBUG) {
@@ -617,23 +648,26 @@ public abstract class MacOSXCGLContext extends GLContextImpl
if(DEBUG) {
GLCapabilitiesImmutable caps0 = MacOSXCGLGraphicsConfiguration.CGLPixelFormat2GLCapabilities(pixelFormat);
System.err.println("NS created: "+caps0);
- }
+ }
}
} finally {
- CGL.CGLDestroyPixelFormat(pixelFormat);
+ CGL.CGLDestroyPixelFormat(pixelFormat);
}
return ctx;
}
-
+
+ @Override
public boolean destroy(long ctx) {
return CGL.CGLDestroyContext(ctx) == CGL.kCGLNoError;
}
+ @Override
public boolean copyImpl(long src, int mask) {
CGL.CGLCopyContext(src, contextHandle, mask);
return true;
}
-
+
+ @Override
public boolean makeCurrent(long ctx) {
int err = CGL.CGLLockContext(ctx);
if(CGL.kCGLNoError == err) {
@@ -649,13 +683,14 @@ public abstract class MacOSXCGLContext extends GLContextImpl
return false;
}
+ @Override
public boolean release(long ctx) {
try {
gl.glFlush(); // w/o glFlush()/glFinish() OSX < 10.7 (NVidia driver) may freeze
} catch (GLException gle) {
if(DEBUG) {
System.err.println("MacOSXCGLContext.CGLImpl.release: INFO: glFlush() catched exception:");
- gle.printStackTrace();
+ gle.printStackTrace();
}
}
int err = CGL.CGLSetCurrentContext(0);
@@ -668,14 +703,16 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
return CGL.kCGLNoError == err && CGL.kCGLNoError == err2;
}
-
+
+ @Override
public boolean setSwapInterval(int interval) {
int[] lval = new int[] { interval } ;
CGL.CGLSetParameter(contextHandle, CGL.kCGLCPSwapInterval, lval, 0);
return true;
- }
+ }
+ @Override
public boolean swapBuffers() {
return CGL.kCGLNoError == CGL.CGLFlushDrawable(contextHandle);
- }
- }
+ }
+ }
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java
index 949963fa0..7b13ce22e 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* 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.
*/
@@ -40,24 +40,26 @@
package jogamp.opengl.macosx.cgl;
import javax.media.opengl.*;
-import jogamp.opengl.*;
public class MacOSXOffscreenCGLContext extends MacOSXPbufferCGLContext
-{
+{
public MacOSXOffscreenCGLContext(MacOSXPbufferCGLDrawable drawable,
GLContext shareWith) {
super(drawable, shareWith);
}
-
+
+ @Override
public int getOffscreenContextPixelDataType() {
GL gl = getGL();
return gl.isGL2GL3()?GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1;
}
+ @Override
public int getOffscreenContextReadBuffer() {
return GL.GL_FRONT;
}
+ @Override
public boolean offscreenImageNeedsVerticalFlip() {
return true;
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java
index 9e051311c..e344fd461 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLContext.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* 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.
*/
@@ -54,9 +54,9 @@ public class MacOSXOnscreenCGLContext extends MacOSXCGLContext {
@Override
protected void makeCurrentImpl() throws GLException {
super.makeCurrentImpl();
- drawableUpdatedNotify();
+ drawableUpdatedNotify();
}
-
+
@Override
protected void drawableUpdatedNotify() throws GLException {
final int w = drawable.getWidth();
@@ -72,12 +72,12 @@ public class MacOSXOnscreenCGLContext extends MacOSXCGLContext {
CGL.updateContext(contextHandle);
}
}
-
+
@Override
protected boolean createImpl(GLContextImpl sharedWith) {
boolean res = super.createImpl(sharedWith);
- lastWidth = -1;
- lastHeight = -1;
+ lastWidth = -1;
+ lastHeight = -1;
if(res && isNSContext()) {
if(0 != updateHandle) {
throw new InternalError("XXX1");
@@ -96,9 +96,9 @@ public class MacOSXOnscreenCGLContext extends MacOSXCGLContext {
CGL.updateContextUnregister(updateHandle);
updateHandle = 0;
}
- super.destroyImpl();
+ super.destroyImpl();
}
-
+
private long updateHandle = 0;
private int lastWidth, lastHeight;
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java
index 7ba7d2d5a..88886ddd2 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -35,7 +35,6 @@ package jogamp.opengl.macosx.cgl;
import javax.media.opengl.GL;
import javax.media.opengl.GLContext;
-import javax.media.opengl.GLException;
import javax.media.opengl.GLPbuffer;
import jogamp.opengl.GLContextImpl;
@@ -50,6 +49,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
super(drawable, shareWith);
}
+ @Override
public void bindPbufferToTexture() {
GL gl = getGL();
gl.glBindTexture(((MacOSXPbufferCGLDrawable)drawable).getTextureTarget(), texture);
@@ -59,17 +59,19 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
CGL.setContextTextureImageToPBuffer(contextHandle, drawable.getHandle(), GL.GL_FRONT);
}
+ @Override
public void releasePbufferFromTexture() {
}
+ @Override
protected boolean createImpl(GLContextImpl shareWith) {
boolean res = super.createImpl(shareWith);
- if(res) {
+ if(res) {
// Initialize render-to-texture support if requested
final GL gl = getGL();
final MacOSXPbufferCGLDrawable osxPDrawable = (MacOSXPbufferCGLDrawable)drawable;
final int textureTarget = osxPDrawable.getTextureTarget();
-
+
int[] tmp = new int[1];
gl.glGenTextures(1, tmp, 0);
texture = tmp[0];
@@ -78,13 +80,14 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP_TO_EDGE);
gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP_TO_EDGE);
- gl.glTexImage2D(textureTarget, 0, GL.GL_RGB, osxPDrawable.getTextureWidth(), osxPDrawable.getTextureHeight(),
+ gl.glTexImage2D(textureTarget, 0, GL.GL_RGB, osxPDrawable.getTextureWidth(), osxPDrawable.getTextureHeight(),
0, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, null);
gl.glCopyTexSubImage2D(textureTarget, 0, 0, 0, 0, 0, drawable.getWidth(), drawable.getHeight());
}
return res;
}
+ @Override
public int getFloatingPointMode() {
return GLPbuffer.APPLE_FLOAT;
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLContext.java
index 68b26b30d..51341a098 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLContext.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -48,15 +48,18 @@ public class WindowsBitmapWGLContext extends WindowsWGLContext {
super(drawable, shareWith);
}
+ @Override
public int getOffscreenContextPixelDataType() {
return GL.GL_UNSIGNED_BYTE;
}
-
+
+ @Override
public int getOffscreenContextReadBuffer() {
// On Windows these contexts are always single-buffered
return GL.GL_FRONT;
}
+ @Override
public boolean offscreenImageNeedsVerticalFlip() {
// We can take care of this in the DIB creation (see below)
return false;
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLContext.java
index a06ab8f0e..aef55efc6 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLContext.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,26 +28,22 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
package jogamp.opengl.windows.wgl;
-import java.util.*;
-
-import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import jogamp.opengl.*;
public class WindowsOnscreenWGLContext extends WindowsWGLContext {
public WindowsOnscreenWGLContext(WindowsOnscreenWGLDrawable drawable,
GLContext shareWith) {
super(drawable, shareWith);
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLContext.java
index 0f610495d..a11d6e78e 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLContext.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -57,6 +57,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
super(drawable, shareWith);
}
+ @Override
public void bindPbufferToTexture() {
if (!rtt) {
throw new GLException("Shouldn't try to bind a pbuffer to a texture if render-to-texture hasn't been " +
@@ -75,6 +76,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
// we perform a glCopyTexImage2D in swapBuffers().
}
+ @Override
public void releasePbufferFromTexture() {
if (!rtt) {
throw new GLException("Shouldn't try to bind a pbuffer to a texture if render-to-texture hasn't been " +
@@ -88,6 +90,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
}
}
+ @Override
protected boolean createImpl(GLContextImpl shareWith) {
boolean res = super.createImpl(shareWith);
if(res) {
@@ -118,7 +121,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
if (DEBUG) {
System.err.println(" Using render-to-texture-rectangle");
}
- textureTarget = GL2.GL_TEXTURE_RECTANGLE_ARB;
+ textureTarget = GL2GL3.GL_TEXTURE_RECTANGLE_ARB;
} else {
if (DEBUG) {
System.err.println(" Using vanilla render-to-texture");
@@ -140,6 +143,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
return res;
}
+ @Override
public int getFloatingPointMode() {
return ((WindowsPbufferWGLDrawable)drawable).getFloatingPointMode();
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
index 217d88f3c..f143c158b 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -96,10 +96,11 @@ public class WindowsWGLContext extends GLContextImpl {
// no inner state _wglExt=null;
wglExtProcAddressTable=null;
hasSwapIntervalSGI = 0;
- hasSwapGroupNV = 0;
- super.resetStates();
+ hasSwapGroupNV = 0;
+ super.resetStates();
}
-
+
+ @Override
public Object getPlatformGLExtensions() {
return getWGLExt();
}
@@ -114,6 +115,7 @@ public class WindowsWGLContext extends GLContextImpl {
return _wglExt;
}
+ @Override
public final boolean isGLReadDrawableAvailable() {
if(!wglGLReadDrawableAvailableSet && null != getWGLExtProcAddressTable()) {
WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory)drawable.getFactoryImpl();
@@ -159,6 +161,7 @@ public class WindowsWGLContext extends GLContextImpl {
return ok;
}
+ @Override
public final ProcAddressTable getPlatformExtProcAddressTable() {
return getWGLExtProcAddressTable();
}
@@ -167,15 +170,19 @@ public class WindowsWGLContext extends GLContextImpl {
return wglExtProcAddressTable;
}
+ @Override
protected Map getFunctionNameMap() { return functionNameMap; }
+ @Override
protected Map getExtensionNameMap() { return extensionNameMap; }
+ @Override
protected void destroyContextARBImpl(long context) {
WGL.wglMakeCurrent(0, 0);
WGL.wglDeleteContext(context);
}
+ @Override
protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) {
if( null == getWGLExtProcAddressTable()) {
updateGLXProcAddressTable();
@@ -213,8 +220,8 @@ public class WindowsWGLContext extends GLContextImpl {
attribs[idx_profile+1] = WGLExt.WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
} else {
attribs[idx_profile+1] = WGLExt.WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
- }
- }
+ }
+ }
if ( major >= 3 ) {
if( !ctBwdCompat && ctFwdCompat ) {
@@ -255,6 +262,7 @@ public class WindowsWGLContext extends GLContextImpl {
* Creates and initializes an appropriate OpenGL context. Should only be
* called by {@link #makeCurrentImpl()}.
*/
+ @Override
protected boolean createImpl(GLContextImpl shareWith) {
AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration();
AbstractGraphicsDevice device = config.getScreen().getDevice();
@@ -315,11 +323,11 @@ public class WindowsWGLContext extends GLContextImpl {
}
} else if (DEBUG) {
System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - extension not available - share "+share+
- ", isProcCreateContextAttribsARBAvailable "+isProcCreateContextAttribsARBAvailable+", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable);
+ ", isProcCreateContextAttribsARBAvailable "+isProcCreateContextAttribsARBAvailable+", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable);
}
}
}
-
+
if(0!=contextHandle) {
share = 0; // mark as shared thx to the ARB create method
if(0!=temp_ctx) {
@@ -347,7 +355,7 @@ public class WindowsWGLContext extends GLContextImpl {
throw new GLException("Error making old context current: 0x" + toHexString(contextHandle) + ", werr: " + GDI.GetLastError());
}
if(0!=share) {
- // Only utilize the classic GDI 'wglShareLists' shared context method
+ // Only utilize the classic GDI 'wglShareLists' shared context method
// for traditional non ARB context.
if (!WGL.wglShareLists(share, contextHandle)) {
throw new GLException("wglShareLists(" + toHexString(share) +
@@ -361,7 +369,8 @@ public class WindowsWGLContext extends GLContextImpl {
return true;
}
-
+
+ @Override
protected void makeCurrentImpl() throws GLException {
if (WGL.wglGetCurrentContext() != contextHandle) {
if (!wglMakeContextCurrent(drawable.getHandle(), drawableRead.getHandle(), contextHandle)) {
@@ -370,12 +379,14 @@ public class WindowsWGLContext extends GLContextImpl {
}
}
+ @Override
protected void releaseImpl() throws GLException {
if (!wglMakeContextCurrent(0, 0, 0)) {
throw new GLException("Error freeing OpenGL context, werr: " + GDI.GetLastError());
}
}
+ @Override
protected void destroyImpl() throws GLException {
WGL.wglMakeCurrent(0, 0);
if (!WGL.wglDeleteContext(contextHandle)) {
@@ -383,12 +394,14 @@ public class WindowsWGLContext extends GLContextImpl {
}
}
+ @Override
protected void copyImpl(GLContext source, int mask) throws GLException {
if (!WGL.wglCopyContext(source.getHandle(), getHandle(), mask)) {
throw new GLException("wglCopyContext failed");
}
}
+ @Override
protected final void updateGLXProcAddressTable() {
final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
@@ -421,10 +434,11 @@ public class WindowsWGLContext extends GLContextImpl {
}
}
}
-
+
+ @Override
protected final StringBuilder getPlatformExtensionsStringImpl() {
StringBuilder sb = new StringBuilder();
-
+
if (!wglGetExtensionsStringEXTInitialized) {
wglGetExtensionsStringEXTAvailable = (WGL.wglGetProcAddress("wglGetExtensionsStringEXT") != 0);
wglGetExtensionsStringEXTInitialized = true;
@@ -434,7 +448,7 @@ public class WindowsWGLContext extends GLContextImpl {
}
return sb;
}
-
+
@Override
protected boolean setSwapIntervalImpl(int interval) {
WGLExt wglExt = getWGLExt();
@@ -450,7 +464,7 @@ public class WindowsWGLContext extends GLContextImpl {
}
return false;
}
-
+
private final int initSwapGroupImpl(WGLExt wglExt) {
if(0==hasSwapGroupNV) {
try {
@@ -462,7 +476,7 @@ public class WindowsWGLContext extends GLContextImpl {
}
return hasSwapGroupNV;
}
-
+
@Override
protected final boolean queryMaxSwapGroupsImpl(int[] maxGroups, int maxGroups_offset,
int[] maxBarriers, int maxBarriers_offset) {
@@ -471,7 +485,7 @@ public class WindowsWGLContext extends GLContextImpl {
if (initSwapGroupImpl(wglExt)>0) {
final NativeSurface ns = drawable.getNativeSurface();
try {
- if( wglExt.wglQueryMaxSwapGroupsNV(ns.getDisplayHandle(),
+ if( wglExt.wglQueryMaxSwapGroupsNV(ns.getDisplayHandle(),
maxGroups, maxGroups_offset,
maxBarriers, maxBarriers_offset) ) {
res = true;
@@ -480,7 +494,7 @@ public class WindowsWGLContext extends GLContextImpl {
}
return res;
}
-
+
@Override
protected final boolean joinSwapGroupImpl(int group) {
boolean res = false;
@@ -495,7 +509,7 @@ public class WindowsWGLContext extends GLContextImpl {
}
return res;
}
-
+
@Override
protected final boolean bindSwapBarrierImpl(int group, int barrier) {
boolean res = false;
@@ -507,13 +521,15 @@ public class WindowsWGLContext extends GLContextImpl {
}
} catch (Throwable t) { hasSwapGroupNV=-1; }
}
- return res;
+ return res;
}
-
+
+ @Override
public ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) {
return getWGLExt().wglAllocateMemoryNV(arg0, arg1, arg2, arg3);
}
+ @Override
public int getOffscreenContextPixelDataType() {
throw new GLException("Should not call this");
}
@@ -522,14 +538,17 @@ public class WindowsWGLContext extends GLContextImpl {
throw new GLException("Should not call this");
}
+ @Override
public boolean offscreenImageNeedsVerticalFlip() {
throw new GLException("Should not call this");
}
+ @Override
public void bindPbufferToTexture() {
throw new GLException("Should not call this");
}
+ @Override
public void releasePbufferFromTexture() {
throw new GLException("Should not call this");
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
index 2fd8cbcd9..918bf8643 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -91,7 +91,7 @@ public abstract class X11GLXContext extends GLContextImpl {
GLContext shareWith) {
super(drawable, shareWith);
}
-
+
@Override
protected void resetStates() {
// no inner state _glXExt=null;
@@ -102,6 +102,7 @@ public abstract class X11GLXContext extends GLContextImpl {
super.resetStates();
}
+ @Override
public final ProcAddressTable getPlatformExtProcAddressTable() {
return getGLXExtProcAddressTable();
}
@@ -110,6 +111,7 @@ public abstract class X11GLXContext extends GLContextImpl {
return glXExtProcAddressTable;
}
+ @Override
public Object getPlatformGLExtensions() {
return getGLXExt();
}
@@ -121,14 +123,17 @@ public abstract class X11GLXContext extends GLContextImpl {
return _glXExt;
}
+ @Override
protected Map getFunctionNameMap() { return functionNameMap; }
+ @Override
protected Map getExtensionNameMap() { return extensionNameMap; }
protected final boolean isGLXVersionGreaterEqualOneThree() {
- return ((X11GLXDrawableFactory)drawable.getFactoryImpl()).isGLXVersionGreaterEqualOneThree(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice());
+ return ((X11GLXDrawableFactory)drawable.getFactoryImpl()).isGLXVersionGreaterEqualOneThree(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice());
}
-
+
+ @Override
public final boolean isGLReadDrawableAvailable() {
return isGLXVersionGreaterEqualOneThree();
}
@@ -158,6 +163,7 @@ public abstract class X11GLXContext extends GLContextImpl {
return res;
}
+ @Override
protected void destroyContextARBImpl(long ctx) {
X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration();
long display = config.getScreen().getDevice().getHandle();
@@ -178,7 +184,8 @@ public abstract class X11GLXContext extends GLContextImpl {
/* 8 */ 0, 0,
/* 10 */ 0
};
-
+
+ @Override
protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) {
updateGLXProcAddressTable();
GLXExt _glXExt = getGLXExt();
@@ -197,15 +204,15 @@ public abstract class X11GLXContext extends GLContextImpl {
IntBuffer attribs = Buffers.newDirectIntBuffer(ctx_arb_attribs_rom);
attribs.put(ctx_arb_attribs_idx_major + 1, major);
attribs.put(ctx_arb_attribs_idx_minor + 1, minor);
-
+
if ( major > 3 || major == 3 && minor >= 2 ) {
attribs.put(ctx_arb_attribs_idx_profile + 0, GLX.GLX_CONTEXT_PROFILE_MASK_ARB);
if( ctBwdCompat ) {
attribs.put(ctx_arb_attribs_idx_profile + 1, GLX.GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB);
} else {
attribs.put(ctx_arb_attribs_idx_profile + 1, GLX.GLX_CONTEXT_CORE_PROFILE_BIT_ARB);
- }
- }
+ }
+ }
if ( major >= 3 ) {
int flags = attribs.get(ctx_arb_attribs_idx_flags + 1);
@@ -253,6 +260,7 @@ public abstract class X11GLXContext extends GLContextImpl {
return ctx;
}
+ @Override
protected boolean createImpl(GLContextImpl shareWith) {
// covers the whole context creation loop incl createContextARBImpl and destroyContextARBImpl
X11Util.setX11ErrorHandler(true, DEBUG ? false : true);
@@ -340,7 +348,7 @@ public abstract class X11GLXContext extends GLContextImpl {
createContextARBTried=true;
if (DEBUG) {
if(0!=contextHandle) {
- System.err.println(getThreadName() + ": createContextImpl: OK (ARB, initial) share "+share);
+ System.err.println(getThreadName() + ": createContextImpl: OK (ARB, initial) share "+share);
} else {
System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - creation failed - share "+share);
}
@@ -388,6 +396,7 @@ public abstract class X11GLXContext extends GLContextImpl {
return true;
}
+ @Override
protected void makeCurrentImpl() throws GLException {
long dpy = drawable.getNativeSurface().getDisplayHandle();
@@ -403,6 +412,7 @@ public abstract class X11GLXContext extends GLContextImpl {
}
}
+ @Override
protected void releaseImpl() throws GLException {
long display = drawable.getNativeSurface().getDisplayHandle();
X11Util.setX11ErrorHandler(true, DEBUG ? false : true);
@@ -415,10 +425,12 @@ public abstract class X11GLXContext extends GLContextImpl {
}
}
+ @Override
protected void destroyImpl() throws GLException {
GLX.glXDestroyContext(drawable.getNativeSurface().getDisplayHandle(), contextHandle);
}
+ @Override
protected void copyImpl(GLContext source, int mask) throws GLException {
long dst = getHandle();
long src = source.getHandle();
@@ -430,6 +442,7 @@ public abstract class X11GLXContext extends GLContextImpl {
// Should check for X errors and raise GLException
}
+ @Override
protected final void updateGLXProcAddressTable() {
final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
@@ -458,11 +471,12 @@ public abstract class X11GLXContext extends GLContextImpl {
}
}
+ @Override
protected final StringBuilder getPlatformExtensionsStringImpl() {
StringBuilder sb = new StringBuilder();
if (DEBUG) {
System.err.println("GLX Version client version "+ GLXUtil.getClientVersionNumber()+
- ", server: "+
+ ", server: "+
((X11GLXDrawableFactory)drawable.getFactoryImpl()).getGLXVersionNumber(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice()));
}
final NativeSurface ns = drawable.getNativeSurface();
@@ -492,6 +506,7 @@ public abstract class X11GLXContext extends GLContextImpl {
return sb;
}
+ @Override
public boolean isExtensionAvailable(String glExtensionName) {
if (glExtensionName.equals("GL_ARB_pbuffer") ||
glExtensionName.equals("GL_ARB_pixel_format")) {
@@ -532,7 +547,7 @@ public abstract class X11GLXContext extends GLContextImpl {
}
return hasSwapGroupNV;
}
-
+
@Override
protected final boolean queryMaxSwapGroupsImpl(int[] maxGroups, int maxGroups_offset,
int[] maxBarriers, int maxBarriers_offset) {
@@ -541,7 +556,7 @@ public abstract class X11GLXContext extends GLContextImpl {
if (initSwapGroupImpl(glXExt)>0) {
final NativeSurface ns = drawable.getNativeSurface();
try {
- if( glXExt.glXQueryMaxSwapGroupsNV(ns.getDisplayHandle(), ns.getScreenIndex(),
+ if( glXExt.glXQueryMaxSwapGroupsNV(ns.getDisplayHandle(), ns.getScreenIndex(),
maxGroups, maxGroups_offset,
maxBarriers, maxBarriers_offset) ) {
res = true;
@@ -550,7 +565,7 @@ public abstract class X11GLXContext extends GLContextImpl {
}
return res;
}
-
+
@Override
protected final boolean joinSwapGroupImpl(int group) {
boolean res = false;
@@ -565,7 +580,7 @@ public abstract class X11GLXContext extends GLContextImpl {
}
return res;
}
-
+
@Override
protected final boolean bindSwapBarrierImpl(int group, int barrier) {
boolean res = false;
@@ -577,7 +592,7 @@ public abstract class X11GLXContext extends GLContextImpl {
}
} catch (Throwable t) { hasSwapGroupNV=-1; }
}
- return res;
+ return res;
}
@Override
@@ -585,6 +600,7 @@ public abstract class X11GLXContext extends GLContextImpl {
return getGLXExt().glXAllocateMemoryNV(arg0, arg1, arg2, arg3);
}
+ @Override
public int getOffscreenContextPixelDataType() {
throw new GLException("Should not call this");
}
@@ -593,18 +609,22 @@ public abstract class X11GLXContext extends GLContextImpl {
throw new GLException("Should not call this");
}
+ @Override
public boolean offscreenImageNeedsVerticalFlip() {
throw new GLException("Should not call this");
}
+ @Override
public void bindPbufferToTexture() {
throw new GLException("Should not call this");
}
+ @Override
public void releasePbufferFromTexture() {
throw new GLException("Should not call this");
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXContext.java
index ce5d466d4..460dc10ca 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXContext.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXContext.java
index 765a8207a..a34e050cd 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXContext.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* 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.
*/
@@ -47,17 +47,20 @@ public class X11PbufferGLXContext extends X11GLXContext {
super(drawable, shareWith);
}
+ @Override
public void bindPbufferToTexture() {
// FIXME: figure out how to implement this
throw new GLException("Not yet implemented");
}
+ @Override
public void releasePbufferFromTexture() {
// FIXME: figure out how to implement this
throw new GLException("Not yet implemented");
}
+ @Override
public int getFloatingPointMode() {
return ((X11PbufferGLXDrawable)drawable).getFloatingPointMode();
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXContext.java
index e19dfd1b3..96d0f18dc 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXContext.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -49,11 +49,13 @@ public class X11PixmapGLXContext extends X11GLXContext {
super(drawable, shareWith);
}
+ @Override
public int getOffscreenContextPixelDataType() {
GL gl = getGL();
return gl.isGL2GL3()?GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1;
}
-
+
+ @Override
public int getOffscreenContextReadBuffer() {
GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable)drawable.getNativeSurface().getGraphicsConfiguration().getChosenCapabilities();
if (caps.getDoubleBuffered()) {
@@ -62,6 +64,7 @@ public class X11PixmapGLXContext extends X11GLXContext {
return GL.GL_FRONT;
}
+ @Override
public boolean offscreenImageNeedsVerticalFlip() {
// There doesn't seem to be a way to do this in the construction
// of the Pixmap or GLXPixmap
--
cgit v1.2.3
From 914b522af26b6d779dc931bf4303be3c7e898eff Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Wed, 27 Jun 2012 06:16:09 +0200
Subject: Capabilities cleanup: make most get*() final, impl. Comparable to
CapabilitiesImmutable, Misc ..
- Comparable to CapabilitiesImmutable:
"interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable" ->
"interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable, Comparable"
- CapabilitiesImmutable and GLCapabilitiesImmutable get-methods final (most)
- GLCapabilitiesImmutable.compareTo: add doubleBuffered (between stereo and samples)
Misc:
- Add @Override
- remove trailing whitespace,
---
.../classes/javax/media/opengl/GLCapabilities.java | 135 ++++++++++++--------
.../jogamp/opengl/egl/EGLGLCapabilities.java | 25 ++--
.../opengl/windows/wgl/WGLGLCapabilities.java | 15 ++-
.../jogamp/opengl/x11/glx/X11GLCapabilities.java | 7 +-
.../javax/media/nativewindow/Capabilities.java | 142 ++++++++++++---------
.../media/nativewindow/CapabilitiesImmutable.java | 4 +-
.../jogamp/nativewindow/x11/X11Capabilities.java | 7 +-
7 files changed, 198 insertions(+), 137 deletions(-)
(limited to 'src/jogl/classes/jogamp')
diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilities.java b/src/jogl/classes/javax/media/opengl/GLCapabilities.java
index 8b832b310..61ab2e58d 100644
--- a/src/jogl/classes/javax/media/opengl/GLCapabilities.java
+++ b/src/jogl/classes/javax/media/opengl/GLCapabilities.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -41,6 +41,7 @@
package javax.media.opengl;
import javax.media.nativewindow.Capabilities;
+import javax.media.nativewindow.CapabilitiesImmutable;
/** Specifies a set of OpenGL capabilities.
At creation time of a {@link GLDrawable} using {@link GLDrawableFactory},
@@ -86,10 +87,12 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
glProfile = (null!=glp)?glp:GLProfile.getDefault(GLProfile.getDefaultDevice());
}
+ @Override
public Object cloneMutable() {
return clone();
}
+ @Override
public Object clone() {
try {
return super.clone();
@@ -98,6 +101,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
}
}
+ @Override
public int hashCode() {
// 31 * x == (x << 5) - x
int hash = 31 + this.glProfile.hashCode() ;
@@ -119,6 +123,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
return hash;
}
+ @Override
public boolean equals(Object obj) {
if(this == obj) { return true; }
if(!(obj instanceof GLCapabilitiesImmutable)) {
@@ -142,46 +147,52 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
other.getPbufferRenderToTextureRectangle()==pbufferRenderToTextureRectangle;
if(sampleBuffers) {
res = res &&
- other.getNumSamples()==numSamples &&
+ other.getNumSamples()==numSamples &&
other.getSampleExtension().equals(sampleExtension) ;
}
return res;
}
/** comparing hw/sw, stereo, multisample, stencil, RGBA and depth only */
- public int compareTo(Object o) {
- if ( ! ( o instanceof GLCapabilities ) ) {
+ @Override
+ public int compareTo(final CapabilitiesImmutable o) {
+ if ( ! ( o instanceof GLCapabilitiesImmutable ) ) {
Class> c = (null != o) ? o.getClass() : null ;
- throw new ClassCastException("Not a GLCapabilities object: " + c);
+ throw new ClassCastException("Not a GLCapabilitiesImmutable object, but " + c);
}
+ final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) o;
- final GLCapabilities caps = (GLCapabilities) o;
+ if(hardwareAccelerated && !caps.getHardwareAccelerated()) {
+ return 1;
+ } else if(!hardwareAccelerated && caps.getHardwareAccelerated()) {
+ return -1;
+ }
- if(hardwareAccelerated && !caps.hardwareAccelerated) {
+ if(stereo && !caps.getStereo()) {
return 1;
- } else if(!hardwareAccelerated && caps.hardwareAccelerated) {
+ } else if(!stereo && caps.getStereo()) {
return -1;
}
- if(stereo && !caps.stereo) {
+ if(doubleBuffered && !caps.getDoubleBuffered()) {
return 1;
- } else if(!stereo && caps.stereo) {
+ } else if(!doubleBuffered && caps.getDoubleBuffered()) {
return -1;
}
final int ms = sampleBuffers ? numSamples : 0;
- final int xms = caps.sampleBuffers ? caps.numSamples : 0;
+ final int xms = caps.getSampleBuffers() ? caps.getNumSamples() : 0;
if(ms > xms) {
return 1;
} else if( ms < xms ) {
return -1;
}
- // ignore the sample extension
+ // ignore the sample extension
- if(stencilBits > caps.stencilBits) {
+ if(stencilBits > caps.getStencilBits()) {
return 1;
- } else if(stencilBits < caps.stencilBits) {
+ } else if(stencilBits < caps.getStencilBits()) {
return -1;
}
@@ -190,16 +201,17 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
return sc;
}
- if(depthBits > caps.depthBits) {
+ if(depthBits > caps.getDepthBits()) {
return 1;
- } else if(depthBits < caps.depthBits) {
+ } else if(depthBits < caps.getDepthBits()) {
return -1;
}
return 0; // they are equal: hw/sw, stereo, multisample, stencil, RGBA and depth
}
- public GLProfile getGLProfile() {
+ @Override
+ public final GLProfile getGLProfile() {
return glProfile;
}
@@ -208,11 +220,12 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
glProfile=profile;
}
- public boolean isPBuffer() {
+ @Override
+ public final boolean isPBuffer() {
return pbuffer;
}
- /**
+ /**
* Enables or disables pbuffer usage.
* If enabled this method also invokes {@link #setOnscreen(int) setOnscreen(false)}
* Defaults to false.
@@ -229,6 +242,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
* If enabled this method also invokes {@link #setPBuffer(int) setPBuffer(false)}
* Defaults to true.
*/
+ @Override
public void setOnscreen(boolean onscreen) {
if(onscreen) {
setPBuffer(false);
@@ -236,7 +250,8 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
super.setOnscreen(onscreen);
}
- public boolean getDoubleBuffered() {
+ @Override
+ public final boolean getDoubleBuffered() {
return doubleBuffered;
}
@@ -245,25 +260,28 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
doubleBuffered = enable;
}
- public boolean getStereo() {
+ @Override
+ public final boolean getStereo() {
return stereo;
}
-
+
/** Enables or disables stereo viewing. */
public void setStereo(boolean enable) {
stereo = enable;
}
- public boolean getHardwareAccelerated() {
+ @Override
+ public final boolean getHardwareAccelerated() {
return hardwareAccelerated;
}
-
+
/** Enables or disables hardware acceleration. */
public void setHardwareAccelerated(boolean enable) {
hardwareAccelerated = enable;
}
- public int getDepthBits() {
+ @Override
+ public final int getDepthBits() {
return depthBits;
}
@@ -271,8 +289,9 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
public void setDepthBits(int depthBits) {
this.depthBits = depthBits;
}
-
- public int getStencilBits() {
+
+ @Override
+ public final int getStencilBits() {
return stencilBits;
}
@@ -280,8 +299,9 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
public void setStencilBits(int stencilBits) {
this.stencilBits = stencilBits;
}
-
- public int getAccumRedBits() {
+
+ @Override
+ public final int getAccumRedBits() {
return accumRedBits;
}
@@ -293,7 +313,8 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
this.accumRedBits = accumRedBits;
}
- public int getAccumGreenBits() {
+ @Override
+ public final int getAccumGreenBits() {
return accumGreenBits;
}
@@ -305,7 +326,8 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
this.accumGreenBits = accumGreenBits;
}
- public int getAccumBlueBits() {
+ @Override
+ public final int getAccumBlueBits() {
return accumBlueBits;
}
@@ -317,7 +339,8 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
this.accumBlueBits = accumBlueBits;
}
- public int getAccumAlphaBits() {
+ @Override
+ public final int getAccumAlphaBits() {
return accumAlphaBits;
}
@@ -333,14 +356,15 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
* Sets the desired extension for full-scene antialiasing
* (FSAA), default is {@link #DEFAULT_SAMPLE_EXTENSION}.
*/
- public void setSampleExtension(String se) {
- sampleExtension = se;
+ public void setSampleExtension(String se) {
+ sampleExtension = se;
}
-
- public String getSampleExtension() {
- return sampleExtension;
+
+ @Override
+ public final String getSampleExtension() {
+ return sampleExtension;
}
-
+
/**
* Defaults to false.
* Indicates whether sample buffers for full-scene antialiasing
@@ -353,10 +377,11 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
sampleBuffers = enable;
if(sampleBuffers && getAlphaBits()==0) {
setAlphaBits(1);
- }
+ }
}
- public boolean getSampleBuffers() {
+ @Override
+ public final boolean getSampleBuffers() {
return sampleBuffers;
}
@@ -366,7 +391,8 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
this.numSamples = numSamples;
}
- public int getNumSamples() {
+ @Override
+ public final int getNumSamples() {
return numSamples;
}
@@ -376,7 +402,8 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
pbufferFloatingPointBuffers = enable;
}
- public boolean getPbufferFloatingPointBuffers() {
+ @Override
+ public final boolean getPbufferFloatingPointBuffers() {
return pbufferFloatingPointBuffers;
}
@@ -386,7 +413,8 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
pbufferRenderToTexture = enable;
}
- public boolean getPbufferRenderToTexture() {
+ @Override
+ public final boolean getPbufferRenderToTexture() {
return pbufferRenderToTexture;
}
@@ -397,10 +425,12 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
pbufferRenderToTextureRectangle = enable;
}
- public boolean getPbufferRenderToTextureRectangle() {
+ @Override
+ public final boolean getPbufferRenderToTextureRectangle() {
return pbufferRenderToTextureRectangle;
}
+ @Override
public StringBuilder toString(StringBuilder sink) {
if(null == sink) {
sink = new StringBuilder();
@@ -441,12 +471,13 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
sink.append(", pixmap");
}
}
-
+
return sink;
}
/** Returns a textual representation of this GLCapabilities
- object. */
+ object. */
+ @Override
public String toString() {
StringBuilder msg = new StringBuilder();
msg.append("GLCaps[");
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java
index f813edf86..70a570174 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java
@@ -37,17 +37,17 @@ import javax.media.opengl.GLProfile;
public class EGLGLCapabilities extends GLCapabilities {
private long eglcfg;
final private int eglcfgid;
- final private int renderableType;
+ final private int renderableType;
final private int nativeVisualID;
-
+
/**
- *
+ *
* @param eglcfg
* @param eglcfgid
* @param visualID native visualID if valid, otherwise VisualIDHolder.VID_UNDEFINED
* @param glp desired GLProfile, or null if determined by renderableType
* @param renderableType actual EGL renderableType
- *
+ *
* May throw GLException if given GLProfile is not compatible w/ renderableType
*/
public EGLGLCapabilities(long eglcfg, int eglcfgid, int visualID, GLProfile glp, int renderableType) {
@@ -62,10 +62,12 @@ public class EGLGLCapabilities extends GLCapabilities {
this.nativeVisualID = visualID;
}
+ @Override
public Object cloneMutable() {
return clone();
}
+ @Override
public Object clone() {
try {
return super.clone();
@@ -73,13 +75,13 @@ public class EGLGLCapabilities extends GLCapabilities {
throw new GLException(e);
}
}
-
+
final protected void setEGLConfig(long v) { eglcfg=v; }
final public long getEGLConfig() { return eglcfg; }
final public int getEGLConfigID() { return eglcfgid; }
final public int getRenderableType() { return renderableType; }
final public int getNativeVisualID() { return nativeVisualID; }
-
+
@Override
final public int getVisualID(VIDType type) throws NativeWindowException {
switch(type) {
@@ -90,9 +92,9 @@ public class EGLGLCapabilities extends GLCapabilities {
return getNativeVisualID();
default:
throw new NativeWindowException("Invalid type <"+type+">");
- }
+ }
}
-
+
public static boolean isCompatible(GLProfile glp, int renderableType) {
if(null == glp) {
return true;
@@ -121,7 +123,7 @@ public class EGLGLCapabilities extends GLCapabilities {
}
return null;
}
-
+
public static StringBuilder renderableTypeToString(StringBuilder sink, int renderableType) {
if(null == sink) {
sink = new StringBuilder();
@@ -139,9 +141,10 @@ public class EGLGLCapabilities extends GLCapabilities {
if(0 != (renderableType & EGL.EGL_OPENVG_API)) {
if(!first) sink.append(", "); sink.append("VG"); first=false;
}
- return sink;
+ return sink;
}
-
+
+ @Override
public StringBuilder toString(StringBuilder sink) {
if(null == sink) {
sink = new StringBuilder();
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java
index 5ff63d93b..e255a0672 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java
@@ -119,7 +119,7 @@ public class WGLGLCapabilities extends GLCapabilities {
if (iresults[i] == WGLExt.WGL_TYPE_RGBA_FLOAT_ARB) {
setPbufferFloatingPointBuffers(true);
}
-
+
// normal RGBA FB: WGLExt.WGL_TYPE_RGBA_ARB
// ignore unknown results here
break;
@@ -177,10 +177,12 @@ public class WGLGLCapabilities extends GLCapabilities {
return true;
}
+ @Override
public Object cloneMutable() {
return clone();
}
+ @Override
public Object clone() {
try {
return super.clone();
@@ -191,11 +193,11 @@ public class WGLGLCapabilities extends GLCapabilities {
final public PIXELFORMATDESCRIPTOR getPFD() { return pfd; }
final public int getPFDID() { return pfdID; }
-
+
final public boolean isSetByARB() { return 0 < arb_pixelformat; }
final public boolean isSetByGDI() { return 0 > arb_pixelformat; }
final public boolean isSet() { return 0 != arb_pixelformat; }
-
+
@Override
final public int getVisualID(VIDType type) throws NativeWindowException {
switch(type) {
@@ -205,16 +207,17 @@ public class WGLGLCapabilities extends GLCapabilities {
return getPFDID();
default:
throw new NativeWindowException("Invalid type <"+type+">");
- }
+ }
}
-
+
+ @Override
public StringBuilder toString(StringBuilder sink) {
if(null == sink) {
sink = new StringBuilder();
}
sink.append("wgl vid 0x").append(Integer.toHexString(pfdID)).append(" ");
switch (arb_pixelformat) {
- case -1:
+ case -1:
sink.append("gdi");
break;
case 0:
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java
index 96d4c7713..e0b69ffd4 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java
@@ -55,10 +55,12 @@ public class X11GLCapabilities extends GLCapabilities {
this.fbcfgid = VisualIDHolder.VID_UNDEFINED;
}
+ @Override
public Object cloneMutable() {
return clone();
}
+ @Override
public Object clone() {
try {
return super.clone();
@@ -86,9 +88,10 @@ public class X11GLCapabilities extends GLCapabilities {
return getFBConfigID();
default:
throw new NativeWindowException("Invalid type <"+type+">");
- }
+ }
}
-
+
+ @Override
public StringBuilder toString(StringBuilder sink) {
if(null == sink) {
sink = new StringBuilder();
diff --git a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
index b422f50e6..196f23598 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -44,7 +44,7 @@ package javax.media.nativewindow;
must support, such as color depth per channel. It currently
contains the minimal number of routines which allow configuration
on all supported window systems. */
-public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparable {
+public class Capabilities implements CapabilitiesImmutable, Cloneable {
protected final static String na_str = "----" ;
private int redBits = 8;
@@ -67,10 +67,12 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl
*/
public Capabilities() {}
+ @Override
public Object cloneMutable() {
return clone();
}
-
+
+ @Override
public Object clone() {
try {
return super.clone();
@@ -79,6 +81,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl
}
}
+ @Override
public int hashCode() {
// 31 * x == (x << 5) - x
int hash = 31 + this.redBits;
@@ -94,6 +97,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl
return hash;
}
+ @Override
public boolean equals(Object obj) {
if(this == obj) { return true; }
if(!(obj instanceof CapabilitiesImmutable)) {
@@ -116,20 +120,23 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl
return res;
}
- /** comparing RGBA values only */
- public int compareTo(Object o) {
- if ( ! ( o instanceof Capabilities ) ) {
+ /**
+ * Comparing RGBA values only
+ **/
+ @Override
+ public int compareTo(final CapabilitiesImmutable caps) {
+ /**
+ if ( ! ( o instanceof CapabilitiesImmutable ) ) {
Class> c = (null != o) ? o.getClass() : null ;
- throw new ClassCastException("Not a Capabilities object: " + c);
+ throw new ClassCastException("Not a CapabilitiesImmutable object, but " + c);
}
-
- final Capabilities caps = (Capabilities) o;
-
+ final CapabilitiesImmutable caps = (CapabilitiesImmutable) o; */
+
final int a = ( alphaBits > 0 ) ? alphaBits : 1;
final int rgba = redBits * greenBits * blueBits * a;
- final int xa = ( caps.alphaBits ) > 0 ? caps.alphaBits : 1;
- final int xrgba = caps.redBits * caps.greenBits * caps.blueBits * xa;
+ final int xa = ( caps.getAlphaBits() ) > 0 ? caps.getAlphaBits() : 1;
+ final int xrgba = caps.getRedBits() * caps.getGreenBits() * caps.getBlueBits() * xa;
if(rgba > xrgba) {
return 1;
@@ -148,13 +155,14 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl
return VisualIDHolder.VID_UNDEFINED;
default:
throw new NativeWindowException("Invalid type <"+type+">");
- }
+ }
}
-
+
/** Returns the number of bits requested for the color buffer's red
component. On some systems only the color depth, which is the
sum of the red, green, and blue bits, is considered. */
- public int getRedBits() {
+ @Override
+ public final int getRedBits() {
return redBits;
}
@@ -168,7 +176,8 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl
/** Returns the number of bits requested for the color buffer's
green component. On some systems only the color depth, which is
the sum of the red, green, and blue bits, is considered. */
- public int getGreenBits() {
+ @Override
+ public final int getGreenBits() {
return greenBits;
}
@@ -182,7 +191,8 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl
/** Returns the number of bits requested for the color buffer's blue
component. On some systems only the color depth, which is the
sum of the red, green, and blue bits, is considered. */
- public int getBlueBits() {
+ @Override
+ public final int getBlueBits() {
return blueBits;
}
@@ -192,11 +202,12 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl
public void setBlueBits(int blueBits) {
this.blueBits = blueBits;
}
-
+
/** Returns the number of bits requested for the color buffer's
alpha component. On some systems only the color depth, which is
the sum of the red, green, and blue bits, is considered. */
- public int getAlphaBits() {
+ @Override
+ public final int getAlphaBits() {
return alphaBits;
}
@@ -207,36 +218,36 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl
this.alphaBits = alphaBits;
}
- /**
- * Defaults to true, ie. opaque surface.
- *
- * On supported platforms, setting opaque to false may result in a translucent surface.
- *
- *
- * Platform implementations may need an alpha component in the surface (eg. Windows),
- * or expect pre-multiplied alpha values (eg. X11/XRender).
- * To unify the experience, this method also invokes {@link #setAlphaBits(int) setAlphaBits(1)}
- * if {@link #getAlphaBits()} == 0.
- * Please note that in case alpha is required on the platform the
- * clear color shall have an alpha lower than 1.0 to allow anything shining through.
- *
- *
- *
- * Mind that translucency may cause a performance penalty
- * due to the composite work required by the window manager.
- *
- *
- * The platform implementation may utilize the transparency RGBA values.
- * This is true for the original GLX transparency specification, which is no more used today.
- * Actually these values are currently not used by any implementation,
- * so we may mark them deprecated soon, if this doesn't change.
- *
+ * On supported platforms, setting opaque to false may result in a translucent surface.
+ *
+ *
+ * Platform implementations may need an alpha component in the surface (eg. Windows),
+ * or expect pre-multiplied alpha values (eg. X11/XRender).
+ * To unify the experience, this method also invokes {@link #setAlphaBits(int) setAlphaBits(1)}
+ * if {@link #getAlphaBits()} == 0.
+ * Please note that in case alpha is required on the platform the
+ * clear color shall have an alpha lower than 1.0 to allow anything shining through.
+ *
+ *
+ *
+ * Mind that translucency may cause a performance penalty
+ * due to the composite work required by the window manager.
+ *
+ *
+ * The platform implementation may utilize the transparency RGBA values.
+ * This is true for the original GLX transparency specification, which is no more used today.
+ * Actually these values are currently not used by any implementation,
+ * so we may mark them deprecated soon, if this doesn't change.
+ *
+ */
public void setBackgroundOpaque(boolean opaque) {
- backgroundOpaque = opaque;
- if(!opaque && getAlphaBits()==0) {
- setAlphaBits(1);
- }
+ backgroundOpaque = opaque;
+ if(!opaque && getAlphaBits()==0) {
+ setAlphaBits(1);
+ }
}
/** Indicates whether the background of this OpenGL context should
@@ -244,7 +255,8 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl
@see #setBackgroundOpaque
*/
- public boolean isBackgroundOpaque() {
+ @Override
+ public final boolean isBackgroundOpaque() {
return backgroundOpaque;
}
@@ -258,7 +270,8 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl
/** Indicates whether the drawable surface is onscreen.
Defaults to true.
*/
- public boolean isOnscreen() {
+ @Override
+ public final boolean isOnscreen() {
return onscreen;
}
@@ -266,25 +279,29 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl
* This value is undefined if {@link #isBackgroundOpaque()} equals true.
* @see #setTransparentRedValue
*/
- public int getTransparentRedValue() { return transparentValueRed; }
+ @Override
+ public final int getTransparentRedValue() { return transparentValueRed; }
/** Gets the transparent green value for the frame buffer configuration.
* This value is undefined if {@link #isBackgroundOpaque()} equals true.
* @see #setTransparentGreenValue
*/
- public int getTransparentGreenValue() { return transparentValueGreen; }
+ @Override
+ public final int getTransparentGreenValue() { return transparentValueGreen; }
/** Gets the transparent blue value for the frame buffer configuration.
* This value is undefined if {@link #isBackgroundOpaque()} equals true.
* @see #setTransparentBlueValue
*/
- public int getTransparentBlueValue() { return transparentValueBlue; }
+ @Override
+ public final int getTransparentBlueValue() { return transparentValueBlue; }
/** Gets the transparent alpha value for the frame buffer configuration.
* This value is undefined if {@link #isBackgroundOpaque()} equals true.
* @see #setTransparentAlphaValue
*/
- public int getTransparentAlphaValue() { return transparentValueAlpha; }
+ @Override
+ public final int getTransparentAlphaValue() { return transparentValueAlpha; }
/** Sets the transparent red value for the frame buffer configuration,
ranging from 0 to the maximum frame buffer value for red.
@@ -314,6 +331,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl
A value of -1 is interpreted as any value. */
public void setTransparentAlphaValue(int transValueAlpha) { transparentValueAlpha=transValueAlpha; }
+ @Override
public StringBuilder toString(StringBuilder sink) {
if(null == sink) {
sink = new StringBuilder();
@@ -334,7 +352,8 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl
protected final String toHexString(int val) { return Integer.toHexString(val); }
/** Returns a textual representation of this Capabilities
- object. */
+ object. */
+ @Override
public String toString() {
StringBuilder msg = new StringBuilder();
msg.append("Caps[");
@@ -342,5 +361,4 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable, Comparabl
msg.append("]");
return msg.toString();
}
-
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java
index 3d7362c40..b984a4626 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java
@@ -33,10 +33,10 @@ import com.jogamp.common.type.WriteCloneable;
/**
* Specifies an immutable set of capabilities that a window's rendering context
* must support, such as color depth per channel.
- *
+ *
* @see javax.media.nativewindow.Capabilities
*/
-public interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable {
+public interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable, Comparable {
/**
* Returns the number of bits requested for the color buffer's red
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java
index 0e69c738f..4f8cff8c5 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Capabilities.java
@@ -40,10 +40,12 @@ public class X11Capabilities extends Capabilities {
this.xVisualInfo = xVisualInfo;
}
+ @Override
public Object cloneMutable() {
return clone();
}
+ @Override
public Object clone() {
try {
return super.clone();
@@ -68,9 +70,10 @@ public class X11Capabilities extends Capabilities {
return VisualIDHolder.VID_UNDEFINED;
default:
throw new NativeWindowException("Invalid type <"+type+">");
- }
+ }
}
-
+
+ @Override
public StringBuilder toString(StringBuilder sink) {
if(null == sink) {
sink = new StringBuilder();
--
cgit v1.2.3
From bd92af2b6b0ae2d1b1f22c64dcb0ffd0e94fae84 Mon Sep 17 00:00:00 2001
From: Sven Gothel
Date: Thu, 28 Jun 2012 18:37:55 +0200
Subject: GLDrawable* cleanup: Add @Override, remove trailing whitespace, ..
---
.../classes/javax/media/opengl/GLAutoDrawable.java | 66 +++----
.../classes/javax/media/opengl/GLDrawable.java | 30 ++--
src/jogl/classes/javax/media/opengl/GLPbuffer.java | 15 +-
.../javax/media/opengl/awt/AWTGLAutoDrawable.java | 16 +-
.../classes/javax/media/opengl/awt/GLCanvas.java | 175 ++++++++++++-------
.../classes/javax/media/opengl/awt/GLJPanel.java | 190 +++++++++++++++------
src/jogl/classes/jogamp/opengl/GLPbufferImpl.java | 69 ++++++--
.../jogamp/opengl/egl/EGLDrawableFactory.java | 129 ++++++++------
.../macosx/cgl/MacOSXCGLDrawableFactory.java | 85 +++++----
.../macosx/cgl/MacOSXOffscreenCGLDrawable.java | 15 +-
.../macosx/cgl/MacOSXOnscreenCGLDrawable.java | 16 +-
.../windows/wgl/WindowsBitmapWGLDrawable.java | 5 +-
.../windows/wgl/WindowsDummyWGLDrawable.java | 11 +-
.../windows/wgl/WindowsExternalWGLDrawable.java | 4 +-
.../windows/wgl/WindowsOnscreenWGLDrawable.java | 5 +-
.../windows/wgl/WindowsPbufferWGLDrawable.java | 5 +-
.../windows/wgl/WindowsWGLDrawableFactory.java | 129 +++++++++-----
.../jogamp/opengl/x11/glx/X11DummyGLXDrawable.java | 9 +-
.../opengl/x11/glx/X11ExternalGLXDrawable.java | 1 -
.../jogamp/opengl/x11/glx/X11GLXDrawable.java | 7 +-
.../opengl/x11/glx/X11GLXDrawableFactory.java | 105 ++++++++----
.../opengl/x11/glx/X11OnscreenGLXDrawable.java | 6 +-
.../opengl/x11/glx/X11PbufferGLXDrawable.java | 11 +-
.../opengl/x11/glx/X11PixmapGLXDrawable.java | 13 +-
24 files changed, 716 insertions(+), 401 deletions(-)
(limited to 'src/jogl/classes/jogamp')
diff --git a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
index c676535c8..94e4bad66 100644
--- a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -54,7 +54,7 @@ import jogamp.opengl.Debug;
based rendering mechanism as well by end users directly.
The implementation shall initialize itself as soon as possible,
- ie if the attached {@link javax.media.nativewindow.NativeSurface NativeSurface} becomes visible/realized.
+ ie if the attached {@link javax.media.nativewindow.NativeSurface NativeSurface} becomes visible/realized.
The following protocol shall be satisfied:
Create the {@link GLDrawable} with the requested {@link GLCapabilities}
@@ -66,15 +66,15 @@ import jogamp.opengl.Debug;
registered {@link GLEventListener}s. This shall be done after the {@link GLEventListener#init init(..)} calls.
- Another implementation detail is the drawable reconfiguration. One use case is where a window is being
- dragged to another screen with a different pixel configuration, ie {@link GLCapabilities}. The implementation
+ Another implementation detail is the drawable 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 javax.media.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 javax.media.opengl.awt.GLCanvas}'s
- and NEWT's AWTCanvas {@link javax.media.opengl.awt.GLCanvas#getGraphicsConfiguration getGraphicsConfiguration()}
- specialization. Another demonstration is NEWT's {@link javax.media.nativewindow.NativeWindow NativeWindow}
+ is capable to determine a display device change. This is demonstrated within {@link javax.media.opengl.awt.GLCanvas}'s
+ and NEWT's AWTCanvas {@link javax.media.opengl.awt.GLCanvas#getGraphicsConfiguration getGraphicsConfiguration()}
+ specialization. Another demonstration is NEWT's {@link javax.media.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
+ All OpenGL resources shall be regenerated, while the drawable's {@link GLCapabilities} has
to be choosen again. The following protocol shall be satisfied.
Controlled disposal:
@@ -95,21 +95,21 @@ import jogamp.opengl.Debug;
registered {@link GLEventListener}s. This shall be done after the {@link GLEventListener#init init(..)} calls.
- Note: Current graphics driver keep the surface configuration for a given window, even if the window is moved to
+ 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.
- However, to not introduce to much breakage with older applications and because of the situation
- mentioned above, the boolean system property jogl.screenchange.action will control the
+ However, to not introduce to much 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 drawable reconfiguration (the default)
-Djogl.screenchange.action=true Enable the drawable reconfiguration
-
+
*/
public interface GLAutoDrawable extends GLDrawable {
- /** Flag reflecting wheather the drawable reconfiguration will be issued in
+ /** Flag reflecting wheather the drawable reconfiguration will be issued in
* case a screen device change occured, 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);
@@ -130,10 +130,10 @@ public interface GLAutoDrawable extends GLDrawable {
The listeners are notified of events in the order of the queue. */
public void addGLEventListener(GLEventListener listener);
- /**
+ /**
* Adds a {@link GLEventListener} at the given index of this drawable queue.
* The listeners are notified of events in the order of the queue.
- * @param index Position where the listener will be inserted.
+ * @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
@@ -168,7 +168,7 @@ public interface GLAutoDrawable extends GLDrawable {
* @see #display()
* @see #invoke(boolean, GLRunnable)
* @see javax.media.opengl.GLAnimatorControl
- */
+ */
public abstract void setAnimator(GLAnimatorControl animatorControl) throws GLException;
/**
@@ -179,12 +179,12 @@ public interface GLAutoDrawable extends GLDrawable {
*/
public GLAnimatorControl getAnimator();
- /**
+ /**
*
* 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)}
+ * after all registered {@link GLEventListener}s
+ * {@link GLEventListener#display(GLAutoDrawable) display(GLAutoDrawable)}
* methods has been called.
*
*
@@ -201,7 +201,7 @@ public interface GLAutoDrawable extends GLDrawable {
* @see #setAnimator(GLAnimatorControl)
* @see #display()
* @see GLRunnable
- */
+ */
public void invoke(boolean wait, GLRunnable glRunnable);
/** Destroys all resources associated with this GLAutoDrawable,
@@ -214,7 +214,7 @@ public interface GLAutoDrawable extends GLDrawable {
routine may be called manually. */
public void destroy();
- /**
+ /**
*
* Causes OpenGL rendering to be performed for this GLAutoDrawable
* in the following order:
@@ -224,21 +224,21 @@ public interface GLAutoDrawable extends GLDrawable {
*
Executes all one-shot {@link javax.media.opengl.GLRunnable GLRunnable},
* enqueued via {@link #invoke(boolean, GLRunnable)}.
*
- *
+ *
* May be called periodically by a running {@link javax.media.opengl.GLAnimatorControl} implementation,
* which must register itself with {@link #setAnimator(javax.media.opengl.GLAnimatorControl)}.
*
* Called automatically by the window system toolkit upon receiving a repaint() request,
* except an {@link javax.media.opengl.GLAnimatorControl} implementation {@link javax.media.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,
+ * 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
+ * registered {@link GLEventListener}s before making the
* actual {@link GLEventListener#display display(..)} calls,
* in case this has not been done yet.
*
@@ -260,12 +260,12 @@ public interface GLAutoDrawable extends GLDrawable {
/**
* @param flags Additional context creation flags.
- *
+ *
* @see GLContext#setContextCreationFlags(int)
* @see GLContext#enableGLDebugMessage(boolean)
*/
public void setContextCreationFlags(int flags);
-
+
/**
* @return Additional context creation flags
*/
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawable.java b/src/jogl/classes/javax/media/opengl/GLDrawable.java
index 2b86a04ba..10eea2efc 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawable.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -104,11 +104,11 @@ public interface GLDrawable {
*
*
*
- * With an argument of true,
- * the minimum implementation shall call
+ * With an argument of true,
+ * the minimum implementation shall call
* {@link NativeSurface#lockSurface() NativeSurface's lockSurface()} and if successfull:
*
- *
Update the {@link GLCapabilities}, which are associated with
+ *
Update the {@link GLCapabilities}, which are associated with
* the attached {@link NativeSurface}'s {@link AbstractGraphicsConfiguration}.
*
Release the lock with {@link NativeSurface#unlockSurface() NativeSurface's unlockSurface()}.
*
@@ -146,7 +146,7 @@ public interface GLDrawable {
On some platforms, the pixel format is not directly associated
with the drawable; a best attempt is made to return a reasonable
value in this case.
- This object shall be directly associated to the attached {@link NativeSurface}'s
+ This object shall be directly associated to the attached {@link NativeSurface}'s
{@link AbstractGraphicsConfiguration}, and if changes are necessary,
they should reflect those as well.
@return A copy of the queried object.
@@ -159,14 +159,14 @@ public interface GLDrawable {
public GLProfile getGLProfile();
/**
- * Returns the underlying native surface which surface handle
+ * Returns the underlying native surface which surface handle
* represents this OpenGL drawable's native resource.
- *
+ *
* @see #getHandle()
*/
public NativeSurface getNativeSurface();
- /**
+ /**
* This is the GL/Windowing drawable handle.
* It is usually the {@link javax.media.nativewindow.NativeSurface#getSurfaceHandle()},
* ie the native surface handle of the underlying windowing toolkit.
@@ -175,7 +175,9 @@ public interface GLDrawable {
*/
public long getHandle();
+ /** Return the {@link GLDrawableFactory} being used to create this instance. */
public GLDrawableFactory getFactory();
+ @Override
public String toString();
}
diff --git a/src/jogl/classes/javax/media/opengl/GLPbuffer.java b/src/jogl/classes/javax/media/opengl/GLPbuffer.java
index 0250365b0..273a992cf 100644
--- a/src/jogl/classes/javax/media/opengl/GLPbuffer.java
+++ b/src/jogl/classes/javax/media/opengl/GLPbuffer.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,11 +28,11 @@
* 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.
*/
@@ -78,6 +78,7 @@ public interface GLPbuffer extends GLAutoDrawable {
pbuffer, the application must destroy any additional OpenGL
contexts which have been created for the pbuffer via {@link
#createContext}. */
+ @Override
public void destroy();
/** Indicates which vendor's extension is being used to support
diff --git a/src/jogl/classes/javax/media/opengl/awt/AWTGLAutoDrawable.java b/src/jogl/classes/javax/media/opengl/awt/AWTGLAutoDrawable.java
index d1e725b00..2698678af 100644
--- a/src/jogl/classes/javax/media/opengl/awt/AWTGLAutoDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/awt/AWTGLAutoDrawable.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -28,18 +28,18 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
package javax.media.opengl.awt;
-import javax.media.opengl.*;
+import javax.media.opengl.GLAutoDrawable;
public interface AWTGLAutoDrawable extends GLAutoDrawable, ComponentEvents {
/** Requests a new width and height for this AWTGLAutoDrawable. */
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index 0a75865e2..604dea057 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -139,22 +139,23 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
private static final boolean DEBUG = Debug.debug("GLCanvas");
- private GLDrawableHelper drawableHelper = new GLDrawableHelper();
+ private final GLDrawableHelper drawableHelper = new GLDrawableHelper();
private AWTGraphicsConfiguration awtConfig;
private volatile GLDrawable drawable;
private GLContextImpl context;
private boolean sendReshape = false;
-
+
// copy of the cstr args, mainly for recreation
private GLCapabilitiesImmutable capsReqUser;
private GLCapabilitiesChooser chooser;
private GLContext shareWith;
- private int additionalCtxCreationFlags = 0;
+ private int additionalCtxCreationFlags = 0;
private GraphicsDevice device;
private boolean shallUseOffscreenLayer = false;
private AWTWindowClosingProtocol awtWindowClosingProtocol =
new AWTWindowClosingProtocol(this, new Runnable() {
+ @Override
public void run() {
GLCanvas.this.destroy();
}
@@ -162,7 +163,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
/** Creates a new GLCanvas component with a default set of OpenGL
capabilities, using the default OpenGL capabilities selection
- mechanism, on the default screen device.
+ mechanism, on the default screen device.
* @throws GLException if no default profile is available for the default desktop device.
*/
public GLCanvas() throws GLException {
@@ -171,7 +172,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
/** Creates a new GLCanvas component with the requested set of
OpenGL capabilities, using the default OpenGL capabilities
- selection mechanism, on the default screen device.
+ selection mechanism, on the default screen device.
* @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
* @see GLCanvas#GLCanvas(javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, javax.media.opengl.GLContext, java.awt.GraphicsDevice)
*/
@@ -187,8 +188,8 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
* @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
* @see GLCanvas#GLCanvas(javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, javax.media.opengl.GLContext, java.awt.GraphicsDevice)
*/
- public GLCanvas(GLCapabilitiesImmutable capsReqUser, GLContext shareWith)
- throws GLException
+ public GLCanvas(GLCapabilitiesImmutable capsReqUser, GLContext shareWith)
+ throws GLException
{
this(capsReqUser, null, shareWith, null);
}
@@ -207,14 +208,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
sharing. The passed GraphicsDevice indicates the screen on
which to create the GLCanvas; the GLDrawableFactory uses the
default screen device of the local GraphicsEnvironment if null
- is passed for this argument.
+ is passed for this argument.
* @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
*/
public GLCanvas(GLCapabilitiesImmutable capsReqUser,
GLCapabilitiesChooser chooser,
GLContext shareWith,
- GraphicsDevice device)
- throws GLException
+ GraphicsDevice device)
+ throws GLException
{
/*
* Determination of the native window is made in 'super.addNotify()',
@@ -246,14 +247,17 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
this.device = device;
}
+ @Override
public void setShallUseOffscreenLayer(boolean v) {
shallUseOffscreenLayer = v;
}
+ @Override
public final boolean getShallUseOffscreenLayer() {
- return shallUseOffscreenLayer;
+ return shallUseOffscreenLayer;
}
+ @Override
public final boolean isOffscreenLayerSurfaceEnabled() {
if(null != drawable) {
return ((JAWTWindow)drawable.getNativeSurface()).isOffscreenLayerSurfaceEnabled();
@@ -261,18 +265,18 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
return false;
}
-
+
/**
* Overridden to choose a GraphicsConfiguration on a parent container's
* GraphicsDevice because both devices
*/
- @Override
+ @Override
public GraphicsConfiguration getGraphicsConfiguration() {
/*
* Workaround for problems with Xinerama and java.awt.Component.checkGD
* when adding to a container on a different graphics device than the
* one that this Canvas is associated with.
- *
+ *
* GC will be null unless:
* - A native peer has assigned it. This means we have a native
* peer, and are already comitted to a graphics configuration.
@@ -286,7 +290,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
* chosen is only non-null on platforms where the GLDrawableFactory
* returns a non-null GraphicsConfiguration (in the GLCanvas
* constructor).
- *
+ *
* if gc is from this Canvas' native peer then it should equal chosen,
* otherwise it is from an ancestor component that this Canvas is being
* added to, and we go into this block.
@@ -298,21 +302,21 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
* Check for compatibility with gc. If they differ by only the
* device then return a new GCconfig with the super-class' GDevice
* (and presumably the same visual ID in Xinerama).
- *
+ *
*/
if (!chosen.getDevice().getIDstring().equals(gc.getDevice().getIDstring())) {
/*
* Here we select a GraphicsConfiguration on the alternate
* device that is presumably identical to the chosen
* configuration, but on the other device.
- *
+ *
* Should really check to ensure that we select a configuration
* with the same X visual ID for Xinerama screens, otherwise the
* GLDrawable may have the wrong visual ID (I don't think this
* ever gets updated). May need to add a method to
* X11GLDrawableFactory to do this in a platform specific
* manner.
- *
+ *
* However, on platforms where we can actually get into this
* block, both devices should have the same visual list, and the
* same configuration should be selected here.
@@ -353,7 +357,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
* return the GC that was selected in the constructor (and might
* cause an exception in Component.checkGD when adding to a
* container, but in this case that would be the desired behavior).
- *
+ *
*/
return chosen;
} else if (gc == null) {
@@ -372,14 +376,17 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
*/
return gc;
}
-
+
+ @Override
public GLContext createContext(GLContext shareWith) {
return (null != drawable) ? drawable.createContext(shareWith) : null;
}
+ @Override
public void setRealized(boolean realized) {
}
+ @Override
public boolean isRealized() {
return ( null != drawable ) ? drawable.isRealized() : false;
}
@@ -387,14 +394,17 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
return ( null != drawable ) ? drawable.isRealized() : false;
}
+ @Override
public WindowClosingMode getDefaultCloseOperation() {
return awtWindowClosingProtocol.getDefaultCloseOperation();
}
+ @Override
public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) {
return awtWindowClosingProtocol.setDefaultCloseOperation(op);
}
+ @Override
public void display() {
if( !validateGLDrawable() ) {
if(DEBUG) {
@@ -402,7 +412,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
return; // not yet available ..
}
- Threading.invoke(true, displayOnEventDispatchThreadAction, getTreeLock());
+ Threading.invoke(true, displayOnEDTAction, getTreeLock());
awtWindowClosingProtocol.addClosingListenerOneShot();
}
@@ -425,14 +435,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
disposeRegenerate=regenerate;
if(context.isCreated()) {
- Threading.invoke(true, disposeOnEventDispatchThreadAction, getTreeLock());
+ Threading.invoke(true, disposeOnEDTAction, getTreeLock());
}
if(animatorPaused) {
animator.resume();
}
}
-
+
if(!regenerate) {
disposeAbstractGraphicsDevice();
}
@@ -443,8 +453,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
/**
- * Just an alias for removeNotify
+ * {@inheritDoc}
+ *
+ *
+ * This impl. calls this class's {@link #removeNotify()} AWT override,
+ * where the actual implementation resides.
+ *
*/
+ @Override
public void destroy() {
removeNotify();
}
@@ -546,7 +562,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
jawtWindow.unlockSurface();
}
}
-
+
private boolean validateGLDrawable() {
boolean realized = false;
if (!Beans.isDesignTime()) {
@@ -554,7 +570,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
realized = drawable.isRealized();
if ( !realized && 0 < drawable.getWidth() * drawable.getHeight() ) {
// make sure drawable realization happens on AWT EDT, due to AWTTree lock
- AWTEDTExecutor.singleton.invoke(true, setRealizedOnEventDispatchThreadAction);
+ AWTEDTExecutor.singleton.invoke(true, setRealizedOnEDTAction);
realized = true;
sendReshape=true; // ensure a reshape is being send ..
if(DEBUG) {
@@ -566,8 +582,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
return realized;
}
- private Runnable setRealizedOnEventDispatchThreadAction = new Runnable() {
- public void run() {
+ private Runnable setRealizedOnEDTAction = new Runnable() {
+ @Override
+ public void run() {
drawable.setRealized(true);
} };
@@ -626,7 +643,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
/** Overrides:
update in class java.awt.Component
*/
- /**
+ /**
* Overridden from Canvas to prevent the AWT's clearing of the
* canvas from interfering with the OpenGL rendering.
*/
@@ -634,31 +651,38 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
public void update(Graphics g) {
paint(g);
}
-
+
+ @Override
public void addGLEventListener(GLEventListener listener) {
drawableHelper.addGLEventListener(listener);
}
+ @Override
public void addGLEventListener(int index, GLEventListener listener) {
drawableHelper.addGLEventListener(index, listener);
}
+ @Override
public void removeGLEventListener(GLEventListener listener) {
drawableHelper.removeGLEventListener(listener);
}
+ @Override
public void setAnimator(GLAnimatorControl animatorControl) {
drawableHelper.setAnimator(animatorControl);
}
+ @Override
public GLAnimatorControl getAnimator() {
return drawableHelper.getAnimator();
}
+ @Override
public void invoke(boolean wait, GLRunnable glRunnable) {
drawableHelper.invoke(this, wait, glRunnable);
}
+ @Override
public void setContext(GLContext ctx) {
context=(GLContextImpl)ctx;
if(null != context) {
@@ -666,10 +690,12 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
}
+ @Override
public GLContext getContext() {
return context;
}
+ @Override
public GL getGL() {
if (Beans.isDesignTime()) {
return null;
@@ -678,6 +704,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
return (ctx == null) ? null : ctx.getGL();
}
+ @Override
public GL setGL(GL gl) {
GLContext ctx = getContext();
if (ctx != null) {
@@ -688,30 +715,37 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
+ @Override
public void setAutoSwapBufferMode(boolean onOrOff) {
drawableHelper.setAutoSwapBufferMode(onOrOff);
}
+ @Override
public boolean getAutoSwapBufferMode() {
return drawableHelper.getAutoSwapBufferMode();
}
+ @Override
public void swapBuffers() {
- Threading.invoke(true, swapBuffersOnEventDispatchThreadAction, getTreeLock());
+ Threading.invoke(true, swapBuffersOnEDTAction, getTreeLock());
}
+ @Override
public void setContextCreationFlags(int flags) {
additionalCtxCreationFlags = flags;
}
-
+
+ @Override
public int getContextCreationFlags() {
- return additionalCtxCreationFlags;
+ return additionalCtxCreationFlags;
}
-
+
+ @Override
public GLProfile getGLProfile() {
return capsReqUser.getGLProfile();
}
+ @Override
public GLCapabilitiesImmutable getChosenGLCapabilities() {
if (awtConfig == null) {
throw new GLException("No AWTGraphicsConfiguration: "+this);
@@ -728,14 +762,17 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
return (GLCapabilitiesImmutable)awtConfig.getRequestedCapabilities();
}
+ @Override
public NativeSurface getNativeSurface() {
return (null != drawable) ? drawable.getNativeSurface() : null;
}
+ @Override
public long getHandle() {
return (null != drawable) ? drawable.getHandle() : 0;
}
+ @Override
public GLDrawableFactory getFactory() {
return (null != drawable) ? drawable.getFactory() : null;
}
@@ -744,9 +781,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
public String toString() {
final int dw = (null!=drawable) ? drawable.getWidth() : -1;
final int dh = (null!=drawable) ? drawable.getHeight() : -1;
-
+
return "AWT-GLCanvas[Realized "+isRealized()+
- ",\n\t"+((null!=drawable)?drawable.getClass().getName():"null-drawable")+
+ ",\n\t"+((null!=drawable)?drawable.getClass().getName():"null-drawable")+
",\n\tFactory "+getFactory()+
",\n\thandle 0x"+Long.toHexString(getHandle())+
",\n\tDrawable size "+dw+"x"+dh+
@@ -754,13 +791,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
",\n\tvisible "+isVisible()+
",\n\t"+awtConfig+"]";
}
-
+
//----------------------------------------------------------------------
// Internals only below this point
//
private boolean disposeRegenerate;
private final Runnable postDisposeAction = new Runnable() {
+ @Override
public void run() {
context=null;
if(null!=drawable) {
@@ -769,39 +807,41 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
drawable=null;
if(null!=jawtWindow) {
jawtWindow.destroy();
- }
+ }
}
-
+
if(disposeRegenerate) {
// Similar process as in addNotify()!
-
+
// Recreate GLDrawable/GLContext to reflect it's new graphics configuration
createDrawableAndContext();
-
+
if(DEBUG) {
System.err.println(getThreadName()+": GLCanvas.dispose(true): new drawable: "+drawable);
}
validateGLDrawable(); // immediate attempt to recreate the drawable
}
}
- };
+ };
- private final Runnable disposeOnEventDispatchThreadAction = new Runnable() {
+ private final Runnable disposeOnEDTAction = new Runnable() {
+ @Override
public void run() {
- drawableHelper.disposeGL(GLCanvas.this, drawable, context, postDisposeAction);
+ drawableHelper.disposeGL(GLCanvas.this, drawable, context, postDisposeAction);
}
};
private final Runnable disposeAbstractGraphicsDeviceAction = new Runnable() {
+ @Override
public void run() {
if(null != awtConfig) {
- final AbstractGraphicsConfiguration aconfig = awtConfig.getNativeGraphicsConfiguration();
+ final AbstractGraphicsConfiguration aconfig = awtConfig.getNativeGraphicsConfiguration();
final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
final String adeviceMsg;
if(DEBUG) {
adeviceMsg = adevice.toString();
} else {
- adeviceMsg = null;
+ adeviceMsg = null;
}
boolean closed = adevice.close();
if(DEBUG) {
@@ -833,12 +873,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
private final Runnable initAction = new Runnable() {
+ @Override
public void run() {
drawableHelper.init(GLCanvas.this);
}
};
-
+
private final Runnable displayAction = new Runnable() {
+ @Override
public void run() {
if (sendReshape) {
if(DEBUG) {
@@ -855,6 +897,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
};
private final Runnable swapBuffersAction = new Runnable() {
+ @Override
public void run() {
drawable.swapBuffers();
}
@@ -863,16 +906,18 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
// Workaround for ATI driver bugs related to multithreading issues
// like simultaneous rendering via Animators to canvases that are
// being resized on the AWT event dispatch thread
- private final Runnable displayOnEventDispatchThreadAction = new Runnable() {
+ private final Runnable displayOnEDTAction = new Runnable() {
+ @Override
public void run() {
drawableHelper.invokeGL(drawable, context, displayAction, initAction);
}
};
-
- private final Runnable swapBuffersOnEventDispatchThreadAction = new Runnable() {
+
+ private final Runnable swapBuffersOnEDTAction = new Runnable() {
+ @Override
public void run() {
drawableHelper.invokeGL(drawable, context, swapBuffersAction, initAction);
- }
+ }
};
// Disables the AWT's erasing of this Canvas's background on Windows
@@ -886,6 +931,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
if (!disableBackgroundEraseInitialized) {
try {
AccessController.doPrivileged(new PrivilegedAction