Hi Justen,

So, I've looked at the tutorials for this, but it doesn't much in depth into 
the texture coordinates and how they work. If someone could help me out, I'd 
much appreciate it.

You seem to have the right idea. I didn't have to change anything in your code (other than the path to the texture, I used "Images/osg256.png" which is found through OSG_FILE_PATH) and it worked.

If it doesn't work for you, put a breakpoint after the osgDB::readImageFile() call and see if the image loaded. If not, that means there's some problem with your plugins. You can set an environment variable called OSG_NOTIFY_LEVEL=DEBUG and OSG will be more verbose about where it searches for its plugins and also where it looks for data files you ask it to load. That will help you debug this.

Now, since you're using vertex indices, and you needed to list the vertices in counter-clockwise order to get the right front-facing, the texture coordinates don't work for half the faces (the texture is warped). I would suggest listing the vertices of each face directly (you can use triangle strips to get less data, though for a simple cube it won't matter much.

As for having a different texture on each face, you can do that in different ways: either have one texture that has all faces unwrapped, and set up the texcoords to use the right portion of the texture for each face, or have different textures in each texture unit as you were going to do.

In general this is work that is much easier to do in a 3D modeling software. There is little reason to go making geometry (especially with complex texture mapping) through code, it's much easier to do it visually and it just becomes data you can replace more easily than having to modify an algorithm, recompile the code, test it, debug it...

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to