summaryrefslogtreecommitdiffstats
path: root/src/demos/es1/cubefbo/FBCubes.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2008-07-11 13:47:28 +0000
committerSven Gothel <[email protected]>2008-07-11 13:47:28 +0000
commit6f2805064b17a3b4817c5a3f44f327c912c41b21 (patch)
treef169b2cdd69c2fb59707d9f7a94017af3cb32d99 /src/demos/es1/cubefbo/FBCubes.java
parent86dfcfbe2554e1b85d659b71130a9b950ab98b42 (diff)
cubefbo working
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@257 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src/demos/es1/cubefbo/FBCubes.java')
-rwxr-xr-xsrc/demos/es1/cubefbo/FBCubes.java51
1 files changed, 34 insertions, 17 deletions
diff --git a/src/demos/es1/cubefbo/FBCubes.java b/src/demos/es1/cubefbo/FBCubes.java
index 7bb26b1..1f0215f 100755
--- a/src/demos/es1/cubefbo/FBCubes.java
+++ b/src/demos/es1/cubefbo/FBCubes.java
@@ -33,32 +33,36 @@
package demos.es1.cubefbo;
+import demos.es1.cube.Cube;
import javax.media.opengl.*;
+import javax.media.opengl.util.FBObject;
import java.nio.*;
class FBCubes implements GLEventListener {
- private static final int FBO_SIZE = 128;
+ private static final int FBO_SIZE = 256;
public FBCubes () {
- cubeInner = new CubeObject(false);
- cubeMiddle = new CubeObject(true);
- cubeOuter = new CubeObject(true);
+ cubeOuter = new Cube(true, false);
- // cubeOuter = new CubeObject(false);
+ fbo1 = new FBObject(FBO_SIZE, FBO_SIZE, FBObject.ATTR_DEPTH);
+ cubeInner = new Cube(false, true);
- fbo1 = new FBObject(FBO_SIZE, FBO_SIZE);
- fbo2 = new FBObject(FBO_SIZE, FBO_SIZE);
+ // JAU cubeMiddle = new Cube(true, false);
+ // JAU fbo2 = new FBObject(FBO_SIZE, FBO_SIZE);
}
public void init(GLAutoDrawable drawable) {
GL2ES1 gl = drawable.getGL().getGL2ES1();
+
fbo1.init(gl);
- fbo2.init(gl);
+ cubeInner.init(drawable);
+
+ cubeOuter.init(drawable);
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
GL2ES1 gl = drawable.getGL().getGL2ES1();
- cubeOuter.reshape(gl, x, y, width, height);
+ cubeOuter.reshape(drawable, x, y, width, height);
}
float xRot=0f;
@@ -73,13 +77,25 @@ class FBCubes implements GLEventListener {
GL2ES1 gl = drawable.getGL().getGL2ES1();
fbo1.bind(gl);
- cubeInner.reshape(gl, 0, 0, FBO_SIZE, FBO_SIZE);
- cubeInner.display(gl, xRot, yRot);
+ cubeInner.reshape(drawable, 0, 0, FBO_SIZE, FBO_SIZE);
+ cubeInner.display(drawable);
+ gl.glFinish();
fbo1.unbind(gl);
- FBObject tex = fbo1;
- FBObject rend = fbo2;
+ gl.glActiveTexture(GL.GL_TEXTURE0);
+ gl.glEnable (gl.GL_TEXTURE_2D);
+ cubeOuter.reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight());
+ fbo1.use(gl);
+ cubeOuter.display(drawable);
+ fbo1.unbind(gl);
+
+ gl.glDisable (gl.GL_TEXTURE_2D);
+
+ // JAUFBObject tex = fbo1;
+ // JAU FBObject rend = fbo2;
+
+ /* JAU
int MAX_ITER = 1;
for (int i = 0; i < MAX_ITER; i++) {
@@ -106,16 +122,17 @@ class FBCubes implements GLEventListener {
// System.out.println("display .. p7");
gl.glBindTexture(gl.GL_TEXTURE_2D, 0);
gl.glDisable (gl.GL_TEXTURE_2D);
+ */
}
public void displayChanged(javax.media.opengl.GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
}
float time = 0.0f;
- CubeObject cubeInner;
- CubeObject cubeMiddle;
- CubeObject cubeOuter;
+ Cube cubeInner=null;
+ // JAU Cube cubeMiddle=null;
+ Cube cubeOuter=null;
FBObject fbo1;
- FBObject fbo2;
+ // JAU FBObject fbo2;
}