PDA

View Full Version : displayers



02-16-2005, 09:09 AM
anyone know of some OpenGL/GLUT source code that can load mesh models and then do various things to them (eg. rotate with mouse, change rendering mode, change lighting etc). Any source that could be examined would be very helpful.

Cheers
OA

iznogoud
02-16-2005, 10:44 AM
Look for "smooth" or something like that... Yes, I
know it might be difficult to search for it, but it is
a small utility that someone had written for visualizing
Alias WaveFront (.obj) files. It includes source code
and can do several nifty things.

I have it, but it is somebody else's code and I would
rather not distribute it, but here are a few lines
from the main code which might help your Googling:



/*
smooth.c
Nate Robins, 1997

Model viewer program. Excercises the glm library.
*/
of course, you will need to make your mesh an .obj
file; this is easy to do. Dump all vertices in a
file in the following format (e.g.):

v 1.000 0.000 0.707

The "v" indicates a vertex and the numbers are the
3D components. Then, dump the triangles or
quadrilaterals as:

f 120 565 234
f 988 765 109 234

It should be easy to write a piece of code for this.