Question: COMPUTER GRAPHICS - Use figure *************B Solve Practice Exercise 2.3.1. Write the program and name your source code as checker.cpp. Requirement: Make the checkerboard use
COMPUTER GRAPHICS - Use figure *************B


Solve Practice Exercise 2.3.1. Write the program and name your source code as checker.cpp.
Requirement: Make the checkerboard use two random colors every time you run your program.
Practice Exercises. 2.3.1. Drawing the checkerboard. (Try your hand at this before looking at the answers.) Write the routine checkerboard (int size) that draws the checkerboard shown in Figure 2.31b. Place the checkerboard with its lower left corner at (0,0). Each of the 64 squares has length size pixels. Choose two nice colors for the squares. Solution: The ij-th square has lower left corner at (i*size,j"size) for i = 0, and-0.7. The color can be made to alternate between (r, g, b) and (r2, g,, b,) using if((i + j) %2-0) // if i + j is even glColor3f( r1, gl, bl); else glColor3f (r2, g2, b2)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
