No pages like "BendeJesus"!

    BendeJesus

Assignment 1

  • Question 1: In a GLUT program, how is control passed back to the programmer? How is this set up during initialization? Control is passed back to the programmer in the form of the keyboard and mouse. This is accomplished with the glutKeyboard and glutReshape functions. Question 2: What does the parameter to glutInitDisplayMode() specify? The parameter to glutInitDisplayMode() specifies the display mode, whether the display is colored, single, or double-buffered Question 3: What do the calls to glOrtho() and glViewport() accomplish?
    • glOrtho() creates the coordinate system for OpenGL drawings glViewport() designates the window size in which the coordinate system resides

Assignment 2

In order to complete this assignment you'll have to understand the STTransform class. Describe libST's representation of a transform and compare it's flexibility to an alternative representation, such as the 4x4 matrix representation Pat discussed in class. For example, can you name a type of transformation that STTransform cannot represent. Describe the order that the STSceneNode class performs the various rotate/scale/translate transforms when drawing the scene (ie. what is the first operation performed on the shapes vertices? what is the second? third?). Are there other orderings that would produce the same result? STTransform gives variables for the separate functions that would otherwise be accomplished with glScale, glRotate, and glTranslate. STTransform cannot perform matrix transformations in the way glMultMatrix can. The order in which STSceneNode performs its transformations is translate, then rotate, then scale. The order in which these occur should not matter.

Note that graphical objects, such as instances of the STImage and STShape class are not scene graph nodes (but they can be contained within STSceneNodes). By inspecting the implementation of STSceneNode, determine if it permissable to add the same object to the scene multiple times (Eg. Can multiple scene nodes contain the same shape object)? Why would one want to do this? There is nothing to prevent multiple scene nodes from containing the same object. One might add the same object multiple times if there is only one object image and it needs to perform several different functions.

Assume you had an STSceneNode n, and a STShape s. How would you add this shape as the first child node of n? How would you add it as the last child node of n? n->PlaceObject(s,NULL) n->PlaceObject(s,s.GetLastChild())

The STImage::read() method doesn't read data off disk, it reads it from the OpenGL framebuffer. The method takes 4 integer arguments. Describe the meaning of these arguments. You will call this method as part of the required code for this assignment. How are the values you pass to STImage::read() determined in clock.cpp? startx and starty are the first two parameters of glReadPixels(), which would seem to set the origin point of a coordinate plane. The third and fourth arguments, width and height, are the positive x and y coordinates that correspond to the image that will be read from the framebuffer.

Assignment 3

First let's review some font terminology. What is the baseline of a font? How are the ascender and decender heights related to the baseline?

The font baseline is the horizontal line on which all characters are placed. The bottom of flat footed characters will rest on this line, while some will reach below this line, like the character 'g'. The ascender height is the number of pixels the tallest letters reaches above the baseline. The descender height is the number of pixels below the baseline characters dip.

Font sizes are often expressed in points (the argument to STFontFace::SetSize() is in units of points). One point is 1/72 of an inch. To display a font on screen at the correct size, the size of the font in pixels must be computed, which means we need to know the size of a pixel in inches. How many screen pixels would a 14 point font span if the screen has a resolution of 300 DPI (300 dots (pixels) per inch)? (notice that the STText and STFontFace classes return most information about fonts in units of pixels)

58 and 1/3 screen pixels (14 point font * (300 screen dpi / 1/72 points/inch)

Describe the correspondence between window coordinates and pixels that is established via the use of glViewport and glOrtho in the GLUT resize handler. After completing the assignment, it should be clear why it is wise to not modify this mapping in this assignment.

The coordinate system of the window is measured in pixels by pixels, starting at 0,0 in the bottom left corner, and ending in the window width and height in the upper right. This is useful in that the width and height of characters correspond directly to the coordinate system.

Recent