Re: [osg-users] Render multiple osgText nodes with the same drawcall

2013-03-25 Thread Dirk Langner
Hi Robert,


 GlyphTexture isn't pre-allocated, it's allocated on demand so if a
 Glyph is added to the GlyphTexture is will be used, there shouldn't be
 any unused GlyphTexture.  To avoid using multiple GlyphTexture you can
 hint to use larger GlyphTexture.  see Font::setTextureSizeHint(..)
 method:
 


yes you are right: it is allocated on demand, BUT when you setText again and 
again always containing new glyphs(e.g within traditional chinese language) the 
new glyphs will ALWAYS be added to the glyphTexture, isn't it?

When this is true the glyphTexture will contain unused glyphs, and so a new 
glyphTexture will be generated when the current one is full?!?
So thats the reason for removing unused glyphs

best regards
Dirk

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=52606#52606





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Render multiple osgText nodes with the same drawcall

2013-03-25 Thread Robert Osfield
HI Dirk,

On 12 February 2013 11:31, Dirk Langner dlang...@de.adit-jv.com wrote:
 yes you are right: it is allocated on demand, BUT when you setText again and 
 again always containing new glyphs(e.g within traditional chinese language) 
 the new glyphs will ALWAYS be added to the glyphTexture, isn't it?

There isn't any replacement of the existing glyphs in the texture,
glyphs are only added.


 When this is true the glyphTexture will contain unused glyphs, and so a new 
 glyphTexture will be generated when the current one is full?!?
 So thats the reason for removing unused glyphs

The GlphTexture isn't regenerated, the new glyphs are subloaded to the
existing texture as long as there is room so the cost is kept to a
minimum.


Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Render multiple osgText nodes with the same drawcall

2013-02-12 Thread Robert Osfield
Hi Dirk,

On 6 February 2013 15:08, Dirk Langner dlang...@de.adit-jv.com wrote:
 The space allocated in the texture depends on resolution and on fontsize!
 Currently i'm trying to improve the GlyphTexture by removing unused glyphs 
 from texture and reuse the newly free area to prevent using multiple textures!

GlyphTexture isn't pre-allocated, it's allocated on demand so if a
Glyph is added to the GlyphTexture is will be used, there shouldn't be
any unused GlyphTexture.  To avoid using multiple GlyphTexture you can
hint to use larger GlyphTexture.  see Font::setTextureSizeHint(..)
method:

/** Set the size of texture to create to store the glyph images
when rendering.
  * Note, this doesn't affect already created Texture Glhph's.*/
void setTextureSizeHint(unsigned int width,unsigned int height);


Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Render multiple osgText nodes with the same drawcall

2013-02-11 Thread Dirk Langner
Hi Preet,

i'm currently working on a similar problem(including text drawing along a path) 
and also having thousands of labels. So i would be interested in your solution 
using osg::Geometry


 Also wanted to ask: If I use a fixed font resolution and specify the font 
 texture size can I safely assume I can store 'X' glyphs in the one texture? 
 So with a font resolution of (32,32) and a texture size of (1024,1024) can I 
 expect that at least 1024 glyphs will be packed into the texture before 
 another texture is created? 


The answer is: it depends on :D 

The space allocated in the texture depends on resolution and on fontsize!
Currently i'm trying to improve the GlyphTexture by removing unused glyphs 
from texture and reuse the newly free area to prevent using multiple textures!

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=52436#52436





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Render multiple osgText nodes with the same drawcall

