Presentation is loading. Please wait.

Presentation is loading. Please wait.

Gianfranco Doretto April 19, 2002 1 CS 174 Discussion 2 TA Gianfranco Doretto.

Similar presentations


Presentation on theme: "Gianfranco Doretto April 19, 2002 1 CS 174 Discussion 2 TA Gianfranco Doretto."— Presentation transcript:

1 Gianfranco Doretto April 19, 2002 1 CS 174 Discussion 2 TA Gianfranco Doretto

2 Gianfranco Doretto April 19, 2002 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@seas.ucla.educs174.1@seas.ucla.edu Keep an eye on the class website

3 Gianfranco Doretto April 19, 2002 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) 1. login to NT box 2. click on “Xsession ugrad.seas” (Solaris) icon on the desktop 3. login again (same login name and password) 4. invoke a window manager (choose it from the option menu) 5. ftp or copy the skeleton.tar.gz tarball from local machine to your UNIX directory

4 Gianfranco Doretto April 19, 2002 4 OpenGL at Home download and unzip the file glutLibs.zipglutLibs.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 Gianfranco Doretto April 19, 2002 5 UNIX Tutorial Have a look at the FAQ of the class web page

6 Gianfranco Doretto April 19, 2002 6 Submission guidelines Due: 4/25/2002 at 6:00pm 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 Gianfranco Doretto April 19, 2002 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.README 1. Your name appeared in UCLA record, 2. Your student ID, 3. Your preferred email address 4. Your seas login ID, 5. Date and Lab number.

8 Gianfranco Doretto April 19, 2002 8 Surce files In particular, you must put down the following information at the top of each program file. 1. Your name appeared in UCLA record 2. Your student ID 3. Your preferred email address 4. Your seas login ID 5. Date and Lab number

9 Gianfranco Doretto April 19, 2002 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 Gianfranco Doretto April 19, 2002 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 Gianfranco Doretto April 19, 2002 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 Gianfranco Doretto April 19, 2002 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 Gianfranco Doretto April 19, 2002 13 k-C (10%) Clear the window

14 Gianfranco Doretto April 19, 2002 14 k-Q (10%) close the window and quit the program

15 Gianfranco Doretto April 19, 2002 15 Any other keys (10%) print out an appropriate message, notifying the user of the invalid key

16 Gianfranco Doretto April 19, 2002 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 Gianfranco Doretto April 19, 2002 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 Gianfranco Doretto April 19, 2002 18 Extra credit k-F (10%) Fill the polygon with RED color

19 Gianfranco Doretto April 19, 2002 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 Gianfranco Doretto April 19, 2002 20 Demo Skeleton Example 1 Example 2 Example 3


Download ppt "Gianfranco Doretto April 19, 2002 1 CS 174 Discussion 2 TA Gianfranco Doretto."

Similar presentations


Ads by Google