![]() |
Two-dimension viewing in Computer graphics is a technique to map the world coordinates system (actual coordinates of the object in the real world) to device coordinates (actual coordinates of the object on the output screen like a monitor). ![]()
2D Viewing FunctionIn Computer graphics to perform viewing transformations, we need a tool called OpenGL. The basic OpenGL libraries do not support functions for 2D viewing transformations as they are made especially for 3D viewing transformations. But we can apply 3D viewing routines to 2D viewing scenes. We can use two-dimensional routines along with the OpenGL viewport function. Two Dimensional routines that can be used are:
Some functions are: 1. GLU Clipping-Window Function: This function is used to define a two-dimensional clipping window,
2. GLUT Display Window: This function is used to initialize GLUT,
For choosing GLUT function dimensions and position:
Function to expand the current display window to fill the screen:
Function to reset the screen location for the current display window:
Function to convert the current display window to an icon in the form of some small symbol or picture that represents the window:
We can change the label of the icon with the following command:
This function invokes the particular function that the user want to display at the current display window, if there are more than one display window:
Finally we have the final GLUT command that directs the execution of the program:
After this command gets executed display windows and their graphic contents are sent to the screen. Then the program continually checks for new “events, ” such as input from a mouse, keyboard or graphics tablet after entering to GLUT processing loop. To show two views of a triangle using 2D viewing functions. Example 1: C++
Output: ![]()
|
Reffered: https://www.geeksforgeeks.org
Computer Graphics |
Related |
---|
![]() |
![]() |
![]() |
![]() |
![]() |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 12 |