Hi Bjarn,
On Sun, Mar 1, 2009 at 4:13 PM, Björn Giesler wrote:
> I'm writing a textured model to a .osg file, referencing a jpg file as the
> texture. In my program, this renders perfectly, but when I open the resulting
> file with osgviewer, the texture is upside-down. I've tried experimenting
> with osg::Image::setOrigin(), but that doesn't change anything.
>
> Can someone tell me what I'm doing wrong?
Which way up the image will be when textured onto a geometry is down
to the texture coordinates on the geometry. The OSG's itself stikes
to OpenGL conventions which has the origin at the lower left by
default, while most image formats include jpeg have an origin at the
top left, because of this difference the OSG image plugins typically
do a flip to make sure the image data is the same way round to the
imagery.
For moving data on typically doesn't want to do this flip as it's
expensive to do for every new movie frame, so instead we use the
Image::set/getOrigin() to help tell the app which way up the image is
and to adjust the tex coords to handle this.
In your case I can't really say what exactly is happening - I don't
know how you've loaded the jpg file, I don't know how you've set up
your scene graph...
Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org