I’m very new to OpenGL and have been asked to include an option to output an avi file of the animation the program creates. The program is in C (Not C++) and uses GLUT for most of the calls.
In the animation loop, there is a call to
glutPostRedisplay()
.
This call,
glutDisplayFunc(IMAGE)
, uses the IMAGE function below.
This code is in the IMAGE function:
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glShadeModel(GL_SMOOTH);
for (e = 1; e < nels[f]; ++e)
{
glPushMatrix();
glScalef(doub1,doub1,inv10);
glScalef(scalex, scaley, scalez);
glTranslatef(tx,ty,tz);
glTranslatef(inv2,inv2,inv2);
glRotatef(anglez,0,0,1);
glRotatef(angley,0,1,0);
glRotatef(anglex,1,0,0);
glTranslatef(ce3[f][e][0], ce3[f][e][1], ce3[f][e][2]);
glRotatef(qu3[f][e][0], qu3[f][e][1], qu3[f][e][2], qu3[f][e][3]);
glScalef(ax3[f][e][0], ax3[f][e][1], ax3[f][e][2]);
ellmat(r,e,f);
glPolygonMode(GL_FRONT, GL_FILL);
glBegin(GL_QUADS);
amb = 0.7;
for (j = 0; j < nfaces; ++j)
{
illum = doub0;
for (k = 0; k < 3; ++k)
{
illum += r[k][1] * norm[j][k];
}
shade = amb + (doub1 - amb)*illum;
glColor3f(shade * co3[f][e][0], shade * co3[f][e][1], shade * co3[f][e][2]);
for (k = 0; k < 4; ++k)
{
glVertex3f(sph[j][k][0], sph[j][k][1], sph[j][k][2]);
} /* k vertices */
} /* j faces */
//
glEnd();
glPopMatrix();
//
} /* e ellipsoids */
glutSwapBuffers();
glFlush();
I’ve tried looking at the many examples on the web but nothing seems to click with me.
Thanks,
RON C