aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/javax/media/opengl/GLProfile.java32
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMapBufferRead01NEWT.java (renamed from src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMapBuffer01NEWT.java)20
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestFBOMRTNEWT01.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/texture/TestGrayTextureFromFileAWTBug417.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/texture/TestTexture01AWT.java6
5 files changed, 58 insertions, 8 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index d573fd3b1..1e7346116 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -666,6 +666,7 @@ public class GLProfile {
* <p>Selection favors hardware rasterizer.</p>
*
* @throws GLException if no GL2ES1 compatible profile is available for the default device.
+ * @see #isGL2ES1()
* @see #get(AbstractGraphicsDevice, String)
* @see #getImpl()
*/
@@ -695,6 +696,7 @@ public class GLProfile {
* <p>Selection favors hardware rasterizer.</p>
*
* @throws GLException if no GL2ES2 compatible profile is available for the default device.
+ * @see #isGL2ES2()
* @see #get(AbstractGraphicsDevice, String)
* @see #getImpl()
*/
@@ -715,6 +717,36 @@ public class GLProfile {
return get(defaultDevice, GL2ES2).getImpl();
}
+ /**
+ * Returns the GL2GL3 profile implementation, hence compatible w/ GL2GL3.<br/>
+ * It returns:
+ * <pre>
+ * GLProfile.get(device, GLProfile.GL2GL3).getImpl());
+ * </pre>
+ * <p>Selection favors hardware rasterizer.</p>
+ *
+ * @throws GLException if no GL2GL3 compatible profile is available for the default device.
+ * @see #isGL2GL3()
+ * @see #get(AbstractGraphicsDevice, String)
+ * @see #getImpl()
+ */
+ public static GLProfile getGL2GL3(AbstractGraphicsDevice device)
+ throws GLException
+ {
+ return get(device, GL2GL3).getImpl();
+ }
+
+ /**
+ * Calls {@link #getGL2GL3(AbstractGraphicsDevice)} using the default device.
+ * <p>Selection favors hardware rasterizer.</p>
+ * @see #getGL2GL3(AbstractGraphicsDevice)
+ */
+ public static GLProfile getGL2GL3()
+ throws GLException
+ {
+ return get(defaultDevice, GL2GL3).getImpl();
+ }
+
/** Returns a GLProfile object.
* verifies the given profile and chooses an appropriate implementation.
* A generic value of <code>null</code> or <code>GL</code> will result in
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMapBuffer01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMapBufferRead01NEWT.java
index bad04addc..d264d4251 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMapBuffer01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMapBufferRead01NEWT.java
@@ -46,23 +46,31 @@ import org.junit.Test;
*
* @author Luz, et.al.
*/
-public class TestMapBuffer01NEWT extends UITestCase {
+public class TestMapBufferRead01NEWT extends UITestCase {
static final boolean DEBUG = false;
@Test
public void testWriteRead01a() throws InterruptedException {
+ if(!GLProfile.isAvailable(GLProfile.GL2GL3)) {
+ System.err.println("Test requires GL2/GL3 profile.");
+ return;
+ }
ByteBuffer verticiesBB = ByteBuffer.allocate(4*9);
verticiesBB.order(ByteOrder.nativeOrder());
testWriteRead01(verticiesBB);
}
@Test
public void testWriteRead01b() throws InterruptedException {
+ if(!GLProfile.isAvailable(GLProfile.GL2GL3)) {
+ System.err.println("Test requires GL2/GL3 profile.");
+ return;
+ }
ByteBuffer verticiesBB = Buffers.newDirectByteBuffer(4*9);
testWriteRead01(verticiesBB);
}
private void testWriteRead01(ByteBuffer verticiesBB) throws InterruptedException {
- final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOffscreenWindow(GLProfile.getDefault(), 800, 600, true);
+ final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOffscreenWindow(GLProfile.getGL2GL3(), 800, 600, true);
final GL gl = winctx.context.getGL();
int[] vertexBuffer = new int[1];
@@ -89,11 +97,12 @@ public class TestMapBuffer01NEWT extends UITestCase {
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vertexBuffer[0]);
- // gl.glBufferData(GL3.GL_ARRAY_BUFFER, verticiesBB.capacity(), verticiesBB, GL3.GL_STATIC_READ);
+ // gl.glBufferData(GL.GL_ARRAY_BUFFER, verticiesBB.capacity(), verticiesBB, GL.GL_STATIC_READ);
gl.glBufferData(GL.GL_ARRAY_BUFFER, verticiesBB.capacity(), verticiesBB, GL.GL_STATIC_DRAW);
ByteBuffer bb = gl.glMapBuffer(GL.GL_ARRAY_BUFFER, GL2GL3.GL_READ_ONLY);
- // gl.glUnmapBuffer(GL3.GL_ARRAY_BUFFER);
+ Assert.assertNotNull(bb);
+
if(DEBUG) {
for(int i=0; i < bb.capacity(); i+=4) {
System.out.println("gpu "+i+": "+bb.getFloat(i));
@@ -102,10 +111,11 @@ public class TestMapBuffer01NEWT extends UITestCase {
for(int i=0; i < bb.capacity(); i+=4) {
Assert.assertEquals(verticiesBB.getFloat(i), bb.getFloat(i), 0.0);
}
+ gl.glUnmapBuffer(GL.GL_ARRAY_BUFFER);
NEWTGLContext.destroyWindow(winctx);
}
public static void main(String args[]) throws IOException {
- String tstname = TestMapBuffer01NEWT.class.getName();
+ String tstname = TestMapBufferRead01NEWT.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestFBOMRTNEWT01.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestFBOMRTNEWT01.java
index 50c398300..7227b0215 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestFBOMRTNEWT01.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestFBOMRTNEWT01.java
@@ -61,7 +61,7 @@ public class TestFBOMRTNEWT01 extends UITestCase {
System.err.println("Test requires GL2/GL3 profile.");
return;
}
- final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.get(GLProfile.GL2GL3), 640, 480, true);
+ final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.getGL2GL3(), 640, 480, true);
final GLDrawable drawable = winctx.context.getGLDrawable();
GL2GL3 gl = winctx.context.getGL().getGL2GL3();
gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) ).getGL2GL3();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/texture/TestGrayTextureFromFileAWTBug417.java b/src/test/com/jogamp/opengl/test/junit/jogl/texture/TestGrayTextureFromFileAWTBug417.java
index 8f38ac604..d43a3a0c5 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/texture/TestGrayTextureFromFileAWTBug417.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/texture/TestGrayTextureFromFileAWTBug417.java
@@ -65,7 +65,11 @@ public class TestGrayTextureFromFileAWTBug417 extends UITestCase {
@BeforeClass
public static void initClass() {
- glp = GLProfile.get(GLProfile.GL2GL3);
+ if(!GLProfile.isAvailable(GLProfile.GL2GL3)) {
+ UITestCase.setTestSupported(false);
+ return;
+ }
+ glp = GLProfile.getGL2GL3();
Assert.assertNotNull(glp);
caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/texture/TestTexture01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/texture/TestTexture01AWT.java
index 49057643e..217b8aca3 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/texture/TestTexture01AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/texture/TestTexture01AWT.java
@@ -61,7 +61,11 @@ public class TestTexture01AWT extends UITestCase {
@BeforeClass
public static void initClass() {
- glp = GLProfile.get(GLProfile.GL2GL3);
+ if(!GLProfile.isAvailable(GLProfile.GL2GL3)) {
+ UITestCase.setTestSupported(false);
+ return;
+ }
+ glp = GLProfile.getGL2GL3();
Assert.assertNotNull(glp);
caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);