Cs 174 discussion 2
Download
1 / 20

CS 174 Discussion 2 - PowerPoint PPT Presentation


  • 60 Views
  • Uploaded on

CS 174 Discussion 2. TA Gianfranco Doretto. 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 [email protected]

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' CS 174 Discussion 2' - bailey


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Cs 174 discussion 2

CS 174 Discussion 2

TA Gianfranco Doretto

Gianfranco Doretto April 19, 2002


Reminders
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 [email protected]

  • Keep an eye on the class website

Gianfranco Doretto April 19, 2002


Opengl in the lab
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

Gianfranco Doretto April 19, 2002


Opengl at home
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

Gianfranco Doretto April 19, 2002


Unix tutorial
UNIX Tutorial

  • Have a look at the FAQ of the class web page

Gianfranco Doretto April 19, 2002


Submission guidelines
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

Gianfranco Doretto April 19, 2002


Readme file
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.

Gianfranco Doretto April 19, 2002


Surce files
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

Gianfranco Doretto April 19, 2002


Makefile
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

Gianfranco Doretto April 19, 2002


What does the sample program do
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)

Gianfranco Doretto April 19, 2002


K l 20
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!

Gianfranco Doretto April 19, 2002


K p 30
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

Gianfranco Doretto April 19, 2002


K c 10
k-C (10%)

  • Clear the window

Gianfranco Doretto April 19, 2002


K q 10
k-Q (10%)

  • close the window and quit the program

Gianfranco Doretto April 19, 2002


Any other keys 10
Any other keys (10%)

  • print out an appropriate message, notifying the user of the invalid key

Gianfranco Doretto April 19, 2002


Moving rise window 20
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)

Gianfranco Doretto April 19, 2002


Moving rise window 201
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

Gianfranco Doretto April 19, 2002


Extra credit k f 10
Extra credit k-F (10%)

  • Fill the polygon with RED color

Gianfranco Doretto April 19, 2002


Extra credit circle drawing 10
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.

Gianfranco Doretto April 19, 2002


Demo

  • Skeleton

  • Example 1

  • Example 2

  • Example 3

Gianfranco Doretto April 19, 2002


ad