summaryrefslogtreecommitdiffstats
path: root/src/demos/cubefbo
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-07-20 09:27:54 +0200
committerSven Gothel <[email protected]>2012-07-20 09:27:54 +0200
commitd1a1ad3599c3760d4e7ceecf35d15de485c8b652 (patch)
tree2874056c517536cd583f807e83760236bc2344a3 /src/demos/cubefbo
parent2365d7278bc5a64b4ff7856fd01d75214ea0f555 (diff)
Adapt to FBObject changes
Diffstat (limited to 'src/demos/cubefbo')
-rwxr-xr-xsrc/demos/cubefbo/FBCubes.java28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/demos/cubefbo/FBCubes.java b/src/demos/cubefbo/FBCubes.java
index 765c37f..af5eeb4 100755
--- a/src/demos/cubefbo/FBCubes.java
+++ b/src/demos/cubefbo/FBCubes.java
@@ -36,16 +36,14 @@ package demos.cubefbo;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
-import javax.media.opengl.GLProfile;
-import javax.media.opengl.DebugGL2;
import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
-import javax.media.opengl.awt.GLCanvas;
-import com.jogamp.opengl.util.FBObject;
+import com.jogamp.opengl.FBObject;
+import com.jogamp.opengl.FBObject.Attachment;
+import com.jogamp.opengl.FBObject.TextureAttachment;
class FBCubes implements GLEventListener, MouseListener, MouseMotionListener {
@@ -55,19 +53,19 @@ class FBCubes implements GLEventListener, MouseListener, MouseMotionListener {
cubeInner = new CubeObject(false);
cubeMiddle = new CubeObject(true);
cubeOuter = new CubeObject(true);
- fbo1 = new FBObject(FBO_SIZE, FBO_SIZE);
- fbo2 = new FBObject(FBO_SIZE, FBO_SIZE);
+ fbo1 = new FBObject();
+ fbo2 = new FBObject();
}
public void init(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
- // drawable.setGL(new DebugGL2(gl));
- // gl = drawable.getGL().getGL2();
- fbo1.init(gl);
- fbo1.attachTexture2D(gl, 0, gl.GL_NEAREST, gl.GL_NEAREST, 0, 0);
+ fbo1.reset(gl, FBO_SIZE, FBO_SIZE);
+ fbo1.attachTexture2D(gl, 0, true);
+ fbo1.attachRenderbuffer(gl, Attachment.Type.DEPTH, 32);
fbo1.unbind(gl);
- fbo2.init(gl);
- fbo2.attachTexture2D(gl, 0, gl.GL_NEAREST, gl.GL_NEAREST, 0, 0);
+ fbo2.reset(gl, FBO_SIZE, FBO_SIZE);
+ fbo2.attachTexture2D(gl, 0, true);
+ fbo2.attachRenderbuffer(gl, Attachment.Type.DEPTH, 32);
fbo2.unbind(gl);
}
@@ -115,7 +113,7 @@ class FBCubes implements GLEventListener, MouseListener, MouseMotionListener {
for (int i = 0; i < MAX_ITER; i++) {
rend.bind(gl);
gl.glEnable (GL.GL_TEXTURE_2D);
- tex.use(gl, 0);
+ tex.use(gl, (TextureAttachment)tex.getColorbuffer(0));
cubeMiddle.reshape(gl, 0, 0, FBO_SIZE, FBO_SIZE);
cubeMiddle.display(gl, xRot, yRot);
tex.unuse(gl);
@@ -134,7 +132,7 @@ class FBCubes implements GLEventListener, MouseListener, MouseMotionListener {
gl.glClearColor(0, 0, 0, 1);
gl.glEnable (GL.GL_TEXTURE_2D);
- tex.use(gl, 0);
+ tex.use(gl, (TextureAttachment)tex.getColorbuffer(0));
cubeOuter.display(gl, xRot, yRot);
// System.out.println("display .. p8");
tex.unuse(gl);