Hey guys, I'm in need of a little assistance.
 
I've created a model in 3DS and exported it as a Wavefront .OBJ file. I've loaded it up using OSG's file reader. I now need to change the colors of the vertices of the model. The Geometry nodes of the tree don't appear to have Color information, geo->getColors() returns NullFC. I attempt to create them.
 
I have a function that traverses through the tree returned by the file reader. I've created a GeoColors object and for each vertex in the Geometry, accessed through the GeoPositions object returned by the node's Geometry, I added a color to the GeoColors via col->addValue(c). Finally, I tell the Geometry node to use the new color object, geo->setColors(col).
 
This approach worked for a few of my earlier models, but not the later ones. I have no idea why. The first few models I used didn't have normals in the .OBJ file, and while they looked horrendous they still showed colors when rendered.
 
In the newer models, I have normal information in the .OBJ file. Now, it seems no matter what I do, creating color information for geometry does not do anything. The model always renders grey. I've tried several things; creating SimpleMaterial objects and setting glColorMaterial() to different values. Changing/adding material information to the geometry node results in a visible changes to the model, but the information from the Colors object I created and added seems to be ignored. Turning lighting on and off, changing glShadeModel(), do nothing. I've used begin/endEditCP() functions like in the tutorials, but that still doesn't make it work.
 
If anybody can help me out with my problem I'd appreciate it. I need to add color information to vertices in geometry nodes that have been obtained from importing .OBJ files and have it visible when rendering. I have a feeling that there's some gl___() command that I'm not aware of or something tricky having to do with materials or lighting, or perhaps I'm not adding the colors to the geometry correctly. Help?
 
Thanks!
 
.jg

Reply via email to