summaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-05-26 19:18:43 +0200
committerSven Gothel <[email protected]>2014-05-26 19:18:43 +0200
commitfc1e98790a02b4fa7922f3cdd9d437f87d7c99e5 (patch)
treec45b50fcb963b44013887214b6adbd83e2d2ba48 /src/test/com/jogamp/opengl
parent93bbc064a1a4cf80079f28e48a5deb50de4a9e66 (diff)
Bug 1010 - Fix ES3.glPixelStorei and revalidate GLPixelStorageModes
Remove GLES3Impl.glPixelStorei pname validation which was true for ES2 impl, but is no more valid for ES3, which accepts more values than GL_PACK_ALIGNMENT & GL_UNPACK_ALIGNMENT. Revalidate GLPixelStorageModes: - Properly support ES3 PixelStorageModes - Revalidate PixelStorageModes for all GL profiles - Properly reset values at save - Separate PACK and UNPACK save/reset/restore implementation
Diffstat (limited to 'src/test/com/jogamp/opengl')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug694ScaleImageUnpackBufferSizeAWT.java48
1 files changed, 25 insertions, 23 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug694ScaleImageUnpackBufferSizeAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug694ScaleImageUnpackBufferSizeAWT.java
index ca5b089e1..c79affef1 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug694ScaleImageUnpackBufferSizeAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug694ScaleImageUnpackBufferSizeAWT.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 com.jogamp.opengl.test.junit.jogl.glu;
import java.awt.Frame;
@@ -64,7 +64,7 @@ public class TestBug694ScaleImageUnpackBufferSizeAWT extends UITestCase implemen
public void display(GLAutoDrawable drawable) {
if( !testDone ) {
testDone = true;
-
+
final GL gl = drawable.getGL();
GLU glu = GLU.createGLU(gl);
testGLUScaleImage(gl, glu, 0); // default 4
@@ -74,39 +74,41 @@ public class TestBug694ScaleImageUnpackBufferSizeAWT extends UITestCase implemen
glu.destroy();
}
}
-
+
boolean testDone = false;
-
+
private void testGLUScaleImage(GL gl, GLU glu, int unpackAlignment) {
- final GLPixelStorageModes psm = new GLPixelStorageModes(gl);
+ final GLPixelStorageModes psm = new GLPixelStorageModes();
if(0 < unpackAlignment) {
psm.setUnpackAlignment(gl, unpackAlignment);
}
-
+
final int widthin = 213;
final int heightin = 213;
-
+
final int widthout = 256;
final int heightout = 256;
-
+
final int glFormat = GL.GL_LUMINANCE;
final int glType = GL.GL_UNSIGNED_BYTE;
final int tmp[] = new int[1];
-
+
final int unpackSizeInLen = GLBuffers.sizeof(gl, tmp, glFormat, glType, widthin, heightin, 1, false);
final int unpackSizeOutLen = GLBuffers.sizeof(gl, tmp, glFormat, glType, widthout, heightout, 1, false);
-
+
System.err.println("Unpack-Alignment "+unpackAlignment+": in-size "+unpackSizeInLen);
System.err.println("Unpack-Alignment "+unpackAlignment+": out-size "+unpackSizeOutLen);
-
+
ByteBuffer bufferIn = Buffers.newDirectByteBuffer(unpackSizeInLen);
ByteBuffer bufferOut = Buffers.newDirectByteBuffer(unpackSizeOutLen);
-
+
glu.gluScaleImage( GL.GL_LUMINANCE,
widthin, heightin, GL.GL_UNSIGNED_BYTE, bufferIn,
widthout, heightout, GL.GL_UNSIGNED_BYTE, bufferOut );
-
- psm.restore(gl);
+
+ if(0 < unpackAlignment) {
+ psm.restore(gl);
+ }
}
/* @Override */
@@ -124,10 +126,10 @@ public class TestBug694ScaleImageUnpackBufferSizeAWT extends UITestCase implemen
GLCapabilities glCapabilities = new GLCapabilities(glprofile);
final GLCanvas canvas = new GLCanvas(glCapabilities);
canvas.addGLEventListener( this );
-
+
final Frame frame = new Frame("Test");
frame.add(canvas);
- frame.setSize(256, 256);
+ frame.setSize(256, 256);
frame.validate();
try {
@@ -139,11 +141,11 @@ public class TestBug694ScaleImageUnpackBufferSizeAWT extends UITestCase implemen
t.printStackTrace();
Assume.assumeNoException(t);
}
-
+
canvas.display();
Thread.sleep(200);
-
+
try {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -154,7 +156,7 @@ public class TestBug694ScaleImageUnpackBufferSizeAWT extends UITestCase implemen
} catch (Throwable t) {
t.printStackTrace();
Assume.assumeNoException(t);
- }
+ }
}
public static void main(String args[]) {