CS 174 Discussion 2 - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

CS 174 Discussion 2

Description:

Sign and turn in the academic honesty policy: no homework will be graded if you do not do so! ... download and unzip the file glutLibs.zip ... – PowerPoint PPT presentation

Number of Views:135
Avg rating:3.0/5.0
Slides: 21
Provided by: CSU117
Category:
Tags: discussion | unzip

less

Transcript and Presenter's Notes

Title: CS 174 Discussion 2


1
CS 174 Discussion 2
  • TA Gianfranco Doretto

2
Reminders
  • Sign and turn in the academic honesty policy no
    homework will be graded if you do not do so!
  • Let me know your preferred email address (grading
    notification)
  • Forward your email
  • Use the mailing list cs174.1_at_seas.ucla.edu
  • Keep an eye on the class website

3
OpenGL in the Lab
  • For all your labs, you should NOT use any opengl
    or glut functions other than the ones already
    available in the sample program provided
    (opengl.cc)
  • login to NT box
  • click on Xsession ugrad.seas (Solaris) icon on
    the desktop
  • login again (same login name and password)
  • invoke a window manager (choose it from the
    option menu)
  • ftp or copy the skeleton.tar.gz tarball from
    local machine to your UNIX directory

4
OpenGL at Home
  • download and unzip the file glutLibs.zip
  • place the file glut.h in the folder C\Program
    Files\Microsoft Visual Studio\VC98\Include\GL
  • place the file glut.dll in the folder
    C\WINDOWS\system32
  • place the file glut32.dll in the folder
    C\WINDOWS\system32
  • place the file glut.lib in the folder C\Program
    Files\Microsoft Visual Studio\VC98\Lib
  • place the file glut32.lib in the folder
    C\Program Files\Microsoft Visual
    Studio\VC98\Lib

5
UNIX Tutorial
  • Have a look at the FAQ of the class web page

6
Submission guidelines
  • Due 4/25/2002 at 600pm 
  • No partial credit will be given to programs which
    cannot be compiled and tested on ugrad.seas
    (Solaris)
  • submit a tarball source code files, Makefile,
    input script files, README etc.
  • Example your files are located in (HOME)/lab1
  • 1) cd /  
  • 2) tar cvf lab1.tar lab1
  • 3) gzip lab1.tar
  • 4) submit cs174 lab1.tar.gz 
  • After you hit the return key, a statement like
    "submission successful" will be printed on the
    screen

7
README file
  • submit a README file with each lab, only if you
    are doing the extra credit stuff, or if you are
    doing something different from what is mentioned
    in the lab description handout.  Also, mention
    what assumptions you have made to get your lab
    running.
  • Your name appeared in UCLA record,
  • Your student ID,
  • Your preferred email address
  • Your seas login ID,
  • Date and Lab number.

8
Surce files
  • In particular, you must put down the following
    information at the top of each program file.
  • Your name appeared in UCLA record
  • Your student ID
  • Your preferred email address
  • Your seas login ID
  • Date and Lab number

9
Makefile
  • In case your makefile gives an error while
    compiling, try the following command from the
    command line (everything on one line) 
  • g -I/usr/local/glut-3.7b/include -I/usr/include
    -I/usr/local/gcc-2.95.2/include/g-3 -I./
    -L/usr/local/glut-3.7b/lib/glut
    -L/usr/lpp/OpenGL/lib -L/lib -L/usr/lib -lGLw
    -lGLU -lGL -lglut -lXm -lXt -lXext -lX11 -lXmu
    -lm -o opengl opengl.cc

10
What does the sample program do?
  • It starts up a window of size 400x300, and clears
    it.
  • Press the left mouse button ? a dot is plotted
  • Release the left button ? another dot is plotted
  • Press the right or the middle mouse button, a
    message is printed out
  • k-q exits the program
  • Bring up a larger or smaller window (opengl 500
    500" will bring up a window of size 500x500)

11
k-L (20)
  • Puts in line drawing mode. A line should be drawn
    between every two consecutive points you
    left-click on the window
  • Midpoint algorithm works for slopes between 0 and
    1
  • Generalizing the algorithm is your job!

12
k-P (30)
  • Puts in polygon drawing mode
  • A line should be drawn between the current
    (left-clicked) point and previous (left-clicked)
    point. End the sequence of points using the
    right-click. Complete the polygon by drawing a
    line between the last point and the first point

13
k-C (10)
  • Clear the window

14
k-Q (10)
  • close the window and quit the program

15
Any other keys (10)
  • print out an appropriate message, notifying the
    user of the invalid key

16
Moving/rise window (20)
  • Your program should be able to handle lowering
    and raising of the drawing window. Basically,
    redraw the contents of the window whenever you
    raise or move your window
  • You do not need to use dynamic data structures to
    store an indefinite number of objects (such as
    points, line, circles, polygons, etc.)
  • If you want to add some more credits you can
    handle also the reshaping using the
    glutReshapeFunc() (look at the code posted on the
    web for an example that use this function)

17
Moving/rise window (20)
  • For the purposes of refreshing your screen
    (during redraw, etc.), you will need to store
    information about the lines, polygons, and
    circles.
  • Assume an upper limit to each of these
  • max of lines 100
  • max of polygons 100
  • max of lines per polygons 25
  • max of circles 100

18
Extra credit k-F (10)
  • Fill the polygon with RED color

19
Extra credit Circle drawing (10)
  • Add circle drawing functionality to your program
  • Mark the center of the circle with a
    middle-click, then drag the mouse (holding the
    middle mouse button down), and release the middle
    mouse button, when you reach the size (radius) of
    the circle.

20
Demo
  • Skeleton
  • Example 1
  • Example 2
  • Example 3
Write a Comment
User Comments (0)
About PowerShow.com