• Home
  • Textbooks
  • Computer Graphics with OpenGL
  • Attributes of graphics primitives

Computer Graphics with OpenGL

Donald D. Hearn, M. Pauline Baker

Chapter 4

Attributes of graphics primitives - all with Video Answers

Educators


Chapter Questions

Problem 1

Use the glutSetColor function to set up a color table for an input set of color values.

Check back soon!
01:37

Problem 2

Using vertex and color arrays, set up the description for a scene containing at least six two-dimensional objects.

Nick Johnson
Nick Johnson
Numerade Educator

Problem 3

Write a program to display the two-dimensional scene description in the previous exercise.

Check back soon!

Problem 4

Using vertex and color arrays, set up the description for a scene containing at least four three-dimensional objects.

Check back soon!

Problem 5

Write a program to display a two-dimensional, gray-scale "cloud" scene, where the cloud shapes are to be described as point patterns on a blue-sky background. The light and dark regions of the clouds are to be modeled using points of varying sizes and interpoint spacing. (For example, a very light region can be modeled with small, widely spaced, light-gray points. Similarly, a dark region can be modeled with larger, more closely spaced, dark-gray points.)

Check back soon!

Problem 6

Modify the program in the previous exercise to display the clouds in red and yellow color patterns as they might be seen at sunrise or at sunset. To achieve a realistic effect, use different shades of red and yellow (and perhaps green) for the points.

Check back soon!

Problem 7

Implement a general line-style function by modifying Bresenham's line-drawing algorithm to display solid, dashed, or dotted lines.

Check back soon!

Problem 8

Implement a line-style function using a midpoint line algorithm to display solid, dashed, or dotted lines.

Check back soon!
00:15

Problem 9

Devise a parallel method for implementing a line-style function.

AG
Ankit Gupta
Numerade Educator
00:15

Problem 10

Devise a parallel method for implementing a line-width function.

AG
Ankit Gupta
Numerade Educator

Problem 11

A line specified by two endpoints and a width can be converted to a rectangular polygon with four vertices and then displayed using a scan-line method. Develop an efficient algorithm for computing the four vertices needed to define such a rectangle, with the line endpoints and line width as input parameters.

Check back soon!

Problem 12

Implement a line-width function in a line-drawing program so that any one of three line widths can be displayed.

Check back soon!

Problem 13

Write a program to output a line graph of three data sets defined over the same $x$-coordinate range. Input to the program is to include the three sets of data values and the labels for the graph. The data sets are to be scaled to fit within a defined coordinate range for a display window. Each data set is to be plotted with a different line style.

Check back soon!

Problem 14

Modify the program in the previous exercise to plot the three data sets in different colors, as well as different line styles.

Check back soon!

Problem 15

Set up an algorithm for displaying thick lines with butt caps, round caps, or projecting square caps. These options can be provided in an option menu.

Check back soon!
04:21

Problem 16

Devise an algorithm for displaying thick polylines with a miter join, a round join, or a bevel join. These options can be provided in an option menu.

Willis James
Willis James
Numerade Educator

Problem 17

Modify the code segments in Section 4-8 for displaying data line plots, so that the line-width parameter is passed to procedure 1 ineP1ot.

Check back soon!

Problem 18

Modify the code segments in Section 4-8 for displaying data line plots, so that the line-style parameter is passed to procedure 1 inePlot.

Check back soon!
03:31

Problem 19

Complete the program in Section 4-8 for displaying line plots using input values from a data file.

Banhishikha Sinha
Banhishikha Sinha
Numerade Educator
03:31

Problem 20

Complete the program in Section 4-8 for displaying line plots using input values from a data file. In addition, the program should provide labeling for the axes and the coordinates for the display area on the screen. The data sets are to be scaled to fit the coordinate range of the display window, and each plotted line is to be displayed in a different line style, width, and color.

Banhishikha Sinha
Banhishikha Sinha
Numerade Educator
03:24

Problem 21

Implement pen and brush menu options for a line-drawing procedure, including at least two options: round and square shapes.

Jay Patel
Jay Patel
Numerade Educator

Problem 22

Modify a line-drawing algorithm so that the intensity of the output line is set according to its slope. That is, by adjusting pixel intensities according to the value or the slope, all lines are displayed with the same intensity per unit length.

