ITCS 6120-8120 Fall 2009 - Project 1 - University of North ...

erectboboSoftware and s/w Development

Dec 14, 2013 (3 years and 10 months ago)

97 views

Project
1
:
OpenGL

and
GLUT

101


ITCS
6120
Computer Graphics

Fall
200
9

Professor Zachary Wartell


Revision:
12/14/2013 5:25:36 AM


Copyright August 2006, Zachary Wartell @ University of North Carolina a
t Charlotte

All Rights Reserved.



Due Date:

Wednesday

September

23
, 11:59PM

1.

Purpose


The project
involves some
2D
OpenGL programming

and using the
GLUT

library
to
provide handling of input events

and
simple
GUI components
.

2.

Prerequisite Reading


The cl
ass website discusses several resources for these toolkits.
Most of t
he OpenGL
commands needed for this assignment all come from the
first
three
chapters of the
textbook. Additionally,
you should use
OpenGL
Redbook and GLUT documentation
linked from th
e class webpage.


3.

“OpenGL

and
GLUT

101



Use SVN to checkout your SVN repository directory (see and read
SVN for Wartells

Courses.doc
).
Henceforth this document assumes you svn checkout’ed your SVN
repository directory to working copy directory called "
ITCS x120
".


3.1.

Compilation Process


For this project you must have installed the following tools:




CMake (
www.cmake.org

)



The command
-
line version of SVN


For this project you will use the following third party libraries:



OpenGL


(usually automatically available on modern OS’s)



GLUT


(see below)



GLEW


(see below)

To compile the projects,

ITCSx120
example code, etc.
you
must
first run cmake from
your
OS’s
command shell.
Cmake
generates the
native
build scripts for your chosen
operating system and compiler
.

T
he
cmake

G
option

determines which native build
scripts to create
.
(
Run cmake wi
thout arguments to get a list of supported generators
)
.


Where possible for all the source code that I distribute in class, I have
added
cmake build
scripts in a subdirectory

called
:



<
xxxx
>
\
make
\
cmake


Executing cmake from this directory should genera
te a new directory:



<
xxxx
>
\
make
\
<
operating system
>
\
<
compiler
>
\


Note, Cmake is not supported by many of the
vendors

who distribute the third party
libraries
(TPL’s) such as GLUT and GLEW that are used in this class.
Rather the TPL’s
contain myriads of different native build scripts for different operating system/compiler
combinations.
Where possible, I have started to add Cmake build scripts to these
vendor’
s source code distributions and
put the modified version
of the TPL’s
source
distribution
under:


svn://linux01.uncc.edu:3690/zwartell
-
public/vendor


(For the curious
,

I follow SVN best
-
practices for
vendor b
ranc
hes
)


The
ITCSx120
source distributions of
the
TPL’s will be
automatically

retrieved for you
when you perform your SVN checkout.

However, currently the
supplementary
ITCSx120
CMake scripts for the TPL’s a
re not capable of
generating native build scripts
for

the TPL’
s on all platforms.
When
you execute
cmake
on the
cmake scripts
,
the script
may
give a message indicating

it cannot generate the native build scripts for your
operating system
. In this case
,
you will have to follow the vendor’s original instructions
for compiling and installing each TPL.

(
Alternatively, you may find precompiled binary
versions of these TPL’s on the web for your particular operating system/compiler/CPU
architecture, etc
. Usi
ng these may require adjusting your projects
Project
X
\
CMakeLists.txt
,

see Item
1.b
)
.


Currently the ITCSx120 cmake scripts for the TPL’s only work on:



Microsoft Windows


3.2.

CMake Script
Requirements for
Y
our
Projects


1.

All your pr
ojects must be accompanied by a three CMake scripts that build

your
program as describe below:


a.

Project
X
\
make
\
cmake
\
CMakeLists.txt


This
is
file
on which
you run cmake.
You will
probably
not modify this file
much.

This file
just recursively
calls the
c
make
files below.
For
examples
,
see

"
ITCS x120
\
Examples
.
"




b.

Project
X
\
CMakeLists.txt


This file does all the
real
work.

You will augment

and modify

this file when:

i.

You a
dd source files to your project

ii.

You n
eed to
add additional
link or include search
paths for the TPL’s
because
the ITCSx120 supplementary TPL cmake files do no
t