2012-12-28 Thread Sergey Polischuk
Hi my suggestion is not about text, but anyway, if your models contain tristripped geometry, they issue single draw call per primitiveSet (mean for each triangle strip) and they usually not so lenthy at all, about 7-10 vertices on average. With display lists this dont matter, but on gles it can have huge impact on framerate. You can try to run your models through osg optimizer with INDEX_MESH | VERTEX_PRETRANSFORM | VERTEX_POSTTRANSFORM optimization options to make single indexed triangle list per geometry instead of bunch of triangle strips. Cheers. 23.12.2012, 07:54, "Preet" prismatic.proj...@gmail.com:It will probably be more efficient to create a scene graph from osg::Geometry/osg::Texture/osg::StateSet rather than using osgText.  You could use the osgText::Font and associated Textures to help with the texturing side to the rendering.  The osg::Geometry you create you could put as many quads in as you need.I have a couple of questions on using the texture directly rather than using osgText::Text... When grabbing the textures with all the glyphs in it (osgText::Font::getGlyphTextureList), can I safely assume that for one font resolution there will only be one texture for that font? That is will *all* characters which are requested with the same font be handled by one texture? How/when do individual glyphs get added to their collective texture? (I looked through the source code but got a little lost) -- in a small example I tried with just osg::Geometry/Texture as you suggested above, I looked up glyph texture coordinates for a bunch of characters without manually adding any glyphs and it 'just worked'. Do I never need to do anything to ensure the glyphs I need are in the texture or is this taken care of implicitly? Regards,Preet,___osg-users mailing listosg-users@lists.openscenegraph.orghttp://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Render multiple osgText nodes with the same drawcall

2012-12-22 Thread Preet
 It will probably be more efficient to create a scene graph from
 osg::Geometry/osg::Texture/osg::StateSet rather than using osgText.  You
 could use the osgText::Font and associated Textures to help with the
 texturing side to the rendering.  The osg::Geometry you create you could
 put as many quads in as you need.


I have a couple of questions on using the texture directly rather than
using osgText::Text...

When grabbing the textures with all the glyphs in it
(osgText::Font::getGlyphTextureList), can I safely assume that for one font
resolution there will only be one texture for that font? That is will *all*
characters which are requested with the same font be handled by one texture?

How/when do individual glyphs get added to their collective texture? (I
looked through the source code but got a little lost) -- in a small example
I tried with just osg::Geometry/Texture as you suggested above, I looked up
glyph texture coordinates for a bunch of characters without manually adding
any glyphs and it 'just worked'. Do I never need to do anything to ensure
the glyphs I need are in the texture or is this taken care of implicitly?


Regards,

Preet
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Render multiple osgText nodes with the same drawcall

2012-12-14 Thread Robert Osfield
HI Preet,

osgText::Text rendering with a single character per Text will be
inefficient for a cull, draw dispatch and draw GPU bottleneck reasons.

It will probably be more efficient to create a scene graph from
osg::Geometry/osg::Texture/osg::StateSet rather than using osgText.  You
could use the osgText::Font and associated Textures to help with the
texturing side to the rendering.  The osg::Geometry you create you could
put as many quads in as you need.

Robert.

On 14 December 2012 00:39, Preet prismatic.proj...@gmail.com wrote:

 Hiya,

 I'm using OSG on a mobile target (OpenGL ES 2) and my scene runs really
 really slow. I'm trying to optimize it by reducing the number of draw
 calls.

 My scene has a bunch of labels that draw text along a path. Each label
 consists of several osgText nodes that are single characters in length,
 each with their own transform on top. So if a single label is OSG it will
 have three osgText nodes.

 I want to throw all of the label attributes (which I think is just vertex
 and tex coord arrays) into a single VBO, but I'm not really sure how I
 would do that (or even if I could). I'd appreciate any advice.


 Preet

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Render multiple osgText nodes with the same drawcall

2012-12-13 Thread Preet
Hiya,

I'm using OSG on a mobile target (OpenGL ES 2) and my scene runs really
really slow. I'm trying to optimize it by reducing the number of draw
calls.

My scene has a bunch of labels that draw text along a path. Each label
consists of several osgText nodes that are single characters in length,
each with their own transform on top. So if a single label is OSG it will
have three osgText nodes.

I want to throw all of the label attributes (which I think is just vertex
and tex coord arrays) into a single VBO, but I'm not really sure how I
would do that (or even if I could). I'd appreciate any advice.


Preet
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org