summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLContext.java19
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLUniformData.java1
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java1
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLContext.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLProfileDeviceNEWT.java221
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java4
10 files changed, 249 insertions, 11 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/GLContext.java b/src/jogl/classes/com/jogamp/opengl/GLContext.java
index 258363e2e..45cc1c509 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLContext.java
@@ -1265,7 +1265,14 @@ public abstract class GLContext {
* @throws GLException if the context is not current.
* @see #getSwapInterval()
*/
- public abstract boolean setSwapInterval(final int interval) throws GLException;
+ public /* abstract */ boolean setSwapInterval(final int interval) throws GLException {
+ // FIXME: Make abstract for next version - just here to *not* break SEMVER!
+ throw new InternalError("Implemented in GLContextImpl");
+ }
+ protected boolean setSwapIntervalImpl(final int interval) {
+ // FIXME: Remove for next version - just here to *not* break SEMVER!
+ throw new InternalError("Implemented in GLContextImpl");
+ }
/**
* Return the current swap interval.
@@ -1279,7 +1286,15 @@ public abstract class GLContext {
* </p>
* @see #setSwapInterval(int)
*/
- public abstract int getSwapInterval();
+ public /* abstract */ int getSwapInterval() {
+ // FIXME: Make abstract for next version - just here to *not* break SEMVER!
+ throw new InternalError("Implemented in GLContextImpl");
+ }
+
+ protected void setDefaultSwapInterval() {
+ // FIXME: Remove for next version - just here to *not* break SEMVER!
+ throw new InternalError("Implemented in GLContextImpl");
+ }
public final boolean queryMaxSwapGroups(final int[] maxGroups, final int maxGroups_offset,
final int[] maxBarriers, final int maxBarriers_offset) {
diff --git a/src/jogl/classes/com/jogamp/opengl/GLUniformData.java b/src/jogl/classes/com/jogamp/opengl/GLUniformData.java
index 44f7f29c7..55a2e0cf1 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLUniformData.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLUniformData.java
@@ -84,6 +84,7 @@ public class GLUniformData {
public IntBuffer intBufferValue() { return (IntBuffer)data; };
public FloatBuffer floatBufferValue() { return (FloatBuffer)data; };
+ @SuppressWarnings("deprecation")
public StringBuilder toString(StringBuilder sb) {
if(null == sb) {
sb = new StringBuilder();
diff --git a/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java b/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
index b24339569..7f630f9d5 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
@@ -1959,6 +1959,7 @@ public final class FloatUtil {
* @param columns
* @param rowMajorOrder if true floats are layed out in row-major-order, otherwise column-major-order (OpenGL)
* @return matrix string representation
+ * @deprecated use on of the float[] variants
*/
public static StringBuilder matrixToString(StringBuilder sb, final String rowPrefix, final String f,
final FloatBuffer a, final int aOffset, final int rows, final int columns, final boolean rowMajorOrder) {
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index fff6d58e0..8c235a747 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -2616,7 +2616,7 @@ public abstract class GLContextImpl extends GLContext {
( !drawableRetargeted || !hasRendererQuirk(GLRendererQuirks.NoSetSwapIntervalPostRetarget) )
)
{
- final Integer usedInterval = setSwapIntervalImpl(interval);
+ final Integer usedInterval = setSwapIntervalImpl2(interval);
if( null != usedInterval ) {
currentSwapInterval = usedInterval.intValue();
return true;
@@ -2624,11 +2624,13 @@ public abstract class GLContextImpl extends GLContext {
}
return false;
}
- protected abstract Integer setSwapIntervalImpl(final int interval);
+ protected abstract Integer setSwapIntervalImpl2(final int interval);
+ @Override
public final int getSwapInterval() {
return currentSwapInterval;
}
+ @Override
protected final void setDefaultSwapInterval() {
currentSwapInterval = 0;
setSwapIntervalNC(1);
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
index 8c86f5199..f0040f989 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
@@ -433,7 +433,7 @@ public class EGLContext extends GLContextImpl {
}
@Override
- protected final Integer setSwapIntervalImpl(final int interval) {
+ protected final Integer setSwapIntervalImpl2(final int interval) {
if( hasRendererQuirk(GLRendererQuirks.NoSetSwapInterval) ) {
return null;
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index 10a11dd36..6a042b615 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -424,7 +424,7 @@ public class MacOSXCGLContext extends GLContextImpl
}
@Override
- protected final Integer setSwapIntervalImpl(final int interval) {
+ protected final Integer setSwapIntervalImpl2(final int interval) {
final int useInterval;
if( 0 > interval ) {
useInterval = Math.abs(interval);
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
index 3cf9917e3..3d397b893 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
@@ -511,7 +511,7 @@ public class WindowsWGLContext extends GLContextImpl {
}
@Override
- protected final Integer setSwapIntervalImpl(final int interval) {
+ protected final Integer setSwapIntervalImpl2(final int interval) {
if( 0 == hasSwapInterval ) {
try {
if ( isExtensionAvailable(GLXExtensions.WGL_EXT_swap_control) ) {
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
index e4418b431..79768d662 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
@@ -570,7 +570,7 @@ public class X11GLXContext extends GLContextImpl {
}
@Override
- protected final Integer setSwapIntervalImpl(final int interval) {
+ protected final Integer setSwapIntervalImpl2(final int interval) {
final long displayHandle = drawable.getNativeSurface().getDisplayHandle();
if( 0 == hasSwapInterval ) {
try {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLProfileDeviceNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLProfileDeviceNEWT.java
new file mode 100644
index 000000000..5f19e2b44
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLProfileDeviceNEWT.java
@@ -0,0 +1,221 @@
+/**
+ * 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.acore;
+
+import java.io.IOException;
+
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLOffscreenAutoDrawable;
+import com.jogamp.opengl.GLProfile;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.opengl.JoglVersion;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.GLEventListenerCounter;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+/**
+ * Testing producing {@link GLContext} instances of different {@link GLProfile}s
+ * using different {@link AbstractGraphicsDevice}s.
+ */
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestGLAutoDrawableFactoryGLProfileDeviceNEWT extends UITestCase {
+ static final int widthStep = 800/4;
+ static final int heightStep = 600/4;
+ volatile int szStep = 2;
+
+ static GLProfile getProfile(final AbstractGraphicsDevice device, final String profile) {
+ if( !GLProfile.isAvailable(device, profile) ) {
+ System.err.println("Profile "+profile+" n/a");
+ return null;
+ } else {
+ return GLProfile.get(device, profile);
+ }
+ }
+
+ void doTest(final boolean isEGL, final GLDrawableFactory factory, final GLCapabilitiesImmutable reqGLCaps, final GLEventListener demo) throws InterruptedException {
+ System.err.println("Factory: "+factory.getClass().getName());
+ System.err.println("Requested GL Caps: "+reqGLCaps);
+
+ //
+ // Create native OpenGL resources .. XGL/WGL/CGL ..
+ // equivalent to GLAutoDrawable methods: setVisible(true)
+ //
+ final GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(null, reqGLCaps, null, widthStep*szStep, heightStep*szStep);
+
+ Assert.assertNotNull(glad);
+ Assert.assertTrue(glad.isRealized());
+
+ // Check caps of NativeWindow config w/o GL
+ final CapabilitiesImmutable chosenCaps = glad.getChosenGLCapabilities();
+ Assert.assertNotNull(chosenCaps);
+
+ glad.display(); // force native context creation
+
+ // Check caps of GLDrawable after realization
+ final GLCapabilitiesImmutable chosenGLCaps = glad.getChosenGLCapabilities();
+ Assert.assertNotNull(chosenGLCaps);
+ System.err.println("Choosen GL Caps: "+chosenGLCaps);
+
+ glad.addGLEventListener(demo);
+ final GLEventListenerCounter glelc = new GLEventListenerCounter();
+ glad.addGLEventListener(glelc);
+
+ glad.display(); // initial resize/display
+
+ // 1 - szStep = 2
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(),
+ AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
+ glad.display();
+
+ // 2, 3 (resize + display)
+ szStep = 1;
+ glad.setSurfaceSize(widthStep*szStep, heightStep*szStep);
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(),
+ AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
+ glad.display();
+
+ Thread.sleep(50);
+
+ final AbstractGraphicsDevice adevice = glad.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice();
+ glad.destroy();
+ System.err.println("Fin isEGL "+isEGL+", "+adevice);
+ System.err.println("Fin "+glelc);
+ Assert.assertTrue("init count: "+glelc, glelc.initCount > 0);
+ Assert.assertTrue("reshape count: "+glelc, glelc.reshapeCount > 0);
+ Assert.assertTrue("display count: "+glelc, glelc.displayCount > 0);
+ Assert.assertTrue("dispose count: "+glelc, glelc.disposeCount > 0);
+ Assert.assertEquals("EGL/Desktop not matching: isEGL "+isEGL+", "+adevice, isEGL, adevice instanceof EGLGraphicsDevice);
+ }
+
+ @Test
+ public void test00AvailableInfo() {
+ GLDrawableFactory f = GLDrawableFactory.getDesktopFactory();
+ if(null != f) {
+ System.err.println(JoglVersion.getDefaultOpenGLInfo(f.getDefaultDevice(), null, true).toString());
+ }
+ f = GLDrawableFactory.getEGLFactory();
+ if(null != f) {
+ System.err.println(JoglVersion.getDefaultOpenGLInfo(f.getDefaultDevice(), null, true).toString());
+ }
+ }
+
+ @Test
+ public void test01ES2OnEGL() throws InterruptedException {
+ final GLDrawableFactory factory = GLDrawableFactory.getEGLFactory();
+ final GLProfile glp = getProfile(factory.getDefaultDevice(), GLProfile.GLES2);
+ if(null != glp) {
+ Assert.assertTrue("Not a GLES2 profile but "+glp, glp.isGLES2());
+ Assert.assertTrue("Not a GL2ES2 profile but "+glp, glp.isGL2ES2());
+ }
+ if(null == glp) {
+ return;
+ }
+ final GLCapabilities reqGLCaps = new GLCapabilities(glp);
+ reqGLCaps.setOnscreen(false);
+ final GearsES2 demo = new GearsES2(1);
+ demo.setVerbose(false);
+ doTest(true /* isEGL */, factory, reqGLCaps, demo);
+ }
+
+ @Test
+ public void test02GLOnEGL() throws InterruptedException {
+ final GLDrawableFactory factory = GLDrawableFactory.getEGLFactory();
+ final GLProfile glp = getProfile(factory.getDefaultDevice(), GLProfile.GL2GL3);
+ if(null != glp) {
+ Assert.assertTrue("Not a GL2GL3 profile but "+glp, glp.isGL2GL3());
+ }
+ if(null == glp || !glp.isGL2ES2()) {
+ if( null != glp ) {
+ System.err.println("Not a GL2ES2 profile but "+glp);
+ }
+ return;
+ }
+ final GLCapabilities reqGLCaps = new GLCapabilities(glp);
+ reqGLCaps.setOnscreen(false);
+ final GearsES2 demo = new GearsES2(1);
+ demo.setVerbose(false);
+ doTest(true /* isEGL */, factory, reqGLCaps, demo);
+ }
+
+ @Test
+ public void test11ES2OnGL() throws InterruptedException {
+ final GLDrawableFactory factory = GLDrawableFactory.getDesktopFactory();
+ final GLProfile glp = getProfile(factory.getDefaultDevice(), GLProfile.GLES2);
+ if(null != glp) {
+ Assert.assertTrue("Not a GLES2 profile but "+glp, glp.isGLES2());
+ Assert.assertTrue("Not a GL2ES2 profile but "+glp, glp.isGL2ES2());
+ }
+ if(null == glp) {
+ return;
+ }
+ final GLCapabilities reqGLCaps = new GLCapabilities(glp);
+ reqGLCaps.setOnscreen(false);
+ final GearsES2 demo = new GearsES2(1);
+ demo.setVerbose(false);
+ doTest(false /* isEGL */, factory, reqGLCaps, demo);
+ }
+
+ @Test
+ public void test12GLOnGL() throws InterruptedException {
+ final GLDrawableFactory factory = GLDrawableFactory.getDesktopFactory();
+ final GLProfile glp = getProfile(factory.getDefaultDevice(), GLProfile.GL2GL3);
+ if(null != glp) {
+ Assert.assertTrue("Not a GL2GL3 profile but "+glp, glp.isGL2GL3());
+ }
+ if(null == glp || !glp.isGL2ES2()) {
+ if( null != glp ) {
+ System.err.println("Not a GL2ES2 profile but "+glp);
+ }
+ return;
+ }
+ final GLCapabilities reqGLCaps = new GLCapabilities(glp);
+ reqGLCaps.setOnscreen(false);
+ final GearsES2 demo = new GearsES2(1);
+ demo.setVerbose(false);
+ doTest(false /* isEGL */, factory, reqGLCaps, demo);
+ }
+
+ public static void main(final String args[]) throws IOException {
+ org.junit.runner.JUnitCore.main(TestGLAutoDrawableFactoryGLProfileDeviceNEWT.class.getName());
+ }
+
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java
index 1e65b15bc..04413315a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java
@@ -47,7 +47,6 @@ import org.junit.Test;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
-import com.jogamp.common.os.Platform;
import com.jogamp.opengl.math.FloatUtil;
import com.jogamp.opengl.math.geom.Frustum;
import com.jogamp.opengl.test.junit.util.MiscUtils;
@@ -102,6 +101,7 @@ public class TestPMVMatrix01NEWT extends UITestCase {
0.0f, 0.0f, 0.0f, 1.0f } );
@Test
+ @SuppressWarnings("deprecation")
public void test00MatrixToString() {
final String s4x4Cpmv = PMVMatrix.matrixToString(null, "%10.5f", translated123C).toString();
final String s4x4Cflu = FloatUtil.matrixToString(null, null, "%10.5f", translated123C, 0, 4, 4, false).toString();
@@ -328,7 +328,6 @@ public class TestPMVMatrix01NEWT extends UITestCase {
// System.err.println("P2: "+pmv.toString());
}
- @SuppressWarnings("unused")
@Test
public void test03MvTranslate() {
final FloatBuffer pmvMv;
@@ -367,7 +366,6 @@ public class TestPMVMatrix01NEWT extends UITestCase {
// System.err.println("pmvMvit: "+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMvit));
}
- @SuppressWarnings("unused")
@Test
public void test04MvTranslateRotate() {
final FloatBuffer pmvMv;