summaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/com/jogamp')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java55
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java55
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareMappedES2.java1
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw01ES2Listener.java89
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java5
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java1
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java93
7 files changed, 145 insertions, 154 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java
index 52af4916c..573c91636 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java
@@ -54,9 +54,9 @@ public class PointsDemoES2 extends PointsDemo {
final int edge = 8; // 8*8
/** vec4[2]: { (sz, smooth, attnMinSz, attnMaxSz), (attnCoeff(3), attnFadeTs) } */
private static final String mgl_PointParams = "mgl_PointParams";
-
+
/** ( pointSize, pointSmooth, attn. pointMinSize, attn. pointMaxSize ) , ( attenuation coefficients 1f 0f 0f, attenuation fade theshold 1f ) */
- private final FloatBuffer pointParams = Buffers.newDirectFloatBuffer(new float[] { 1.0f, 0.0f, 0.0f, 4096.0f, 1.0f, 0.0f, 0.0f, 1.0f });
+ private final FloatBuffer pointParams = Buffers.newDirectFloatBuffer(new float[] { 1.0f, 0.0f, 0.0f, 4096.0f, 1.0f, 0.0f, 0.0f, 1.0f });
public PointsDemoES2(int swapInterval) {
this.swapInterval = swapInterval;
@@ -65,29 +65,29 @@ public class PointsDemoES2 extends PointsDemo {
public PointsDemoES2() {
this.swapInterval = 1;
}
-
- public void setSmoothPoints(boolean v) {
- pointParams.put(1, v ? 1.0f : 0.0f);
+
+ public void setSmoothPoints(boolean v) {
+ pointParams.put(1, v ? 1.0f : 0.0f);
}
-
+
public void setPointParams(float minSize, float maxSize, float distAttenConst, float distAttenLinear, float distAttenQuadratic, float fadeThreshold) {
pointParams.put(2, minSize);
pointParams.put(3, maxSize);
pointParams.put(4+0, distAttenConst);
pointParams.put(4+1, distAttenLinear);
pointParams.put(4+2, distAttenQuadratic);
- pointParams.put(4+3, fadeThreshold);
+ pointParams.put(4+3, fadeThreshold);
}
-
+
public void init(GLAutoDrawable glad) {
GL2ES2 gl = glad.getGL().getGL2ES2();
-
+
System.err.println("GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR));
System.err.println("GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER));
System.err.println("GL_VERSION: " + gl.glGetString(GL.GL_VERSION));
System.err.println("GL GLSL: "+gl.hasGLSL()+", has-compiler-func: "+gl.isFunctionAvailable("glCompileShader")+", version "+(gl.hasGLSL() ? gl.glGetString(GL2ES2.GL_SHADING_LANGUAGE_VERSION) : "none"));
System.err.println("GL Profile: "+gl.getGLProfile());
-
+
st = new ShaderState();
st.setVerbose(true);
final ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(), "shader",
@@ -100,23 +100,23 @@ public class PointsDemoES2 extends PointsDemo {
sp0.add(gl, vp0, System.err);
sp0.add(gl, fp0, System.err);
st.attachShaderProgram(gl, sp0, true);
-
+
// setup mgl_PMVMatrix
pmvMatrix = new PMVMatrix();
pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
- pmvMatrix.glLoadIdentity();
+ pmvMatrix.glLoadIdentity();
pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv
st.ownUniform(pmvMatrixUniform);
- st.uniform(gl, pmvMatrixUniform);
-
+ st.uniform(gl, pmvMatrixUniform);
+
st.uniform(gl, new GLUniformData(mgl_PointParams, 4, pointParams));
-
+
final GLUniformData colorStaticUniform = new GLUniformData("mgl_ColorStatic", 4, Buffers.newDirectFloatBuffer(new float[] { 1.0f, 1.0f, 1.0f, 1.0f }) );
st.uniform(gl, colorStaticUniform);
st.ownUniform(colorStaticUniform);
-
+
// Allocate Vertex Array
vertices = GLArrayDataServer.createGLSL("mgl_Vertex", 3, GL.GL_FLOAT, false, edge*edge, GL.GL_STATIC_DRAW);
pointSizes = GLArrayDataServer.createGLSL("mgl_PointSize", 1, GL.GL_FLOAT, false, edge*edge, GL.GL_STATIC_DRAW);
@@ -139,7 +139,7 @@ public class PointsDemoES2 extends PointsDemo {
// OpenGL Render Settings
gl.glEnable(GL2ES2.GL_DEPTH_TEST);
- st.useProgram(gl, false);
+ st.useProgram(gl, false);
}
public void display(GLAutoDrawable glad) {
@@ -150,17 +150,17 @@ public class PointsDemoES2 extends PointsDemo {
pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, -10);
- st.uniform(gl, pmvMatrixUniform);
+ st.uniform(gl, pmvMatrixUniform);
GLUniformData ud = st.getUniform(mgl_PointParams);
if(null!=ud) {
- // same data object
+ // same data object
st.uniform(gl, ud);
}
-
+
vertices.enableBuffer(gl, true);
pointSizes.enableBuffer(gl, true);
-
+
if(gl.isGL2GL3()) {
gl.glEnable(GL2GL3.GL_VERTEX_PROGRAM_POINT_SIZE);
}
@@ -171,11 +171,11 @@ public class PointsDemoES2 extends PointsDemo {
gl.glBlendFunc ( GL.GL_SRC_ALPHA, GL.GL_ONE );
gl.glDrawArrays(GL.GL_POINTS, 0, edge*edge);
-
+
if(gl.isGL2GL3()) {
gl.glDisable(GL2GL3.GL_VERTEX_PROGRAM_POINT_SIZE);
}
-
+
pointSizes.enableBuffer(gl, false);
vertices.enableBuffer(gl, false);
st.useProgram(gl, false);
@@ -184,11 +184,11 @@ public class PointsDemoES2 extends PointsDemo {
public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) {
// Thread.dumpStack();
GL2ES2 gl = glad.getGL().getGL2ES2();
-
- if(-1 != swapInterval) {
+
+ if(-1 != swapInterval) {
gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
}
-
+
st.useProgram(gl, true);
// Set location in front of camera
pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
@@ -203,7 +203,6 @@ public class PointsDemoES2 extends PointsDemo {
GL2ES2 gl = glad.getGL().getGL2ES2();
st.destroy(gl);
st = null;
- pmvMatrix.destroy();
pmvMatrix = null;
- }
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java
index 715a97d63..9f850c35b 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java
@@ -62,17 +62,17 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende
public RedSquareES2() {
this.swapInterval = 1;
}
-
+
@Override
public void addTileRendererNotify(TileRendererBase tr) {
tileRendererInUse = tr;
doRotateBeforePrinting = doRotate;
- setDoRotation(false);
+ setDoRotation(false);
}
@Override
public void removeTileRendererNotify(TileRendererBase tr) {
tileRendererInUse = null;
- setDoRotation(doRotateBeforePrinting);
+ setDoRotation(doRotateBeforePrinting);
}
@Override
public void startTileRendering(TileRendererBase tr) {
@@ -82,16 +82,16 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende
public void endTileRendering(TileRendererBase tr) {
System.err.println("RedSquareES2.endTileRendering: "+tr);
}
-
+
public void setAspect(float aspect) { this.aspect = aspect; }
public void setDoRotation(boolean rotate) { this.doRotate = rotate; }
public void setClearBuffers(boolean v) { clearBuffers = v; }
-
+
@Override
public void init(GLAutoDrawable glad) {
System.err.println(Thread.currentThread()+" RedSquareES2.init: tileRendererInUse "+tileRendererInUse);
final GL2ES2 gl = glad.getGL().getGL2ES2();
-
+
System.err.println("RedSquareES2 init on "+Thread.currentThread());
System.err.println("Chosen GLCapabilities: " + glad.getChosenGLCapabilities());
System.err.println("INIT GL IS: " + gl.getClass().getName());
@@ -112,17 +112,17 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende
sp0.add(gl, vp0, System.err);
sp0.add(gl, fp0, System.err);
st.attachShaderProgram(gl, sp0, true);
-
+
// setup mgl_PMVMatrix
pmvMatrix = new PMVMatrix();
pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
- pmvMatrix.glLoadIdentity();
+ pmvMatrix.glLoadIdentity();
pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv
st.ownUniform(pmvMatrixUniform);
- st.uniform(gl, pmvMatrixUniform);
-
+ st.uniform(gl, pmvMatrixUniform);
+
// Allocate Vertex Array
vertices = GLArrayDataServer.createGLSL("mgl_Vertex", 3, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW);
vertices.putf(-2); vertices.putf( 2); vertices.putf( 0);
@@ -132,20 +132,20 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende
vertices.seal(gl, true);
st.ownAttribute(vertices, true);
vertices.enableBuffer(gl, false);
-
+
// Allocate Color Array
colors= GLArrayDataServer.createGLSL("mgl_Color", 4, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW);
colors.putf(1); colors.putf(0); colors.putf(0); colors.putf(1);
colors.putf(0); colors.putf(0); colors.putf(1); colors.putf(1);
colors.putf(1); colors.putf(0); colors.putf(0); colors.putf(1);
colors.putf(1); colors.putf(0); colors.putf(0); colors.putf(1);
- colors.seal(gl, true);
+ colors.seal(gl, true);
st.ownAttribute(colors, true);
colors.enableBuffer(gl, false);
-
+
// OpenGL Render Settings
gl.glEnable(GL2ES2.GL_DEPTH_TEST);
- st.useProgram(gl, false);
+ st.useProgram(gl, false);
t0 = System.currentTimeMillis();
System.err.println(Thread.currentThread()+" RedSquareES2.init FIN");
@@ -173,11 +173,11 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, -10);
if(doRotate) {
- float ang = ((float) (t1 - t0) * 360.0F) / 4000.0F;
+ float ang = ((t1 - t0) * 360.0F) / 4000.0F;
pmvMatrix.glRotatef(ang, 0, 0, 1);
pmvMatrix.glRotatef(ang, 0, 1, 0);
}
- st.uniform(gl, pmvMatrixUniform);
+ st.uniform(gl, pmvMatrixUniform);
// Draw a square
vertices.enableBuffer(gl, true);
@@ -191,39 +191,39 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende
@Override
public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) {
final GL2ES2 gl = glad.getGL().getGL2ES2();
- if(-1 != swapInterval) {
+ if(-1 != swapInterval) {
gl.setSwapInterval(swapInterval);
}
reshapeImpl(gl, x, y, width, height, width, height);
}
-
+
@Override
public void reshapeTile(TileRendererBase tr,
- int tileX, int tileY, int tileWidth, int tileHeight,
+ int tileX, int tileY, int tileWidth, int tileHeight,
int imageWidth, int imageHeight) {
final GL2ES2 gl = tr.getAttachedDrawable().getGL().getGL2ES2();
gl.setSwapInterval(0);
reshapeImpl(gl, tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight);
}
-
+
void reshapeImpl(GL2ES2 gl, int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight) {
System.err.println(Thread.currentThread()+" RedSquareES2.reshape "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", tileRendererInUse "+tileRendererInUse);
// Thread.dumpStack();
if( !gl.hasGLSL() ) {
return;
}
-
+
st.useProgram(gl, true);
// Set location in front of camera
pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
-
+
// compute projection parameters 'normal' perspective
final float fovy=45f;
final float aspect2 = ( (float) imageWidth / (float) imageHeight ) / aspect;
final float zNear=1f;
final float zFar=100f;
-
+
// compute projection parameters 'normal' frustum
final float top=(float)Math.tan(fovy*((float)Math.PI)/360.0f)*zNear;
final float bottom=-1.0f*top;
@@ -231,18 +231,18 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende
final float right=aspect2*top;
final float w = right - left;
final float h = top - bottom;
-
+
// compute projection parameters 'tiled'
final float l = left + tileX * w / imageWidth;
final float r = l + tileWidth * w / imageWidth;
final float b = bottom + tileY * h / imageHeight;
final float t = b + tileHeight * h / imageHeight;
-
+
pmvMatrix.glFrustumf(l, r, b, t, zNear, zFar);
//pmvMatrix.glOrthof(-4.0f, 4.0f, -4.0f, 4.0f, 1.0f, 100.0f);
st.uniform(gl, pmvMatrixUniform);
st.useProgram(gl, false);
-
+
System.err.println(Thread.currentThread()+" RedSquareES2.reshape FIN");
}
@@ -255,8 +255,7 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende
}
st.destroy(gl);
st = null;
- pmvMatrix.destroy();
pmvMatrix = null;
System.err.println(Thread.currentThread()+" RedSquareES2.dispose FIN");
- }
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareMappedES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareMappedES2.java
index f0c9fc6ed..113cbee26 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareMappedES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareMappedES2.java
@@ -274,7 +274,6 @@ public class RedSquareMappedES2 implements GLEventListener, TileRendererBase.Til
}
st.destroy(gl);
st = null;
- pmvMatrix.destroy();
pmvMatrix = null;
System.err.println(Thread.currentThread()+" RedSquareES2.dispose FIN");
}
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
index 8aa3a006c..fb30ef6b5 100644
--- 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
@@ -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.demos.es2;
import java.nio.FloatBuffer;
@@ -53,15 +53,15 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A
Texture texture;
int textureUnit;
boolean keepTextureBound;
-
+
ShaderState st;
PMVMatrix pmvMatrix;
GLUniformData pmvMatrixUniform;
GLArrayDataServer interleavedVBO;
float[] clearColor = new float[] { 1.0f, 1.0f, 1.0f, 1.0f };
-
+
/**
- *
+ *
* @param td
* @param textureUnit of range [0..]
*/
@@ -70,7 +70,7 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A
this.textureUnit = textureUnit;
this.keepTextureBound = false;
}
-
+
public void setClearColor(float[] clearColor) {
this.clearColor = clearColor;
}
@@ -83,7 +83,7 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A
public Texture getTexture( ) {
return this.texture;
}
-
+
/**
public void setTextureData(GL gl, TextureData textureData ) {
if(null!=texture) {
@@ -95,21 +95,21 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A
}
this.textureData = textureData;
this.texture = TextureIO.newTexture(this.textureData);
-
+
// fix VBO !
} */
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(),
+ 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(),
+ ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(),
"shader", "shader/bin", shaderBasename, true);
rsVp.defaultShaderCustomization(gl, true, true);
rsFp.defaultShaderCustomization(gl, true, true);
-
+
// Create & Link the shader program
ShaderProgram sp = new ShaderProgram();
sp.add(rsVp);
@@ -122,24 +122,24 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A
st = new ShaderState();
st.attachShaderProgram(gl, sp, use_program);
}
-
+
@Override
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();
+ 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);
@@ -150,31 +150,31 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A
// 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_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_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(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);
gl.glEnable(GL2ES2.GL_DEPTH_TEST);
-
+
if( keepTextureBound && null != texture ) {
gl.glActiveTexture(GL.GL_TEXTURE0 + textureUnit);
texture.enable(gl);
@@ -186,21 +186,21 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A
@Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
GL2ES2 gl = drawable.getGL().getGL2ES2();
-
+
// Clear background to white
gl.glClearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);
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);
- }
+ }
}
@Override
@@ -215,7 +215,6 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A
}
pmvMatrixUniform = null;
- pmvMatrix.destroy();
pmvMatrix=null;
st.destroy(gl);
st=null;
@@ -227,38 +226,38 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
- st.useProgram(gl, true);
+ st.useProgram(gl, true);
interleavedVBO.enableBuffer(gl, true);
if( !keepTextureBound && null != texture ) {
- gl.glActiveTexture(GL.GL_TEXTURE0 + textureUnit);
+ gl.glActiveTexture(GL.GL_TEXTURE0 + textureUnit);
texture.enable(gl);
texture.bind(gl);
}
-
+
gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4);
-
+
if( !keepTextureBound && null != texture ) {
texture.disable(gl);
}
- interleavedVBO.enableBuffer(gl, false);
+ interleavedVBO.enableBuffer(gl, false);
st.useProgram(gl, false);
}
-
- private static final float[] s_quadVertices = {
+
+ private static final float[] s_quadVertices = {
-1f, -1f, 0f, // LB
1f, -1f, 0f, // RB
-1f, 1f, 0f, // LT
- 1f, 1f, 0f // RT
+ 1f, 1f, 0f // RT
};
- private static final float[] s_quadColors = {
+ 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 = {
+ private static final float[] s_quadTexCoords = {
0f, 0f, // LB
1f, 0f, // RB
- 0f, 1f, // LT
+ 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 79e0655e3..cdee78fe9 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
@@ -348,10 +348,7 @@ public class TextureSequenceCubeES2 implements GLEventListener {
texSeq = null;
pmvMatrixUniform = null;
- if( null != pmvMatrix ) {
- pmvMatrix.destroy();
- pmvMatrix=null;
- }
+ pmvMatrix=null;
if( null != st ) {
st.destroy(gl);
st=null;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java
index 6cee4066b..cb78165be 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java
@@ -713,7 +713,6 @@ public class MovieSimple implements GLEventListener {
}
pmvMatrixUniform = null;
if(null != pmvMatrix) {
- pmvMatrix.destroy();
pmvMatrix=null;
}
if(null != st) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java
index e69286311..13f299aeb 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.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,7 +20,7 @@
* 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.
@@ -60,10 +60,10 @@ import com.jogamp.opengl.util.texture.TextureIO;
* geometry shader.
* </p>
* <p>
- * If the <code>XYZ flipping</code> geometry shader functions properly,
+ * If the <code>XYZ flipping</code> geometry shader functions properly,
* the texture will be flipped horizontally and vertically.
- * </p>
- *
+ * </p>
+ *
* @author Chuck Ritola December 2012
* @author Sven Gothel (GL3 core, pass-though, core geometry shader)
*/
@@ -77,7 +77,7 @@ public class GeomShader01TextureGL3 implements GLEventListener {
static final String shaderBasename = "texture01_xxx";
static final String[] geomShaderBaseNames = new String[] { "passthrough01_xxx", "flipXYZ01_xxx" };
-
+
public GeomShader01TextureGL3(int geomShader) {
this.geomShader = geomShader;
}
@@ -100,22 +100,22 @@ public class GeomShader01TextureGL3 implements GLEventListener {
if( !ShaderUtil.isGeometryShaderSupported(gl) ) {
throw new RuntimeException("GL object not >= 3.2, i.e. no geometry shader support.: "+gl);
}
- }
+ }
final GL3 gl = drawable.getGL().getGL3();
final ShaderProgram sp;
{
final ShaderCode vs, gs, fs;
- vs = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(),
+ vs = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(),
"shader", "shader/bin", shaderBasename, true);
- gs = ShaderCode.create(gl, GL3.GL_GEOMETRY_SHADER, this.getClass(),
+ gs = ShaderCode.create(gl, GL3.GL_GEOMETRY_SHADER, this.getClass(),
"shader", "shader/bin", geomShaderBaseNames[geomShader], true);
- fs = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(),
- "shader", "shader/bin", shaderBasename, true);
+ fs = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(),
+ "shader", "shader/bin", shaderBasename, true);
vs.defaultShaderCustomization(gl, true, true);
gs.defaultShaderCustomization(gl, true, true);
fs.defaultShaderCustomization(gl, true, true);
-
+
sp = new ShaderProgram();
sp.add(gl, vs, System.err);
sp.add(gl, gs, System.err);
@@ -124,20 +124,20 @@ public class GeomShader01TextureGL3 implements GLEventListener {
throw new GLException("Couldn't link program: "+sp);
}
}
-
+
st=new ShaderState();
st.attachShaderProgram(gl, sp, true);
-
+
// setup mgl_PMVMatrix
pmvMatrix = new PMVMatrix();
pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
- pmvMatrix.glLoadIdentity();
+ pmvMatrix.glLoadIdentity();
pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv
st.ownUniform(pmvMatrixUniform);
- st.uniform(gl, pmvMatrixUniform);
-
+ st.uniform(gl, pmvMatrixUniform);
+
st.ownUniform(pmvMatrixUniform);
if(!st.uniform(gl, pmvMatrixUniform)) {
throw new GLException("Error setting PMVMatrix in shader: "+st);
@@ -154,13 +154,13 @@ public class GeomShader01TextureGL3 implements GLEventListener {
if(null == texture) {
throw new RuntimeException("Could not load test texture");
}
-
+
// Tri order:
// TL, BL, BR
// TL, TR, BR
{
int i=0;
- TextureCoords tc = texture.getImageTexCoords();
+ TextureCoords tc = texture.getImageTexCoords();
s_triTexCoords[i++] = tc.left(); s_triTexCoords[i++] = tc.top();
s_triTexCoords[i++] = tc.left(); s_triTexCoords[i++] = tc.bottom();
s_triTexCoords[i++] = tc.right(); s_triTexCoords[i++] = tc.bottom();
@@ -168,25 +168,25 @@ public class GeomShader01TextureGL3 implements GLEventListener {
s_triTexCoords[i++] = tc.right(); s_triTexCoords[i++] = tc.top();
s_triTexCoords[i++] = tc.right(); s_triTexCoords[i++] = tc.bottom();
}
-
+
interleavedVBO = GLArrayDataServer.createGLSLInterleaved(2+4+2, GL.GL_FLOAT, false, 3*6, GL.GL_STATIC_DRAW);
- {
+ {
interleavedVBO.addGLSLSubArray("mgl_Vertex", 2, GL.GL_ARRAY_BUFFER);
interleavedVBO.addGLSLSubArray("mgl_Color", 4, GL.GL_ARRAY_BUFFER);
interleavedVBO.addGLSLSubArray("mgl_MultiTexCoord", 2, GL.GL_ARRAY_BUFFER);
FloatBuffer ib = (FloatBuffer)interleavedVBO.getBuffer();
-
+
for(int i=0; i<6; i++) {
ib.put(s_triVertices, i*2, 2);
ib.put(s_triColors, i*4, 4);
ib.put(s_triTexCoords, i*2, 2);
- }
+ }
}
interleavedVBO.seal(gl, true);
interleavedVBO.enableBuffer(gl, false);
st.ownAttribute(interleavedVBO, true);
-
+
gl.glClearColor(0f, 0f, 0f, 0f);
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
st.useProgram(gl, false);
@@ -202,7 +202,7 @@ public class GeomShader01TextureGL3 implements GLEventListener {
texData.destroy();
return res;
}
-
+
@Override
public void dispose(GLAutoDrawable drawable) {
final GL3 gl = drawable.getGL().getGL3();
@@ -213,19 +213,18 @@ public class GeomShader01TextureGL3 implements GLEventListener {
if(null != st) {
pmvMatrixUniform = null;
- pmvMatrix.destroy();
pmvMatrix=null;
st.destroy(gl);
st=null;
}
}
-
+
@Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
GL3 gl = drawable.getGL().getGL3();
-
+
gl.setSwapInterval(1);
-
+
// Clear background to white
gl.glClearColor(1.0f, 1.0f, 1.0f, 0.4f);
@@ -233,42 +232,42 @@ public class GeomShader01TextureGL3 implements GLEventListener {
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);
- }
+ }
}
-
+
@Override
public void display(GLAutoDrawable drawable) {
final GL3 gl = drawable.getGL().getGL3();
-
+
gl.glClear(GL.GL_DEPTH_BUFFER_BIT | GL.GL_COLOR_BUFFER_BIT);
if(null != st) {
//Draw the image as a pseudo-quad using two triangles
- st.useProgram(gl, true);
+ st.useProgram(gl, true);
interleavedVBO.enableBuffer(gl, true);
gl.glActiveTexture(GL.GL_TEXTURE0);
texture.enable(gl);
texture.bind(gl);
-
+
gl.glDrawArrays(GL.GL_TRIANGLES, 0, 6);
-
- texture.disable(gl);
- interleavedVBO.enableBuffer(gl, false);
+
+ texture.disable(gl);
+ interleavedVBO.enableBuffer(gl, false);
st.useProgram(gl, false);
}
}//end display()
-
- private static final float[] s_triVertices = {
+
+ private static final float[] s_triVertices = {
-1f, 1f, // TL
-1f, -1f, // BL
- 1f, -1f, // BR
+ 1f, -1f, // BR
-1f, 1f, // TL
1f, 1f, // TR
1f, -1f // BR
@@ -281,13 +280,13 @@ public class GeomShader01TextureGL3 implements GLEventListener {
1f, 1f, 1f, 1f,
1f, 1f, 1f, 1f
};
- private static final float[] s_triTexCoords = {
+ private static final float[] s_triTexCoords = {
0f, 1f, // TL
0f, 0f, // BL
- 1f, 0f, // BR
+ 1f, 0f, // BR
0f, 1f, // TL
1f, 1f, // TR
1f, 0f // BR
};
-
+
}//end Test