Here is a brief walkthrough of setting up opengl with cygwin (at least as of 2007-10-05)
Since we require OpenGL and X11 libraries for development, when installing Cygwin, we need to look under "Graphics", for the OpenGL libraries, and "X11" for the xserver, and also the X11 development libraries
The OpenGL package is the obvious opengl package.
For X11, the xserver is the xorg-x11-xwin package; selecting it selects all the dependencies it requires.
However, you must select the xorg-x11-devel package manually as usually individuals wouldn't need it.
The Windows system (for 2k and XP) has basic OpenGL libraries installed, and with these packages, Cygwin can now
interface with them.
The package will install interfaces for glu, glui, and glut as well, so no need to manually configure those, but
there are differences in the library names
# Define location of OpenGL and GLU libraries along with their lib names
GL_LIBS = -L/lib -lglu32 -lopengl32
# Define location of Glut libraries along with glut lib name
GLUT_LIBS = -L/lib -lglut32
# Define location of GLUI libraries along with glui lib name
GLUI_LIBS = -L/lib -lglui
Note instead of GLU, GL, and glut it's glu32, opengl32, and glut32. The glui library name is the same apparently.
X11 library names are still the same, so no need to change those.
Now, after setting paths to the libraries and includes properly, it would seem compilation should be no problem.
But, only doing these modifications to the provided assignment makefile will have linking errors, and that's due
to the fact that the X11 development libraries and headers places a duplicate set of GL headers which don't match
the provided libraries in the opengl package.
To get around this, just make sure the directory with the proper OpenGL headers comes first in the link list.
In particular, the offending library link is the one for glui; Cygwin's opengl package places headers for glui in the
same place as for glut, gl, etc., but on fissure, it's in the X11R6 include directory.
Here's a modified makefile I made which compiles the A2 starter code on my home windows machine:
############################################################################## # # Sample Makefile for C/C++ applications for the UTSC environment. # Works for single and multiple file programs. # ############################################################################## # Define C compiler CC = gcc # Define C++ compiler CCC = g++ # Define C compiler options CFLAGS = -Wall -c -g # Define C++ compiler options CCCFLAGS = -Wall -ansi -c -g # Define C/C++ pre-processor options CPPFLAGS = -I./ -I$(GLUIDIR)/include -I$(GLDIR)/include -I$(XLIBDIR) # Define location of GLUT directory (/usr/local for UTSC) GLUTDIR = /usr # Define location of OpenGL directory (/usr/local for UTSC) GLDIR = /usr # Note the GLUI directory is in the same as the GL and GLUT directories, # not in the X11R6 directory anymore # Define location of GLUI directory GLUIDIR = /usr # And also note the different library names for the glu, gl, and glut libraries # Define location of OpenGL and GLU libraries along with their lib names GL_LIBS = -L/lib -lglu32 -lopengl32 # Define location of Glut libraries along with glut lib name GLUT_LIBS = -L/lib -lglut32 # Define location of GLUI libraries along with glui lib name GLUI_LIBS = -L/lib -lglui # Define location of the X11 Windows directory (for X11 Windows header files) XLIBDIR = /usr/include # Define location of X Windows libraries, and the X11 library names XLIBS = -L/usr/X11R6/lib -lX11 -lXi -lXmu # Define the location of the destination directory for the executable file DEST = . # Define flags that should be passed to the linker LDFLAGS = # Define libraries to be linked with LIBS = $(GLUI_LIBS) $(GL_LIBS) $(GLUT_LIBS) -lm $(XLIBS) -ldl # Define linker LINKER = g++ # Define all object files to be the same as CPPSRCS but with all the .cpp and .c suffixes replaced with .o OBJ = $(CPPSRCS:.cpp=.o) $(CSRCS:.c=.o) # Define name of target executable PROGRAM = a2 # Define all C source files here CSRCS = # Define all C++ source files here CPPSRCS = a2.cpp textures.cpp ui.cpp ############################################################################## # Define additional rules that make should know about in order to compile our # files. ############################################################################## # Define default rule if Make is run without arguments all : $(PROGRAM) # Define rule for compiling all C++ files %.o : %.cpp $(CCC) $(CCCFLAGS) $(CPPFLAGS) $*.cpp # Define rule for compiling all C files %.o : %.c $(CC) $(CFLAGS) $(CPPFLAGS) $*.c # Define rule for creating executable $(PROGRAM) : $(OBJ) @echo -n "Loading $(PROGRAM) ... " $(LINKER) $(LDFLAGS) $(OBJ) $(LIBS) -o $(PROGRAM) @echo "done" # Define rule to clean up directory by removing all object, temp and core # files along with the executable clean : @rm -f $(OBJ) *~ core $(PROGRAM)