Bug 802

Summary: Enhance Graph Performance w/ Text Rendering
Product: [JogAmp] Jogl Reporter: Sven Gothel <sgothel>
Component: graphAssignee: Sven Gothel <sgothel>
Severity: enhancement CC: rami.santina, sgothel
Priority: ---    
Version: 2   
Hardware: All   
OS: all   
c3621221b9a563495b4f54fe60e18e8db8cc57fb d84812b6fb398c73cb3f339ab13d74b7e6822181 34aebbf54491b8f7e98bee3f45f8b58b817a6db5 0af9df19efc3bc31beafdd63e3487b74a97c80a7
Workaround: ---
Bug Depends on:    
Bug Blocks: 803    

Description Sven Gothel 2013-08-05 15:33:27 CEST
Text artifacts related to graph (Outlines / Vertices / TextureCoords / .. ) 
shall be cached independent of text size per font used.

Overall enhancement of text rendering performance.
Comment 1 Sven Gothel 2014-06-13 08:14:01 CEST

   Strategy Change:
      - Font.Glyph itself holds it's OutlineShape
        with it's default scaling.
        Triangulation is done only once per glyph!
      - A CharSequence produces a Region
        by translating and scaling each Glyphs's OutlineShape.
        This removes the need for re-triangulate - see above.
        See: TextRendererUtil
      - The indices of re-added Triangles are
        offset to the new vertices (FIXME, seems not be be accurate yet).
      - OutlineShape's vertices and triangles are reused if 'clean'.
      - Simplified code
      - Reduced copies
    API Changes:
      - OutlineShape, Region, ...: See above
      - Removed TextRenderer, GlyphShape and GlyphString: Redundant
      - Added TextRendererUtil to produce the Region from CharSequence

      - Over 600 fps while changing text for each frame.
        Previously only ~60fps max.
      - Region shall not hold the triangles itself,
        but the indices instead.
        This will remove the need to swizzle w/ vertices in the Region Renderer impl
        and easies reusage of OutlineShapes.
Comment 2 Sven Gothel 2014-06-13 08:14:38 CEST

   - OutlineShape
      - Add DIRTY_VERTICES bit in triangulation,
        which in turn solves the rendering artifact issue.
      - transformOutlines(..) -> protected
      - Note: Always pick triangles first, then vertices.
        The former renders vertices dirty.
    - Region
      - Make triangles / vertices accessible
      - Add 'validateIndices()' to add indices for triangles,
        code moved from the GLRegion* impl.
        Shall be refined later!
    - GLRegion
      - Passing 'RegionRenderer' instead of RenderState ..
        reducing argument numbers and aligning all related
        'render' methods while giving association to the RegionRenderer.
    - Renderer -> RegionRenderer,
      dropping 'intermediate' RegionRenderer
      - Dropping draw() in RegionRenderer, should be issued simply
        by GLRegion in a unique fashion.
    - Dropping RegionFactory
      Too simple code as-is, simply invoke in Region.create(..)
    - Overall:
      - Add 'final' qualifier
      - Remove overloaded methods
        where rither default args can be used
        or a followup method call completes the 'intention'.
Comment 3 Sven Gothel 2014-06-13 08:15:33 CEST
  Performance Note: ~800-1200 fps on uncached text line