Check back soon!
01:42

Problem 23

Define and implement a function for controlling the line style (solid, dashed, dotted of displayed ellipses.

William Semus
William Semus
Numerade Educator
01:26

Problem 24

Define and implement a function for setting the width of displayed ellipses.

Grace Bajar
Grace Bajar
Numerade Educator

Problem 25

Write a routine to display a bar graph in any specified screen area. Input is to include the data set, labeling for the coordinate axes, and the coordinates for the screen area. The data set is to be scaled to fit the designated screen area, and the bars are to be displayed in designated colors or patterns.

Check back soon!

Problem 26

Write a procedure to display two data sets defined over the same $x$-coordinate range, with the data values scaled to fit a specified region of the display screen The bars for one of the data sets are to be displaced horizontally to produce ar overlapping bar pattern for easy comparison of the two sets of data. Use a different color or a different fill pattern for the two sets of bars.

Check back soon!

Problem 27

Devise an algorithm for implementing a color lookup table.

Check back soon!

Problem 28

Suppose you have a system with an 8 inch by 10 inch video screen that can displa 100 pixels per inch. If a color lookup table with 64 positions is used with this system what is the smallest possible size (in bytes) for the frame buffer?

Check back soon!
04:55

Problem 29

Consider an RGB raster system that has a 512-by-512 frame buffer with 20 bits pe pixel and a color lookup table with 24 bits per pixel. (a) How many distinct gray levels can be displayed with this system? (b) How many distinct colors (includin gray levels) can be displayed? (c) How many colors can be displayed at any one time? (d) What is the total memory size? (e) Explain two methods for reducing memory size while maintaining the same color capabilities.

Stanley Enemuo
Stanley Enemuo
Numerade Educator

Problem 30

Modify the scan-line algorithm to apply any specified rectangular fill pattern to polygon interior, starting from a designated pattern position.

Check back soon!

Problem 31

Write a program to scan convert the interior of a specified ellipse into a solid colors.

Check back soon!
01:05

Problem 32

Write a procedure to fill the interior of a given ellipse with a specified pattern.

Kimberly Waterbury
Kimberly Waterbury
Numerade Educator

Problem 33

Write a procedure for filling the interior of any specified set of fill-area vertics including one with crossing edges, using the nonzero winding number rule identify interior regions.

Check back soon!

Problem 34

Modify the boundary-fill algorithm for a 4-connected region to avoid excessive stacking by incorporating scan-line methods.

Check back soon!
02:43

Problem 35

Write a boundary-fill procedure to fill an 8-connected region.

Shawn Gedert
Shawn Gedert
Numerade Educator
01:44

Problem 36

Explain how an ellipse displayed with the midpoint method could be proper filled with a boundary-fill algorithm.

Michael Jacobsen
Michael Jacobsen
Numerade Educator

Problem 37

Develop and implement a flood-fill algorithm to fill the interior of any specifie area.

Check back soon!

Problem 38

Define and implement a procedure for changing the size of an existing rectangui fill pattern.

Check back soon!

Problem 39

Write a procedure to implement a soft-fill algorithm. Carefully define what th soft-fill algorithm is to accomplish and how colors are to be combined.

Check back soon!

Problem 40

Devise an algorithm for adjusting the height and width of characters defined rectangular grid patterns.

Check back soon!

Problem 40

Implement routines for setting the character up vector and the text path for trolling the display of character strings.

Check back soon!

Problem 42

Write a program to align text as specified by input values for the alignment parameters.

Check back soon!

Problem 43

Develop procedures for implementing marker attributes (size and color).

Check back soon!

Problem 44

Implement an antialiasing procedure by extending Bresenham's line algorithm to adjust pixel intensities in the vicinity of a line path.

Check back soon!

Problem 45

Implement an antialiasing procedure for the midpoint line algorithm.

Check back soon!

Problem 46

Develop an algorithm for antialiasing elliptical boundaries.

Check back soon!

Problem 47

Modify the scan-line algorithm for area fill to incorporate antialiasing. Use coherence techniques to reduce calculations on successive scan lines.

Check back soon!

Problem 48

Write a program to implement the Pitteway-Watkinson antialiasing algorithm as a scan-line procedure to fill a polygon interior, using the OpenGL point-plotting function.

Check back soon!