Assignment 1 Frequently Asked Questions (FAQ)

Q. Is there a demo program?

A. Yes. It is located in /usr/class/cs248/assignments/assignment1/demo
This should help answer most questions about the look and feel about the basic assignment.

Q. I'm getting this error when I run 'make': don't know how to make %.cpp (bu42).

A. Make sure /usr/pubsw/bin comes before /usr/bin in your PATH so that you run /usr/pubsw/bin/make.

Q. How do I draw a circle?

A. Try approximating it with an N-sided polygon, for your favorite value of N. If you're feeling adventurous, try looking at gluDisk.

Q. How come the !@$#%^ gluDisk() routine doesn't let me say where the center of the circle is??

A. gluDisk() draws its circles at the origin. You should change the origin of the coordinate system to be wherever you want the circle to draw.

Q. Great. So how do I set the origin of the coordinate system?

A. Read the OpenGL book.

Q. What's alpha, and how do I set it?

A. As said in lecture, alpha is the level of transparency used for drawing a primitive. OpenGL just calls it the fourth component of the color (red, green, blue, alpha). See the book for information on how to use it.

Q. I read the book, and I still can't get anything but opaque primitives. What's up with that?

A. You probably forgot to enable blending. See the OpenGL book.

Q. I don't understand the "orientation" part of the assignment.

A. First, note that circles do not have to be oriented (because they're symmetric). As for rectangles, the assignment requires three ways to orient them:

Lines also require three different types of orientation:
Q. Can I add a file other than image.cpp or imgpaint.cpp?

A. No. We use our own makefiles to build your submission. You should do all your work in the two files provided.

Q. What if the window is resized?

A. See the demo program.

Q. I can't figure out how to clip my primitives to the image when the window is resized like the demo does.

A. Don't worry about that -- it's OK to have your brush strokes "hang over" the sides of the image if the window has been resized.

Q. What if the painting window is covered by another window and then uncovered?

A. The framework automatically draws workImg whenever the window needs to be redrawn in its entirety . So you should call workImg->GrabScreen() whenever you think it's appropriate to save the contents of the screen.

This solution breaks down when you grab the screen while the window is partially covered (i.e., if you're drawing into the window while it's not in front). For extra credit, try saving a list of strokes, and playing them back in the Display routine, rather than just saving pixels.

Q. When I drag the mouse, it doesn't immediately draw the shapes that my OpenGL commands tell it to. Instead, they're drawn later, after I click the mouse in other places. Why does SGI forsake me so?

A. You need to call glFlush() after issuing a set of OpenGL commands to ensure that they are all handed to the graphics hardware for drawing. Otherwise, they may sit in buffers for a long time, waiting for more commands to come in before they are issued.

Q. How big is each brush size, and what exactly does it control?

A. Whatever you think is reasonable.

Q. How do I draw into the work image?

A. You can't. Draw onto the screen and grab the pixels using workImg->GrabScreen(). If you have some super duper funky thing that needs to set individual pixels in the work image, you can modify the Image class any way you want. But this is not necessary to do the assignment.

Q. Should I compute the vertex coordinates of the rotated rectangles/lines myself? What's the math to do that?

A. The math to do that involves some trigonometry we haven't learned about yet. You should use the OpenGL matrix modification routines like glRotate. No point in computing something yourself when the graphics system will do it for you.

Q. How come the demo draws more than one line when it's not in jitter mode?

A. Because we thought it looked good, and it would take forever to draw an image if you only had one line.

Copyright © 1996-1998 Pat Hanrahan