Re: [osg-users] Different textures on each face of a geometry?

2010-08-03 Thread Trajce (Nick) Nikolov
Hi Ku,

well, you will only see one side of the face at a time - front or back. So
to not go very complex, you can add cull callback where based on the face
normal you change the texture and the uvs. I think this can work

-Nick


On Mon, Aug 2, 2010 at 1:18 PM, Ku Krapox kukra...@gmail.com wrote:

 Hi Nick,

 If you mean using osg::Geometry::setTexCoordArray, that's what I was doing
 until now, but I can't anymore since I want to put 2 textures on a single
 Geometry AND show different parts of them...

 But if this is not possible without modifying the geometry, I could get by
 with a simple method to put half of an image into a texture, which I'd
 display completely. This seemed easier to me, but I don't know if it is
 doable and how to do it?

 Thanks for any advice!

 Cheers,
 Ku

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





 ___
 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


Re: [osg-users] Different textures on each face of a geometry?

2010-08-02 Thread Ku Krapox
Hi Nick,

If you mean using osg::Geometry::setTexCoordArray, that's what I was doing 
until now, but I can't anymore since I want to put 2 textures on a single 
Geometry AND show different parts of them...

But if this is not possible without modifying the geometry, I could get by with 
a simple method to put half of an image into a texture, which I'd display 
completely. This seemed easier to me, but I don't know if it is doable and how 
to do it?

Thanks for any advice!

Cheers,
Ku

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





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


Re: [osg-users] Different textures on each face of a geometry?

2010-07-30 Thread Robert Osfield
Hi Ku,

You can't assign two textures in quite the way you are looking for,
but your can certainly achieve the results you are looking for, an
even doing by several different ways.

One of the easiest ways ways would be to have one osg::Geometry that
has the planar geometry you want, then have two osg::Geode that you
attach this geometry to.  Then on each of these osg::Geode you assign
a StateSet with the Texture you want.  The final trick to make it all
work is to enable GL_CULL_FACE and swap which face is culled by the
OpenGL triangle rasterization step by using osg::CullFace and assign
one branch to cull the FRONT and the other the BACK.

Robert.

On Fri, Jul 30, 2010 at 1:21 PM, Ku Krapox kukra...@gmail.com wrote:
 Hi all,

 I'm trying to create a simple, planar figure, covered by two rectangular 
 textures, one on each face.
 For now I couldn't find a better way than creating two geometries very close 
 to each other and fill each one with a different texture.

 It looks fine while the geometry doesn't change too much, but if I displace 
 the vertices the two geometries start to overlap which result in an ugly mix 
 of the two textures. And I can't do anything about it because of the complex 
 deformation of my object...

 So I had this idea : is there a way to display different textures on each 
 side of a single geometry? With osg::Geometry::setTexCoordArray maybe??
 If not, I could get by with the normals of my geometries... Is there a way to 
 get the normals of a vertex array, as vectors?

 An if not, how to achieve this simple effect, of a two-sided geometry with 
 different images on each side?... :?

 Thank you!

 Cheers,
 Ku

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





 ___
 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


Re: [osg-users] Different textures on each face of a geometry?

2010-07-30 Thread Ku Krapox
Hi Robert,

Thanks for your reply. :) 
Your solution looks great, I think it'll do the trick!

I have another question : Is there a way to create an osg::Texture2D containing 
only one part of an image, instead of loading the whole image? Typically I want 
to create textures with only one half of an image.

Is this doable? Or is there an easier way to display only one half of an image 
on my geometry, by configuring the StateSet maybe?...

Thanks!

Cheers,
Ku

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





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


Re: [osg-users] Different textures on each face of a geometry?

2010-07-30 Thread Trajce (Nick) Nikolov
you can control the part of the image you want to display thru the uv
coordinates in your geometry

-Nick


On Fri, Jul 30, 2010 at 6:33 PM, Ku Krapox kukra...@gmail.com wrote:

 Hi Robert,

 Thanks for your reply. :)
 Your solution looks great, I think it'll do the trick!

 I have another question : Is there a way to create an osg::Texture2D
 containing only one part of an image, instead of loading the whole image?
 Typically I want to create textures with only one half of an image.

 Is this doable? Or is there an easier way to display only one half of an
 image on my geometry, by configuring the StateSet maybe?...

 Thanks!

 Cheers,
 Ku

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





 ___
 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