[osg-users] Cloning text

Andreas Ekstrand andreas.ekstrand at remograph.com
Fri Sep 22 03:43:21 PDT 2017


Thanks for the suggestions, Robert! I was just investigating such 
possibilities, shows I'm on the right track...
/Andreas

On 2017-09-22 12:13, Robert Osfield wrote:
> Hi Andreas.
>
> On 22 September 2017 at 09:40, Andreas Ekstrand 
> <andreas.ekstrand at remograph.com 
> <mailto:andreas.ekstrand at remograph.com>> wrote:
>
>     I'm using osgText to show vertex numbers. Often enough it's only
>     0,1,2 for triangles but it can be several hundred thousands of them.
>
>     It's never been optimal, I know - and I guess this is the time to
>     do something about it, I will look into an alternative way without
>     osgText. Any suggestions are welcome!
>
>
> On the OSG side I steadily shifting osgText to using shaders for 
> effects and simplifying the CPU side.  Not all the way there yet but 
> that's the direction I'm going with it.  Simplifying the CPU side will 
> mean less custom data manipulation that is different frrom 
> osg::Geometry that just pushes arrays and primitives to GL.  With 
> these evolution of osgText the overhead for creating new text should 
> be lower.
>
> However, osgText it will always be a general purpose text 
> implementation rather than a highly tuned for a specific purpose.  In 
> your case it might be simpler to do some specifically your task.  If 
> you have just 0..9 characters and a limited number of characters you 
> start thinking about doing far more on the GPU.
>
> For instance you could use a single textured quad for each label, 
> passing in the characters to render via a uniform array or packed 
> uniforms and have a shader work out what texture coordinates into the 
> glyph texture atlas to use to render each character, then in the 
> fragment shader get the appropriate samples for each character.  I 
> have used this approach on client project to make a very lightweight 
> system for rendering labels, it was a closed source project so not 
> something I can share the implementation, but it does at least show it 
> works.
>
> Another approach you could take is just create your own osg::Geometry 
> and reuse the osgText::Font/osgText::GlyhTexture. In the end basic 
> rendering of text is just texture quads, osgText can be used to 
> provide the texture atlas you need so most of the awkward work is done 
> for you already.
>
> Robert.
>
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20170922/7250eb9c/attachment.htm>


More information about the osg-users mailing list