HI Alessandro,

If you want to set the max texture size you do it via the
osg::DisplaySettings, this is the class that reads the
OSG_MAX_TEXTURE_SIZE env var and is querred by the texture class.
Before you load your data and run your viewer do:

 osg:DisplaySettings::instance()->setMaxTextureSize(size);

Robert.



On Sat, Jan 10, 2009 at 7:11 PM, alessandro terenzi <[email protected]> wrote:
> Thank you Robert, that was exactly what I was looking for.
> Looking at the source, I noticed that one can avoid using the
> OSG_MAX_TEXTURE_SIZE environment variable by calling the method:
>
> osg::Texture::Extensions::setMaxTextureSize(.)
>
> in order to call it, I need for example a Texture2D object and then call its
> getExtensions(.) method, I just not sure about what parameters I'm supposed
> to pass, so I tried this:
>
> osg::Texture2D::Extensions* extension = texture->getExtensions(0, true);
>
> if(extensions)
>     extension->setMaxTextureSize(64);
>
> (having set to 'true' the second parameter, everything works fine...) but I
> wonder: what value should be passed for the 1st parameter? 0, works, but it
> was just a try...
>
> Thank you again.
> Alessandro
>
> On Sat, Jan 10, 2009 at 5:06 PM, Robert Osfield <[email protected]>
> wrote:
>>
>> Hi Alessandro,
>>
>> You can set the OSG_MAX_TEXTURE_SIZE env var to the max size you want,
>> this will force a rescale of all imagery larger than this when it's
>> download to OpenGL.  This is slow to keep doing at runtime though, the
>> best thing would be to write a pre-processing traversal that rescales
>> all the imagery to a sensible size then save out.  Another thing you
>> do is to use OpenGL texture compression to help reduce memory
>> footprint down on the GPU and in main memory.  Again converting your
>> data once then use this processed model at runtime is the most
>> efficient things to do.  You can use osgconv to help out with this.
>>
>> Robert.
>>
>> On Sat, Jan 10, 2009 at 10:53 AM, alessandro terenzi
>> <[email protected]> wrote:
>> > Experiencing with models prepared by people that do not develop graphics
>> > for
>> > realtime applications, it happens quite often that we have to deal with
>> > models that come with not-power of 2 and/or very big textures.
>> >
>> > This took me to face with 2 problems:
>> >
>> > 1) if rescaling to power of  2 occurs, performances may be not as
>> > desired
>> > 2) memory usage could be very high if many big textures are used
>> >
>> > I wonder if there is a way/hint to force OSG to rescale every texture to
>> > a
>> > chosen max dimension?
>> >
>> > Thank you.
>> > Alessandro
>> > _______________________________________________
>> > osg-users mailing list
>> > [email protected]
>> >
>> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>> >
>> >
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to