diff options
author | Sven Gothel <[email protected]> | 2011-05-17 13:06:09 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-05-17 13:06:09 +0200 |
commit | 6bd444a80f2b1ec6cfac1518bf31a487de3f17b5 (patch) | |
tree | 154ed4e3a15a9929e58586d656dd90e4b51f3786 /src/jogl/classes/jogamp/graph/curve | |
parent | 526ea7a3fb579f88a0c0a1e597387aae29d5aa06 (diff) |
FIX graph FBObject usage - 526ea7a3fb579f88a0c0a1e597387aae29d5aa06
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve')
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java index 5645393bb..285caacf9 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java @@ -32,6 +32,7 @@ import java.nio.FloatBuffer; import javax.media.opengl.GL2ES2; // FIXME: Subsume GL2GL3.GL_DRAW_FRAMEBUFFER -> GL2ES2.GL_DRAW_FRAMEBUFFER ! import javax.media.opengl.GL; +import javax.media.opengl.GLException; import javax.media.opengl.GLUniformData; import javax.media.opengl.fixedfunc.GLMatrixFunc; @@ -66,11 +67,9 @@ public class VBORegion2PES2 extends GLRegion { private int tex_height_c = 0; GLUniformData mgl_ActiveTexture; GLUniformData mgl_TextureSize; // if GLSL < 1.30 - final int activeTexture; // texture engine 0 == GL.GL_TEXTURE0 public VBORegion2PES2(int renderModes, int textureEngine) { super(renderModes); - activeTexture = GL.GL_TEXTURE0 + textureEngine; fboPMVMatrix = new PMVMatrix(); mgl_fboPMVMatrix = new GLUniformData(UniformNames.gcu_PMVMatrix, 4, 4, fboPMVMatrix.glGetPMvMatrixf()); mgl_ActiveTexture = new GLUniformData(UniformNames.gcu_TextureUnit, textureEngine); @@ -207,17 +206,9 @@ public class VBORegion2PES2 extends GLRegion { private void renderFBO(GL2ES2 gl, RenderState rs, int width, int hight) { final ShaderState st = rs.getShaderState(); - gl.glViewport(0, 0, width, hight); - - gl.glEnable(GL2ES2.GL_TEXTURE_2D); - /* setback: - int[] currentActiveTextureEngine = new int[1]; - gl.glGetIntegerv(GL.GL_ACTIVE_TEXTURE, currentActiveTextureEngine, 0); - */ - gl.glActiveTexture(activeTexture); - st.uniform(gl, mgl_ActiveTexture); - - fbo.use(gl); + gl.glViewport(0, 0, width, hight); + st.uniform(gl, mgl_ActiveTexture); + fbo.use(gl, 0); verticeFboAttr.enableBuffer(gl, true); texCoordFboAttr.enableBuffer(gl, true); indicesFbo.enableBuffer(gl, true); @@ -248,10 +239,14 @@ public class VBORegion2PES2 extends GLRegion { if(null == fbo) { fbo = new FBObject(tex_width_c, tex_height_c); + fbo.init(gl); // FIXME: shall not use bilinear, due to own AA ? However, w/o bilinear result is not smooth - fbo.init(gl, GL2ES2.GL_LINEAR, GL2ES2.GL_LINEAR, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); - // fbo.init(gl, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); + fbo.attachTexture2D(gl, mgl_ActiveTexture.intValue(), GL2ES2.GL_LINEAR, GL2ES2.GL_LINEAR, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); + // fbo.attachTexture2D(gl, mgl_ActiveTexture.intValue(), GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); fbo.attachDepthBuffer(gl, GL.GL_DEPTH_COMPONENT16); // FIXME: or shall we use 24 or 32 bit depth ? + if(!fbo.isStatusValid()) { + throw new GLException("FBO invalid: "+fbo); + } } else { fbo.bind(gl); } |