home.gif Home  |  Course Outline  |  Lectures  |  Homework  |  Files

HPC II  –  Spring 2002

OpenGL Howto


HOW TO compile and run OpenGL programs:

On nash.ccr.buffalo.edu

To compile and run OpenGL programs like poisson.c on Nash, you need to link the required libraries:
$ cc poisson.c -L/usr/X11R6/lib -lX11 -lXi -lXmu -lglut -lGL -lGLU -lm
$ ./a.out
You can use the following shell script to do this for you:
#!/bin/sh

#----------------------------------------------------------------------
#  Shell script to compile and run OpenGL programs on nash.ccr
#----------------------------------------------------------------------


libraryDirectories="-L/usr/X11R6/lib"
libraries="-lX11 -lXi -lXmu -lglut -lGL -lGLU -lm"

cc "$@" $libraryDirectories $libraries 
./a.out

exit
Save this in a file. Suppose the file name is glrun.sh, then do the following:
$ chmod 0700 glrun.sh
$ ./glrun.sh poisson.c

On UBUnix or Unix.eng Sun workstations

Run your OpenGL animation programs on the local workstation. On UBUnix or Unix.eng, you need to include the Mesa 3D Graphics Library and the Openwin libraries in that order:
#!/bin/sh

#----------------------------------------------------------------------
#  Shell script to compile and run OpenGL programs on unix.eng
#----------------------------------------------------------------------

includeDirectories="-I/util/gnu/Mesa/include -I/usr/openwin/include"
libraryDirectories="-L/util/gnu/Mesa/lib -R/util/gnu/Mesa/lib -L/usr/openwin/lib -R/usr/openwin/lib"
libraries="-lglut -lGLU -lGL -lm"

gcc $includeDirectories "$@" $libraryDirectories $libraries 
./a.out

exit


UB Physics Home Questions or comments: phygons@buffalo.edu
Last updated: Wednesday, 13 March 2002, 19:01:07