I have been trying to use textures in Wavefront .obj files and use them with osg. First I had trouble finding some editor/viewer that correctly displays obj files with textures. After I found one, I realized that osg cannot display the textures in models that the other program can. Therefore I believe texture support in the obj plugin of osg is broken.
Here is the obj viewer that can show obj files with correct textures: http://www.xmission.com/~nate/es/statue.zip After you build it and run the executable in statue directory, it displays the data/rose+vase.obj with its texture on the vase. You can use "statue -s file.obj" to see other obj files. When I import rose+vase.obj in my osg program, the vase looks all black. To verify that the problem is not my code, I used osgconv to convert the obj file to an osg file and used osgviewer and the vase was black again. I tracked the problem down to this: only the bottom-leftmost pixel of the texture is used as a texture. Its value is merely multiplied with the material colors of the texture stateset. I realized that the osg file created by osgconv doesn't have any TexCoordArray section. Probably since all texture coordinates are zero, only one pixel on the corner is used. Therefore I think texture coordinates should be created in the obj importer code. By the way, the program here seems to totally ignore the texture in the obj file: http://www.sgi.com/products/software/opengl/examples/more_samples/zip/smooth.zip I wonder if it is because of my video card (Intel 82852/855GM). It would be great if someone can fix this and add the correct texture coordinates (or tell me what I'm doing wrong). Gazihan _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
