From 4b8bd5ec58cb2edfb51bd9ee930beb9c539a8a0b Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 1 Apr 2011 06:48:52 +0200 Subject: Final core and demo changes for jogl merge Core: - Region: Cleanup up constant names - Renderer: Add getRenderType() - TextRenderer: Add cache size limit - JavaFontLoader: Add FIXME 'Add cache size to limit memory usage' - UbuntuFontLoader: Add cache and FIXME 'Add cache size to limit memory usage' - TypecastFont: Add FIXME 'Add cache size to limit memory usage ??' Demos: - Relocated and split (main/listener) for jogl merge - Add 's' for screenshot - Text: - Add 'i' for live editing mode (until CR, backspace supported) --- src/jogamp/graph/curve/opengl/TextRendererImpl01.java | 5 ++--- src/jogamp/graph/curve/opengl/VBORegion2PES2.java | 16 ++++++++-------- src/jogamp/graph/curve/opengl/VBORegionSPES2.java | 8 ++++---- 3 files changed, 14 insertions(+), 15 deletions(-) (limited to 'src/jogamp/graph/curve/opengl') diff --git a/src/jogamp/graph/curve/opengl/TextRendererImpl01.java b/src/jogamp/graph/curve/opengl/TextRendererImpl01.java index aa3202805..cebe7a19e 100644 --- a/src/jogamp/graph/curve/opengl/TextRendererImpl01.java +++ b/src/jogamp/graph/curve/opengl/TextRendererImpl01.java @@ -176,11 +176,10 @@ public class TextRendererImpl01 extends TextRenderer { if(!isInitialized()){ throw new GLException("TextRendererImpl01: not initialized!"); } - String fontStrHash = getTextHashCode(font, str, fontSize); - GlyphString glyphString = strings.get(fontStrHash); + GlyphString glyphString = getCachedGlyphString(font, str, fontSize); if(null == glyphString) { glyphString = createString(gl, font, fontSize, str, mgl_sharpness.floatValue()); - strings.put(fontStrHash, glyphString); + addCachedGlyphString(font, str, fontSize, glyphString); } glyphString.renderString3D(pmvMatrix, vp_width, vp_height, texSize); diff --git a/src/jogamp/graph/curve/opengl/VBORegion2PES2.java b/src/jogamp/graph/curve/opengl/VBORegion2PES2.java index c424c4ddd..c7c370f6d 100644 --- a/src/jogamp/graph/curve/opengl/VBORegion2PES2.java +++ b/src/jogamp/graph/curve/opengl/VBORegion2PES2.java @@ -192,12 +192,12 @@ public class VBORegion2PES2 implements Region{ gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, t_vboIds.get(0)); - gl.glEnableVertexAttribArray(VERTEX_POS_INDX); - gl.glVertexAttribPointer(VERTEX_POS_INDX, 3, GL2ES2.GL_FLOAT, false, 3 * Buffers.SIZEOF_FLOAT, 0); + gl.glEnableVertexAttribArray(VERTEX_ATTR_IDX); + gl.glVertexAttribPointer(VERTEX_ATTR_IDX, 3, GL2ES2.GL_FLOAT, false, 3 * Buffers.SIZEOF_FLOAT, 0); gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, t_vboIds.get(1)); - gl.glEnableVertexAttribArray(TEX_COORD); - gl.glVertexAttribPointer(TEX_COORD, 2, GL2ES2.GL_FLOAT, false, 2 * Buffers.SIZEOF_FLOAT, 0); + gl.glEnableVertexAttribArray(TEXCOORD_ATTR_IDX); + gl.glVertexAttribPointer(TEXCOORD_ATTR_IDX, 2, GL2ES2.GL_FLOAT, false, 2 * Buffers.SIZEOF_FLOAT, 0); gl.glBindBuffer(GL2ES2.GL_ELEMENT_ARRAY_BUFFER, t_vboIds.get(2)); gl.glDrawElements(GL2ES2.GL_TRIANGLES, 2 * 3, GL2ES2.GL_UNSIGNED_SHORT, 0); @@ -332,12 +332,12 @@ public class VBORegion2PES2 implements Region{ GL2ES2 gl = context.getGL().getGL2ES2(); gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, vboIds.get(0)); - gl.glEnableVertexAttribArray(VERTEX_POS_INDX); - gl.glVertexAttribPointer(VERTEX_POS_INDX, 3, GL2ES2.GL_FLOAT, false, 3 * Buffers.SIZEOF_FLOAT, 0); + gl.glEnableVertexAttribArray(VERTEX_ATTR_IDX); + gl.glVertexAttribPointer(VERTEX_ATTR_IDX, 3, GL2ES2.GL_FLOAT, false, 3 * Buffers.SIZEOF_FLOAT, 0); gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, vboIds.get(1)); - gl.glEnableVertexAttribArray(TEX_COORD); - gl.glVertexAttribPointer(TEX_COORD, 2, GL2ES2.GL_FLOAT, false, 2 * Buffers.SIZEOF_FLOAT, 0); + gl.glEnableVertexAttribArray(TEXCOORD_ATTR_IDX); + gl.glVertexAttribPointer(TEXCOORD_ATTR_IDX, 2, GL2ES2.GL_FLOAT, false, 2 * Buffers.SIZEOF_FLOAT, 0); gl.glBindBuffer(GL2ES2.GL_ELEMENT_ARRAY_BUFFER, vboIds.get(2)); gl.glDrawElements(GL2ES2.GL_TRIANGLES, triangles.size() * 3, GL2ES2.GL_UNSIGNED_SHORT, 0); diff --git a/src/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogamp/graph/curve/opengl/VBORegionSPES2.java index f509dbd58..701549d46 100644 --- a/src/jogamp/graph/curve/opengl/VBORegionSPES2.java +++ b/src/jogamp/graph/curve/opengl/VBORegionSPES2.java @@ -134,12 +134,12 @@ public class VBORegionSPES2 implements Region{ GL2ES2 gl = context.getGL().getGL2ES2(); gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, vboIds.get(0)); - gl.glEnableVertexAttribArray(VERTEX_POS_INDX); - gl.glVertexAttribPointer(VERTEX_POS_INDX, 3, GL2ES2.GL_FLOAT, false, 3 * Buffers.SIZEOF_FLOAT, 0); + gl.glEnableVertexAttribArray(VERTEX_ATTR_IDX); + gl.glVertexAttribPointer(VERTEX_ATTR_IDX, 3, GL2ES2.GL_FLOAT, false, 3 * Buffers.SIZEOF_FLOAT, 0); gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, vboIds.get(1)); - gl.glEnableVertexAttribArray(TEX_COORD); - gl.glVertexAttribPointer(TEX_COORD, 2, GL2ES2.GL_FLOAT, false, 2 * Buffers.SIZEOF_FLOAT, 0); + gl.glEnableVertexAttribArray(TEXCOORD_ATTR_IDX); + gl.glVertexAttribPointer(TEXCOORD_ATTR_IDX, 2, GL2ES2.GL_FLOAT, false, 2 * Buffers.SIZEOF_FLOAT, 0); gl.glBindBuffer(GL2ES2.GL_ELEMENT_ARRAY_BUFFER, vboIds.get(2)); gl.glDrawElements(GL2ES2.GL_TRIANGLES, triangles.size() * 3, GL2ES2.GL_UNSIGNED_SHORT, 0); -- cgit v1.2.3