<- previous index next ->
Each student needs to choose an operating system to which they have access. UMBC makes available computers running Microsoft Windows XP, Linux, Solaris, IRIX, MacOS and several others. Students may configure and use their personal computers. UMBC offers economical software through my.umbc.edu "business". The "windowing" system is chosen by default from the operating system choice. MS Windows, X windows or Macintosh. In the chosen operating system, the student should choose a programming language, "C", C++, Java, or other that has available OpenGL. Start by using a UMBC machine and getting sample files From any computer on the Internet that has "ssh" available ssh -X linux.gl.umbc.edu (then enter your UMBC username and password) Starter files may be copied to your subdirectory on GL using commands such as (be sure to type the last space-dot): cp /afs/umbc.edu/users/s/q/squire/pub/download/w1.c . cp /afs/umbc.edu/users/s/q/squire/pub/download/w1gl.c . cp /afs/umbc.edu/users/s/q/squire/pub/download/W1frame.java . cp /afs/umbc.edu/users/s/q/squire/pub/download/W1app.java . cp /afs/umbc.edu/users/s/q/squire/pub/download/W1app.html . cp /afs/umbc.edu/users/s/q/squire/pub/download/Makefile1.linux . type make -f Makefile1.linux make -f Makefile1.linux java The java program runs upon typing the second command. Type w1 to run the basic X Windows program. Type w1gl to run the OpenGL program. Now, on a UMBC lab machine running MS Windows 2000, there is a lot more setup required. Here are the steps I needed to be able to use OpenGL with Glut. (do NOT type the (stuff) ) (J: may be S:) log on (I was in J:\umbc.edu\users\s\q\squire\home, you will be in your /afs directory) md cs437 (a special directory for this course) cd cs437 (be there) md GL (needed for GLUT) cd GL (be there) copy J:\umbc.edu\users\s\q\squire\pub\download\glut.h cd .. (you are back in cs437) copy J:\umbc.edu\users\s\q\squire\pub\download\glut32.lib copy J:\umbc.edu\users\s\q\squire\pub\download\glut32.dll copy J:\umbc.edu\users\s\q\squire\pub\download\w1gl.c copy J:\umbc.edu\users\s\q\squire\pub\download\cl_setup.bat cl_setup (you are running the .bat file) cl /GX /ML /I. w1gl.c w1gl Follow this link to Solve Setup Problems, Unix-Linux Follow this link to Solve Setup Problems, Microsoft
Do not expect you system to be set up for GUI programming. You are now into the expert programmer realm. You must be able to find out how your specific computer is configured. Use the command printenv | more to see your environment. Specifically look at some environment variables: echo $PATH # direct access to executable programs echo $INCLUDE # direct access to include files echo $LIB # direct access to linking libraries You can modify environment variables for your use using: set LIB=$LIB;/your-directory-path export LIB On some systems, X Windows and Motif may not be installed in default directories. For these, use find /usr -name Xm.h -print to get the include directory, CFLAGS= -I<path to directory> CFLAGS= -I/usr/X11R6/include Use find /usr -name libXm\* -print to get the link directory, LIBX= -L<path to directory> LIBX= -L/usr/X11R6/lib -lXm -lXt -lXi -lX11 -lm Then use expanded compile and link command in the Makefile tab gcc -o w1 $(CFLAGS) w1.c $(LIBS) To get X windows manual pages, you may need, in your .bashrc file set MANPATH=/usr/local/man:/usr/X11R6/man export MANPATH or in your .cshrc file setenv MANPATH /usr/local/man:/usr/X11R6/man OpenGL use requires access to the file GL/gl.h and libgl.so or libgl.a For gl.h, use find /usr -name gl.h -print to get the include directory, CFLAGS= -I<path to directory> (do not keep the trailing "/GL" in the "path to directory") CFLAGS= -I/web/www/help/C++/opengl/glut-3.7/include For libgl, use find /usr -name libgl\* -print to get the link directory, LIBGL= -L<path to directory> LIBGL= -L/usr/lib -lGLw -lGL glut use requires access to the file GL/glut.h and libglut.so or libglut.a For glut.h, use find /usr -name glut.h -print to get the include directory, CFLAGS= -I<path to directory> (do not keep the trailing "/GL" in the "path to directory") For libglut, use find /usr -name libglut\* -print to get the link directory, LIBGL= -L<path to directory> LIBGL= -L/usr/lib -lGLw -lGL -lGLU There may be systems where links may be missing in /usr/lib On one system, it was necessary, to specifically include the ".so" file LIBGL= /usr/lib/libglut.so.3 -lGLw -lGL -lGLU Combine library information using: LIBS=$(LIBGL) $(LIBX) Then compile using: gcc -o w1 $(CFLAGS) w1.c $(LIBS) You may want to use the Perl Script below to set up a UMBC lab computer running Linux to have a friendly environment: Be in a UMBC computer lab, booted up in Linux. Be in your cs437 directory. ssh linux.gl.umbc.edu # log in, cd to your cs437 directory # do above to get w1.c, w2gl.c, Makefile1 cp /afs/umbc.edu/users/s/q/squire/pub/download/oglsetup.pl . ./oglsetup.pl 1 this should set up a directory and links, if successful: ./oglsetup.pl 2 Makefile1 this augments Makefile1 ^D log off linux.gl.umbc.edu back to lab machine make This should compile, without error, w1.c and w1gl.c w1 # run w1 w1gl # run w1gl if it does not work, read the Pearl script
Do not expect you system to be set up for GUI programming. You are now into the expert programmer realm. Use the command set | more to see your environment. Specifically look at some environment variables: echo %PATH% # direct access to executable programs echo %INCLUDE% # direct access to include files echo %LIB% # direct access to linking libraries You can modify environment variables for your use using: set LIB=%LIB%;S:\your-directory-path On some systems, OpenGL and glut may not be installed in default directories. If not, just copy the needed files to the required directories. The assumption is that Microsoft Visual Studio is installed. This is not free software and must be purchased in order to have a C and C++ compiler and associated libraries. The following shows the directories and the necessary files: (uppercase is the same as lowercase on Microsoft) (replace Microsoft Visual Studio\VC98 with Microsoft Visual Studio .NET 2003\VC7\PlatformSDK Microsoft Visual Studio .NET\VC7\PlatformSDK if using Visual Studio .NET) C:\Program Files\Microsoft Visual Studio\VC98\include\GL\gl.h C:\Program Files\Microsoft Visual Studio\VC98\include\GL\glaux.h C:\Program Files\Microsoft Visual Studio\VC98\include\GL\glu.h C:\Program Files\Microsoft Visual Studio\VC98\include\GL\glut.h C:\Program Files\Microsoft Visual Studio\VC98\lib\opengl32.lib C:\Program Files\Microsoft Visual Studio\VC98\lib\glu32.lib C:\Program Files\Microsoft Visual Studio\VC98\lib\glaux.lib C:\Program Files\Microsoft Visual Studio\VC98\lib\glut32.lib C:\Windows\System32\opengl32.dll C:\Windows\System32\glu32.dll C:\Windows\System32\glut32.dll If you are not set up for Command Prompt "C" programming, you need to set up Environment Variables Mouse your way to Control Panel on your computer System Advanced Environment Variables You have a choice of "user variables " just for current user or "system variables" apply to all users Check or add: lib ;C:\Program Files\Microsoft Visual Studio\VC98\lib or lib ;C:\Program Files\Microsoft Visual Studio .NET 2003\VC7 \platformSDK\lib include ;C:\Program Files\Microsoft Visual Studio\VC98\include or include ;C:\Program Files\Microsoft Visual Studio .NET 2003\VC7 \platformSDK\include path ;C:\Program Files\Microsoft Visual Studio\VC98\bin or path ;C:\Program Files\Microsoft Visual Studio\VC7\bin (Concatenate, separating them by a semicolon, ;) To set your environment variable on GL for a UMBC lab machine: Right click on "my computer" click on properties, advanced, environment variables. Note: There may be a \Microsoft Visual Studio .net\ (no 2003 ) To find missing or misplaced .dll files cd \ dir /s mspdb71.dll (this is an example, probably not found) Then copy the misplaced .dll to \windows\system32 (it is safe to add .dll files to \windows\system32 but suggest not overwrite) Now use a Command Prompt window to compile cl /GX /ML w1gl.c Then execute the program w1gl You may use "nmake" on Microsoft, similar but not quite the same as "make" or "gmake" on Unix-Linux Note: When in command prompt window, the two commands: cd \ dir /s opengl32.lib will tell you if you have OpenGL and where the "lib" is dir /s cl.exe will tell you the "path" to the compiler dir /s gl.h will tell you where its "include" directory is. You will probably have to add glut.h in directory with gl.h You will probably have to add glut32.lib in directory with opengl32.lib You will probably have to add glut32.dll in \windows\system32 Setup is a one time effort per machine per operating system. Windows XP commands are command.help Microsoft C and C++ compiler options are cl.help Remember: Microsoft came after Unix and copied much. Unix command line works in Microsoft command window prog < data redirection of file 'data' to stdin prog > reslt redirection of stdout to file 'reslt' prog | more pipe output through 'more' same as Unix prog -help often both /option and -option are allowed "root" and directories are forward slash on Unix "root" and directories are backward slash on Microsoft some tools accept both "/" and "\" on Microsoft, WWW, FTP, etc. Microsoft 'nmake' much line Unix 'make' or 'gmake' "C", "C++", Java, etc languages same on both. Microsoft is case insensitive file system, thus use all lower case in programs for compatibility. e.g. #include <stdio.h> /* include path */ #include "your.h" /* local directory */ fopen("my_file.stuff", "r"); Both take long file names. No more 8.3 restriction. Both allow spaces but save the headache, use underscore, _. Both use environment variables and substitution in scripts. Know and use tools to help yourself be efficient. You many wish to keep old versions of programs (renamed or in separate directories) and use 'diff' on Unix, 'fc' on MS Windows to find the DIFFerences using a File Compare tool.
<- previous index next ->