<- previous    index    next ->

CMSC 437 Getting Started


Each student needs to choose an operating
system to which they have access.
Your version of operating system and toolkit may
be very different from examples below.
Ignore anything that does not apply to your system.

UMBC makes available computers running Microsoft Windows,
Linux, Solaris, 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 Unix/Linux operating systems the user has a choice of window
manager and possibly a choice of desktop. There may be a graphical
software development environment available. Students may use any
tools they have learned and like. This course can not hope to
cover all possible development environments. Thus, tested command
line instructions are provided that will work for this course.
Do not expect help from the instructor on other development
environments, they generally have a long learning curve and are
found to be marginally more productive that command line development.

In the chosen operating system, the student
should choose a programming language, "C", C++,
Java, python, or other that has available interface to OpenGL.

You may 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  (older systems)
   ssh -Y linux.gl.umbc.edu  (up to date systems)
   (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/w1tk.py3  .
 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  .

 *** currently on linux.gl.umbc.edu most students also need:
 cp  /afs/umbc.edu/users/s/q/squire/pub/download/libglut.so.3.7  .
 cp  /afs/umbc.edu/users/s/q/squire/pub/download/libXm.so.1  .
 ln -s libglut.so.3.7 libglut.so.3
 ln -s libglut.so.3.7 libglut.so
 cp  /afs/umbc.edu/users/s/q/squire/pub/download/Makefile_w1  .
 mkdir GL
 cd GL
 cp  /afs/umbc.edu/users/s/q/squire/pub/download/glut.h  GL
 setenv LD_LIBRARY_PATH .
 cd ..
 make -f Makefile_w1  w1gl
 *** the above is needed when GLUT and Motif are not installed


 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.

 If you get a message about a missing  .so  file, you also need
        setenv LD_LIBRARY_PATH .
 in order for the ".so" shared object files to be found.



 On the old UMBC lab machine running MS Windows 2000, there was 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:)
 ((Or you may use  WinSCP, it works great for me.))

    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

On Mac OSX you can use Cocoa, the native Mac graphics,
or use "fink" to download X Windows, Motif, possibly OpenGL
if not installed.
   Cocoa will look like
      #import 
      #import "your_stuff.h"
      int main(int argc, char *argv[])
      {
        return NSAapplicationMain(argc,(const char *)argv);
      }

   or use the same command line commands as Linux, SunOS, or
   any version of Unix.

X11 that is X windows (Different from native Mac OSX windows) can be
run on any Mac OSX computer. Here is the Makefile I have used for w1, etc

  # Makefile_mac_w1 for CS437
  # after you have installed X windows, X11
  # e.g. using    /sw/bin/fink install
  # compile anywhere, execute in an X11, xterm

  CC=gcc
  CFLAGS= -I/sw/include -I/usr/X11R6/include
  LIBX= -L/usr/X11R6/lib  -L/sw/lib -lXext -lXm -lXt -lXi -lX11 -lm
  LIBGL= -L/usr/X11R6/lib -L/sw/lib -lGLw -lGL -lGLU -lglut 
  LIBS=$(LIBGL) $(LIBX)

  all: w1 w2 w1gl w2gl

  w1: w1.c
	  $(CC) $(CFLAGS) -o w1 w1.c $(LIBS)

  w2: w2.c
	  $(CC) $(CFLAGS) -o w2 w2.c $(LIBS)

  w1gl: w1gl.c
	  $(CC) $(CFLAGS) -o w1gl w1gl.c $(LIBS)

  w2gl: w2gl.c
	  $(CC) $(CFLAGS) -o w2gl w2gl.c $(LIBS)





 Follow this link to Solve Setup Problems, Unix-Linux

 Follow this link to Solve Setup Problems, Microsoft
 

Solving Setup Problems Unix-Linux

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.txt  .
  mv oglsetup.pl.txt 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

Solving Setup Problems, Microsoft

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
          Microsoft Visual Studio 9.0\VC
  for various versions)

 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

You can get these files, if not on your system, from
 /afs/umbc.edu/users/s/q/squire/pub/download

 basically 7 files  glut32 and opengl32  for   .lib  and   .dll
              and   gl.h  glut.h  glu.h

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 for appropriate version:
      lib       ;C:\Program Files\Microsoft Visual Studio\VC98\lib
      lib       ;C:\Program Files\Microsoft Visual Studio .NET 2003\VC7
                                                       \platformSDK\lib
      lib       ;C:\Program Files\Microsoft Visual Studio 9.0\VC\lib

      include   ;C:\Program Files\Microsoft Visual Studio\VC98\include
      include   ;C:\Program Files\Microsoft Visual Studio .NET 2003\VC7
                                                   \platformSDK\include
      include   ;C:\Program Files\Microsoft Visual Studio 9.0\VC\include

      path      ;C:\Program Files\Microsoft Visual Studio\VC98\bin
      path      ;C:\Program Files\Microsoft Visual Studio\VC7\bin
      path      ;C:\Program Files\Microsoft Visual Studio 9.0\VC\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)
  dir /s mspdb80.dll   (for visual studio 9.0)

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
         or in working directory

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 ->

Other links

Many web sites on Java GUI, AWT, Swing, etc.
Many web sites on Python wx, tk, qt, etc.

Go to top