Where: Room 1.05 in CSSE
and online (active in consultation hour)
You are expected to complete this lab using the machines provided in one of the CSSE labs. For the online students, we are using Linux (Red hat) on the lab machines (but ubuntu should also be fine on your machines).
cits3003
) to keep all your
work for this unit.
labs-examples.zip
to this directory.
unzip labs-examples.zip
cd cits3003/labs-examples/CHAPTER02_CODE/LINUX_VERSIONS
The command above would change the working directory to the specified directory
name.
In the terminal window, type: ls
. You should see a number of
sample C++ programs (.cpp
files)
and a file with the name Makefile
.
make example1
./example1
example2
(and other examples if you wish). make
commands:
make example1
builds example1
(or other examples similarly) or rebuilds it if any files it depends on have changed, includingexample1.cpp
.make
makes all programs in the current directory from their cpp
files.
make clean
removes various intermediate and backup files.
make clobber
removes the built executables and various intermediate and backup files.
../../Common/InitShader.cpp
).
There's a few ways to do this -- Recommended is
copying the entire labs-examples/CHAPTER02_CODE
directory to labs-examples/lab1
via:
cd ~/cits3003/labs-examples
cp -r CHAPTER02_CODE lab1
cd lab1/LINUX_VERSIONS
make clobber
example1.cpp
to q1circle.cpp
by typing:
cp example1.cpp q1circle.cpp
.
q1circle.cpp
with your favourite Linux editor - if you don't have a favourite yet, just double
click for the default or right click to select one.
q1circle.cpp
file) so
that it generates the same number of points, but when a point is not inside a circle
of radius 1.0 centred at the origin, i.e, (0.0,0.0), it skips it and chooses another point. Hints:
length(p)
will return the distance from
a point p
to the origin.make
, execute and
test it, and verify that produces something similar to the
following.
q2pointsScene.cpp
from example1.cpp
and modify it to implement an
"absolutely minimal scene editor" that simply allows you to directly specify a "scene" of
2D points in the points
array similarly to the way the vertices
array is specified in the original code.
Hint: you really don't need to write any code here, just list the coordinates
that points
is initialized with, and remove the code that previously set the coordinates.
glutInitWindowSize( 256, 256 );
):
(Now all we need is solid shapes, colours, 3D, rotations, camera movement, complex shapes, perspective, lighting, materials, textures and animation. Oh, and editing without having to change the program.)
q3triangleScene.cpp
from example2.cpp
and modify it to implement an
"almost absolutely minimal scene editor" that simply allows you to directly specify a "scene" of
2D triangles in the points
array.
(Now all we need is colours, 3D, rotations, camera movement, complex shapes, perspective, lighting, materials, textures and animation. Oh, and editing without having to change the program.)