Cgi Ans
Cgi Ans
crt
✓ We can consider a simplified example, minimal number of operations for displaying a picture.
We are using the OpenGL Utility Toolkit, our first step is to initialize GLUT.
This initialization function could also process any command line arguments, but we will not need to
use these parameters for our first example programs.
We perform the GLUT initialization with the statement glutInit (&argc, argv);
Step 2: title
We can state that a display window is to be created on the screen with a given caption for the title
bar. This is accomplished with the function glutCreateWindow ("An Example OpenGL Program");
where the single argument for this function can be any character string that we want to use for
the display-window title.
For this, we create a picture using OpenGL functions and pass the picture definition to the GLUT
routine glutDisplayFunc, which assigns our picture to the display window.
Example: suppose we have the OpenGL code for describing a line segment in a procedure called
lineSegment.
Then the following function call passes the line-segment description to the display window:
glutDisplayFunc (lineSegment);
After execution of the following statement, all display windows that we have created, including
their graphic content, are now activated: glutMainLoop ( );
This function must be the last one in our program. It displays the initial graphics and puts the
program into an infinite loop that checks for input from devices such as a mouse or keyboard.
Although the display window that we created will be in some default location and size, we can set
these parameters using additional GLUT functions.
2B.
3A. DDA LINE ALGORITHM
3B. BRESENHAM LINE ALGORITHM
4A.2D GEOMETRICTRANSFORMATIONS
4B.
REFELECTION
SHEARING:22