Scientific Visualization
Scientific Visualization
Aiichiro Nakano
Collaboratory for Advanced Computing & Simulations
Dept. of Computer Science, Dept. of Physics & Astronomy,
Dept. of Chemical Engineering & Materials Science,
Department of Biological Sciences
University of Southern California
Email: [email protected]
Do it on your laptop!
http://web.eecs.umich.edu/~sugih/courses/eecs487/glut-howto
OpenGL Programming Basics
#include <OpenGL/gl.h> // Header File For The OpenGL32 Library!
#include <OpenGL/glu.h> // Header File For The GLu32 Library!
#include <GLUT/glut.h> // Header File For The GLut Library!
glutInit(&argc, argv);!
glColor3f(r,g,b);!
View Frustum
€
void display() { !
...!
drawScene(); !
glutSwapBuffers();!
}!
Immersive & Interactive Visualization
ImmersaDesk!
at CACS!
CAVE!
• Stereographics
• Tracking system
• Wand: 3D (6 degrees-of-freedom)
mouse
Origin: Sutherland (1968)
Now: Consumer VR Year 1
GLUquadricObj *sphereObj;!
void init_gl(void) {!
float redMaterial[] = { 1, 0, 0, 1 };!
glEnable(GL_LIGHT0);!
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, redMaterial);!
sphereObj = gluNewQuadric();!
}!
void draw_ball(void) {!
glClearColor(0., 0., 0., 0.);!
glClear(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);!
glEnable(GL_LIGHTING);!
glPushMatrix();!
glTranslatef(0.0, 4.0, -4.0);!
gluSphere(sphereObj, 1.0, 8, 8);!
glPopMatrix();!
glDisable(GL_LIGHTING);!
}!
main(int argc,char **argv) {!
CAVEConfigure(&argc,argv,NULL); /* Initialize the CAVE */!
CAVEInit();!
CAVEInitApplication(init_gl,0); /* Pointer to the GL initialization function */!
CAVEDisplay(draw_ball,0); /* Pointer to the drawing function */!
while (!CAVEgetbutton(CAVE_ESCKEY)) /* Wait for the escape key to be hit */!
!sginap(10); /* Nap so that this busy loop doesn't waste CPU time */!
CAVEExit(); /* Clean up & exit */!
}!
http://cacs.usc.edu/education/cs653.html → ball.c