diff options
author | Sven Gothel <[email protected]> | 2012-02-25 13:57:48 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-02-25 13:57:48 +0100 |
commit | 1c8f158c57a13274e3776d3ecb24cbd1c9765741 (patch) | |
tree | f9688983c920aef64827fb5b0346329b1d8f3cf6 /src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java | |
parent | 49114a63102c745b3db204315ad9525d61767d57 (diff) |
Min. Graph Parameter type change: texSize/width/.. for multipass-renderer: int -> int[]
"texWidth desired texture width for multipass-rendering.
The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched."
This allows the 'backend' to correct the texSize, ie in regards to GL_MAX_TEXTURE_SIZE .. etc.
Without this write-back, it would re-create the FBO for every frame.
Diffstat (limited to 'src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java')
-rw-r--r-- | src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java index 4c664e883..703fd6151 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java @@ -192,18 +192,18 @@ public class VBORegion2PES2 extends GLRegion { int[] maxTexSize = new int[] { -1 } ; - protected void drawImpl(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int width) { - if(vp_width <=0 || vp_height <= 0 || width <= 0){ + protected void drawImpl(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth) { + if(vp_width <=0 || vp_height <= 0 || null==texWidth || texWidth[0] <= 0){ renderRegion(gl); } else { if(0 > maxTexSize[0]) { gl.glGetIntegerv(GL.GL_MAX_TEXTURE_SIZE, maxTexSize, 0); } - if(width > maxTexSize[0]) { - width = maxTexSize[0]; - } - if(width != tex_width_c) { - renderRegion2FBO(gl, rs, width); + if(texWidth[0] != tex_width_c) { + if(texWidth[0] > maxTexSize[0]) { + texWidth[0] = maxTexSize[0]; // clip to max - write-back user value! + } + renderRegion2FBO(gl, rs, texWidth); } // System.out.println("Scale: " + matrix.glGetMatrixf().get(1+4*3) +" " + matrix.glGetMatrixf().get(2+4*3)); renderFBO(gl, rs, vp_width, vp_height); @@ -230,15 +230,19 @@ public class VBORegion2PES2 extends GLRegion { // setback: gl.glActiveTexture(currentActiveTextureEngine[0]); } - private void renderRegion2FBO(GL2ES2 gl, RenderState rs, int tex_width) { + private void renderRegion2FBO(GL2ES2 gl, RenderState rs, int[/*1*/] texWidth) { final ShaderState st = rs.getShaderState(); - tex_width_c = tex_width; + if(0>=texWidth[0]) { + throw new IllegalArgumentException("texWidth must be greater than 0: "+texWidth[0]); + } + + tex_width_c = texWidth[0]; tex_height_c = (int) ( ( ( tex_width_c * box.getHeight() ) / box.getWidth() ) + 0.5f ); - // System.out.println("FBO Size: "+tex_width+" -> "+tex_height_c+"x"+tex_width_c); + // System.out.println("FBO Size: "+texWidth[0]+" -> "+tex_width_c+"x"+tex_height_c); // System.out.println("FBO Scale: " + m.glGetMatrixf().get(0) +" " + m.glGetMatrixf().get(5)); - + if(null != fbo && fbo.getWidth() != tex_width_c && fbo.getHeight() != tex_height_c ) { fbo.destroy(gl); fbo = null; |