moving and rotating vertices

Hi. I've been writing a simple animation program which works by moving different groups of an obj object. Currently I have it putting each group in a display list and then moving it the required amount with glRotate and glTranslate. This has the problem that as parts move, they leave huge gaps.

To get round this problem, I decided to instead load the vertices into an array and when it's time to draw, change the vertex positions and then draw the faces in immediate mode.

I would like to know what the best method for moving these vertices is. Is there a nice, simple way to do it, or am I going to have to learn all that matric stuff and manually implement all the functions? If it is the latter, does anyone have any pointers on how to get started?

I'm not sure what's happening in your code - you might post some of it for us. In any case, transformations can be tricky. You have to do them in the right order and with the appropriate inversions or negations to get the results you expect. It can be kind of counterintuitive.

You should be able to do what you're trying to do through OpenGL without getting into the matrix math yourself - you probably just have something backwards or in the wrong order. If you're serious about it, though, you'll want to get up to speed on that stuff. A fairly good book is '3D Math Primer for graphics and game development', which you should be able to find fairly easily.

If you still haven't solved your problem, post some code and I'm sure it'll get sorted out.

No, I'm certain it's not to do with the order of statements. I want to manually set the position of these vertices. At current, the code uses display lists for each group, and as such looks hideous when moving pieces of it.

The code to do the drawing of this model will probably look something like:

You will almost certainly want to change the doX/doY/doZ groups to a single translation function and an angle/axis (quaternion) rotation function. Also, why do you have 2 sets of translate and rotate calls with identical parameters? (edit: Sorry, I didn't notice one set was for the normals.)

No wait, it isn't. After doing a little testing, I've discovered that it in fact will only tell you of the coordinates in the window (why didn't I just read the whole manual to begin with). From the looks of it I'm just going to have to bite the bullet and learn how to do all the matrix transforms and such by hand. Does anyone know of a good website with tutorials on this nature?

You do get full 3D coordinates out of feedback mode, but they are in window space. You just have to transform them back to world space by setting up an orthogonal projection and applying simple transformations to fix any remaining differences (e.g. the Z value will probably need changing).