summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/demos/cubefbo/FBCubes.java14
-rwxr-xr-xsrc/demos/es1/cubefbo/FBCubes.java8
2 files changed, 12 insertions, 10 deletions
diff --git a/src/demos/cubefbo/FBCubes.java b/src/demos/cubefbo/FBCubes.java
index 76beb3c..765c37f 100755
--- a/src/demos/cubefbo/FBCubes.java
+++ b/src/demos/cubefbo/FBCubes.java
@@ -63,9 +63,11 @@ class FBCubes implements GLEventListener, MouseListener, MouseMotionListener {
GL2 gl = drawable.getGL().getGL2();
// drawable.setGL(new DebugGL2(gl));
// gl = drawable.getGL().getGL2();
- fbo1.init(gl, gl.GL_NEAREST, gl.GL_NEAREST, 0, 0);
+ fbo1.init(gl);
+ fbo1.attachTexture2D(gl, 0, gl.GL_NEAREST, gl.GL_NEAREST, 0, 0);
fbo1.unbind(gl);
- fbo2.init(gl, gl.GL_NEAREST, gl.GL_NEAREST, 0, 0);
+ fbo2.init(gl);
+ fbo2.attachTexture2D(gl, 0, gl.GL_NEAREST, gl.GL_NEAREST, 0, 0);
fbo2.unbind(gl);
}
@@ -113,10 +115,10 @@ class FBCubes implements GLEventListener, MouseListener, MouseMotionListener {
for (int i = 0; i < MAX_ITER; i++) {
rend.bind(gl);
gl.glEnable (GL.GL_TEXTURE_2D);
- gl.glBindTexture(GL.GL_TEXTURE_2D, tex.getTextureName()); // to use it ..
+ tex.use(gl, 0);
cubeMiddle.reshape(gl, 0, 0, FBO_SIZE, FBO_SIZE);
cubeMiddle.display(gl, xRot, yRot);
- gl.glBindTexture(GL.GL_TEXTURE_2D, 0);
+ tex.unuse(gl);
gl.glDisable (GL.GL_TEXTURE_2D);
rend.unbind(gl);
FBObject tmp = tex;
@@ -132,10 +134,10 @@ class FBCubes implements GLEventListener, MouseListener, MouseMotionListener {
gl.glClearColor(0, 0, 0, 1);
gl.glEnable (GL.GL_TEXTURE_2D);
- gl.glBindTexture(GL.GL_TEXTURE_2D, tex.getTextureName()); // to use it ..
+ tex.use(gl, 0);
cubeOuter.display(gl, xRot, yRot);
// System.out.println("display .. p8");
- gl.glBindTexture(GL.GL_TEXTURE_2D, 0);
+ tex.unuse(gl);
gl.glDisable (GL.GL_TEXTURE_2D);
}
diff --git a/src/demos/es1/cubefbo/FBCubes.java b/src/demos/es1/cubefbo/FBCubes.java
index 0bfe79a..e0dea40 100755
--- a/src/demos/es1/cubefbo/FBCubes.java
+++ b/src/demos/es1/cubefbo/FBCubes.java
@@ -72,7 +72,8 @@ public class FBCubes implements GLEventListener {
gl = gltrace;
}*/
- fbo1.init(gl, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, 0, 0);
+ fbo1.init(gl);
+ fbo1.attachTexture2D(gl, 0, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, 0, 0);
fbo1.attachDepthBuffer(gl, GL.GL_DEPTH_COMPONENT16);
//fbo1.init(gl, GL.GL_RGB, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, 0, 0); // faster
//fbo1.init(gl, GL.GL_RGBA, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, 0, 0); // GLES2 default
@@ -115,12 +116,11 @@ public class FBCubes implements GLEventListener {
gl.glFinish();
fbo1.unbind(gl);
- gl.glActiveTexture(GL.GL_TEXTURE0);
gl.glEnable (gl.GL_TEXTURE_2D);
+ fbo1.use(gl, 0);
cubeOuter.reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight());
- fbo1.use(gl);
cubeOuter.display(drawable);
-
+ fbo1.unuse(gl);
gl.glDisable (gl.GL_TEXTURE_2D);
// JAUFBObject tex = fbo1;