Make animation by OpenGL

I have some files, the file name like these: exp001a exp001b exp001c … exp001i. There are total 10 files.
Each file includes the information for a model in 3 dimensions.
For example the file:
exp001a is the model in 1 sec.
exp001b is the model in 2 sec.

exp001i is the model in 10 sec.

How to make all of these models together as an animation?
So it will be clear to see the movement of the model.
(The model will change location with time)
in my code i use command $ ./scooppic exp001a
where get the 3D model in 1 sec.

Thank you so much.

What is scooppic ? Is that a binary from code you can modify or not ? Is that a glut program or X or … ?

if you don’t have source, somethign like that may be enough :


for i in exp001a exp001b exp001c; do ./scooppic $1; sleep 1; done

Time is not done by opengl, to do that from inside the program, you have to find how to call a timer or something that gives time to trigger rendering of next model.

In short : provide more details please.

Thank you ZbuffeR!
scooppic is write by C programmer.
I have the source code, and can modify myself.
The part of the source code is list below.
If need more details please tell me.


/**************************************************
 * snowpic.c:   make cross-section of snow sample *
 **************************************************/ 
    
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<OpenGL/gl.h>
#include<GLUT/glut.h>
    
#include"visualvar.h"
     
#include"InitVars.c"
#include"ReadInitialFile.c"
#include"ChoosePerspective.c"
#include"DrawObjects.c"
#include"KeyboardFunctions.c"
#include"MouseFunctions.c"
 
static void Idle( void )
 
{
  glutPostRedisplay();

  //  DumpImage(xpixel,ypixel);
}
       

void Display( void )
{
  glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
 
  glMatrixMode( GL_PROJECTION );
  glLoadIdentity();
  glOrtho (left,right,bottom,top,near,far);
   
  glMatrixMode( GL_MODELVIEW );
  glLoadIdentity();
     
  gluLookAt(eyex,eyey,eyez,xview,yview,zview,vupx,vupy,vupz);
 
  glPushMatrix();

  //  DrawBackGround();
  DrawScoop();
  DrawGrains();

  glPopMatrix();
  glutSwapBuffers(); 
} 
              
static void Reshape( int width, int height )
{
  glViewport( 0, 0, width, height );
  glMatrixMode( GL_PROJECTION );
  glLoadIdentity(); 
  glOrtho (left, right, bottom*(GLfloat)height/(GLfloat)width, 
    top*(GLfloat)height/(GLfloat)width,near,far);
}

static void Init( void )
{
  //   GLfloat light_position[] = { -10.0, -10.0, 0.0, 1.0 };
   //   GLfloat lm_ambient[] = { 0.55, 0.55, 0.55, 1.0 };
   GLfloat light_position[] = { 10.0, -10.0, 10.0, 1.0 };
   //   GLfloat lm_ambient[] = { 0.65, 0.65, 0.65, 1.0 };
   GLfloat lm_ambient[] = { 0.3, 0.3, 0.3, 1.0 };

   glLightfv(GL_LIGHT0, GL_POSITION, light_position);
   glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lm_ambient);
    
   glEnable(GL_LIGHTING);
   glEnable(GL_LIGHT0);
   glEnable(GL_DEPTH_TEST);
   //   glShadeModel (GL_FLAT);
   glShadeModel (GL_SMOOTH);
  
   glClearColor(0.8, 0.9, 1.0, 0.1);  
}

int main( int argc, char *argv[] )
{
  strcpy(infile1, argv[1]);
  strcpy(infile2, argv[2]);

  InitVars();

  strcpy(windowname, argv[1]);
  ReadInitialFile();
  ChoosePerspective();

  glutInit( &argc, argv );
  glutInitWindowSize(xpixel,ypixel);
  glutInitWindowPosition(50,50);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH );
  glutCreateWindow(windowname);
  Init();

  glutReshapeFunc( Reshape );
  glutDisplayFunc( Display );
  glutKeyboardFunc(keyboard);
  glutMouseFunc(mouse);

  glutIdleFunc( Idle );

  glutMainLoop();    

  return 0;
}      

Can you give me an example of call a timer or something that gives time to trigger rendering of next model.
Thank you.

Search for “glut timer”, you will get tons of examples.
ie. :
http://www.opengl.org/resources/faq/technical/glut.htm
http://60hz.csse.uwa.edu.au/workshop/workshop0/workshop2.html

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.