Download Lecture Slides on OpenGL Tutorial - Computer Graphics | CISC 640 and more Study notes Computer Graphics in PDF only on Docsity!
CISC640/440 OpenGL Tutorial
OpenGL Tutorial
CISC 640/440 Computer Graphics
TA: Qi Li/Mani Thomas
CISC640/440 OpenGL Tutorial
Outline
• Submission policy• OpenGL: Basics and setup• Draw geometry primitives• Transformations in OpenGL• Sample codes• Office hour
CISC640/440 OpenGL Tutorial
How to Submit
•^
Tar/zip file– Unix:
> tar -cf lastname_projectNum.tar projectDir> gzip lastname_projectNum.tar
– Windows:
- get a winzip application (if you don't have)• go the directory storing your assignments• right click your mouse to zip the directory
•^
Submit the tar/zip file through the course web(More details will be announced later)
CISC640/440 OpenGL Tutorial
What to Submit
• Must contain
– readme– Makefile– Source codes– Output figures (if any)
• Must NOT contain
– obj intermediate files– obj data files
CISC640/440 OpenGL Tutorial
What to Submit: Makefile for
EECIS
Makefile for EECIS## uncomment the following line for the C compiler(cc)#CC = cc CC = CCTOP = /usr/local/mesa# list the name of the executable you wish to produceexec = hello## list all your object files separated by spacesobjects = hello.o## list all your header files separated by spaces## includes = lines5.h lines5_2.h
LINKDIR = -L$(TOP)/lib -L/usr/openwin/libINCLUDEDIR = $(TOP)/includeLLDLIBS = -lGL -lglut -lMesaGLU -lMesaGL -lm -lX11 -lXext -lXmu \ -lXt -lXi
$(exec) : $(objects)
$(CC) -o $@ $(LINKDIR) $(objects) $(LLDLIBS) $(objects) : $(includes) $(CC) -c -I$(INCLUDEDIR) $<.PHONY : cleanclean: -rm -f $(objects) $(exec)
CISC640/440 OpenGL Tutorial
What to Submit: Makefile for
Composer
Makefile for Composer/Strauss## uncomment the following line for the C compiler(cc)#CC = cc CC = CCTOP = /home/base/usrb/chandrak/640/OpenGL/Mesa-2.6# list the name of the executable you wish to produceexec = hello## list all your object files separated by spacesobjects = hello.o## list all your header files separated by spaces## includes = lines5.h lines5_2.h
LINKDIR = -L$(TOP)/lib -L/usr/openwin/libINCLUDEDIR = $(TOP)/includeLLDLIBS = -lGL -lglut -lMesaGLU -lMesaGL -lm -lX11 -lXext -lXmu \ -lXt -lXi
$(exec) : $(objects)
$(CC) -o $@ $(LINKDIR) $(objects) $(LLDLIBS) $(objects) : $(includes) $(CC) -c -I$(INCLUDEDIR) $<.PHONY : cleanclean: -rm -f $(objects) $(exec)
CISC640/440 OpenGL Tutorial
Outline
• Submission policy• OpenGL: Basics and setup• Draw geometry primitives• Transformations in OpenGL• Sample codes• Office hour
CISC640/440 OpenGL Tutorial
OpenGL: What is It?
•^
GL
G
raphics
L
ibrary): Library of 2-D, 3-D
drawing primitives and operations– API for 3-D hardware acceleration
•^
GLU
GL U
tilities): Miscellaneous functions
dealing with camera set-up and higher-levelshape descriptions
•^
GLUT
GL U
tility
T
oolkit): Window-system
independent toolkit with numerous utilityfunctions, mostly dealing with user interface
CISC640/440 OpenGL Tutorial
OpenGL: Setup in Windows
•^
Windows/VC++ 6.0–^
Get glut:http://www.xmission.com/~nate/glut.html
An excellent source for the setup of openGLon Windows/VC++ 6.0 is available at•^
http://www.lighthouse3d.com/opengl/glut/index.php
CISC640/440 OpenGL Tutorial
OpenGL: Setup in Windows
•^
Windows (step 1: create new project)
CISC640/440 OpenGL Tutorial
OpenGL: Setup in Windows
•^
Windows (step 3: insert file)
CISC640/440 OpenGL Tutorial
OpenGL: Setup in Windows
•^
Windows (step 4: project setting)
CISC640/440 OpenGL Tutorial
Outline
• Submission policy• OpenGL: Basics and setup• Draw geometry primitives• Transformations in OpenGL• Sample codes• Office hour
CISC640/440 OpenGL Tutorial
OpenGL Geometric Primitives
GL_QUAD_STRIP^ GL_QUAD_STRIP
GL_POLYGONGL_POLYGON
GL_TRIANGLE_STRIPGL_TRIANGLE_STRIP
GL_TRIANGLE_FANGL_TRIANGLE_FAN
GL_POINTSGL_POINTS
GL_LINESGL_LINES
GL_LINE_LOOPGL_LINE_LOOP
GL_LINE_STRIPGL_LINE_STRIP
GL_TRIANGLESGL_TRIANGLES
GL_QUADSGL_QUADS