<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Thanks for the suggestions, Robert! I was just investigating such
possibilities, shows I'm on the right track...<br>
/Andreas<font size="2" color="black"><span
style="font-size:0.8em;color:black"></span></font><br>
<font size="2" color="black"><span
style="font-size:0.8em;color:black"></span></font>
<div class="moz-signature"><font size="2" color="black"><span
style="font-size:0.8em;color:black"><br>
</span></font>
</div>
<div class="moz-cite-prefix">On 2017-09-22 12:13, Robert Osfield
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAFN7Y+UFURBgG1mAnRDjPfy6W4u9pctpipy7HdCMdu-PfpxBPA@mail.gmail.com">
<div dir="ltr">Hi Andreas.<br>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 22 September 2017 at 09:40,
Andreas Ekstrand <span dir="ltr"><<a
href="mailto:andreas.ekstrand@remograph.com"
target="_blank" moz-do-not-send="true">andreas.ekstrand@remograph.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">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.<br>
<br>
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!<br>
</div>
</blockquote>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>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. <br>
</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>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.<br>
</div>
<div><br>
</div>
<div>Robert.<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div> </div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
osg-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a>
<a class="moz-txt-link-freetext" href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a>
</pre>
</blockquote>
<br>
</body>
</html>