support
your OS/compiler.


c.

Project
X
\
make
\
cmake
\
zjw library.cmake


This
file is part of the ITCSx120 cmake build mechanism.

You need
not

modify this file.
But it
must

be prese
nt.
The recommended way to
retrieve
this file is to set an SVN
svn:externals

property
on
your directory,
Project
X
\
make
\
cmake
,

in order
to
svn
link to the lates
t version of "
zjw
library.cmake."
(
Simply copying the file will make your keeping it
update to date more
difficult!
) T
he svn command
-
line approach is:









TortoiseSVN can also be used to set SVN properties.


Note, for Project 1 I already did this for

you. But for some future Projects
you may have to do it yourself.


3.3.

Skeleton Code


Skeleton code for
P
roject
1
is found in the
"
ITCS x120
\
Project 1"
.
You must
add all your additional code to this subdirectory adding any additional files or directories

you feel is necessary. You will submit your project
through
by svn add
’ing

and svn
commit’ing the files.

To generate the native build script run cmake on:


ITCS x120
\
Project 1
\
make
\
cmake


>
cd
Project X
\
make
\

>
svn
propset svn:externals

^/
ZJW
%20
Library/trunk/make/cmake/zjw
%20
library.cm
ake

'zjw
library.cmake'
"

cmake

> svn update cmake

> svn commit

m "
-
added svn:externals"

cmake


For non
-
Windows platforms, you will probably also have to manuall
y compile GLUT
and GLEW and adjust
Project
1
\
CMakeLists.txt
.


Additionally,
examine
the subdirectory
:


ITCS x120
\
Third Party Libraries
\
OpenGLTrainer
\
Tools and
Examples
\
OpenGL and GLUT


101


This subdirectory is an example program that extends the above sk
eleton code to partially
implement some of the objectives of Project 1. You must do something completely
different than in this example program to get any credit for this Project 1, but some
student
s

find it

useful to look at such an example program.

Als
o, this example does
not

satisfy the requirements of this assignment.

Again, first run cmake from:


ITCS x120
\
Third Party Libraries
\
OpenGLTrainer
\
Tools and
Examples
\
OpenGL and GLUT


101
\
make
\
cmake



3.4.

Project 1
Requirements


For Project 1 your program mu
st do the following:



1.

Draw with at least
4

different types of OpenGL
2D
primitives (GL_LINES,
GL_TRIANGLES, etc.)

using glBegin/glEnd.

2.

Draw something with
glDrawPixels
.

3.

Respond to
some type of mouse
motion
input
and mouse button input. This
response mus
t
in some way effec
ts the
drawn
2D graphics.

4.

R
espond to at least 3 keystrokes in some way
.

5.

Draw
some continuously animated
object using double buffering.


6.

Be creative! 20 points (out of 100) of the project grade will be based on the
creativity of your p
roject.


You will have to use additional GLUT callback functions beyond those demon
strated in
the skeleton code.

3.5.

Recommendations




You should generally leave in place the calls in the skeleton code to functions from
ITCS4120::OpenGLTrainer. These
OpenGLTr
ainer functions
perform some
additional GLUT and OpenGL

setup steps whose underlying theoretical

concepts
will
be
covered
later
in the course.

For instance,
ITCS4120::OpenGLTrainer
calls
sets up
the world to screen transform
s

so that drawing a
2D point
at

coordinate (x,y) will
draw to th
e pi
xel (x,y) within the window. Note, this

OpenGLTrainer
setup arranges
for

(0,0)
to be
the lower
-
left corner

of the window
.

(The documentation of
OpenGLTrainer is found in
ITCS x120
\
Third Party Libraries
\
OpenGL
Trainer
\
README.html
, but for Project 1 you
probably do not need to read it
).




The standard vendor GLUT source code distribution contains hundreds of examples
including all code from the Redbook. You will have to follow the vendor’s
instructions for compiling thes
e for your OS/compiler.

To repeat, your SVN
checkout will retrieve a this TPL’s source code distribution into:



ITCS x120
\
Third Party Libraries
\
glut


4.

Hand
-
in Directions


You must use SVN to submit your projects

and follow

the standard policies f
or this
course
.
These policies are covered in
Section
Submitting Your Projects

in

SVN for
Wartells Courses.doc
.