Window port and Viewport in Computer Graphics

Computer Graphics | Window port and Viewport: In this tutorial, we are going to learn about the Window port and Viewport, and differences between them. By Monika Sharma Last updated : April 05, 2024

Capturing images from the real world and displaying them on the screen is an astonishing process, only if we do not know the underlying process. Here, we will be studying how the images are captured. This process is held by the Window port and Viewport in Computer Graphics.

Window port

The window port can be confused with the computer window but it isn't the same. The window port is the area chosen from the real world for display. This window port decides what portion of the real world should be captured and be displayed on the screen. The widow port can thus be defined as,

"A world-coordinate area selected for display is called a window. A window defines a rectangular area in the world coordinates."

Window port

Image source: https://pediaa.com/wp-content/uploads/2019/08/Difference-Between-Window-Port-and-View-Port_Figure-1-768x361.jpg

Viewport

Now, the Viewport is the area on a display device to which a window is mapped. Thus, the viewport is nothing else but our device's screen. The viewport can thus be defined as follows:

"A viewport is a polygon viewing region in computer graphics. The viewport is an area expressed in rendering-device-specific coordinates, e.g. pixels for screen coordinates, in which the objects of interest are going to be rendered."

Viewport

Difference between Window Port and Viewport

Window Port Viewport
Window port is the coordinate area specially selected for the display. Viewport is the display area of viewport in which the window is perfectly mapped.
Region Created according to World Coordinates. Region Created according to Device Coordinates.
It is a region selected form the real world. It is a graphically control thing and composed of visual areas along with some of its program controlled with help of window decoration. It is the region in computer graphics which is a polygon viewing region.
A window port can be defined with the help of a GWINDOW statement. A viewport is defined by the GPORT command.

So, to display the image on the computer screen, we must map our window port to the viewport. The capture ratio of the window might not always be similar to or easily adjustable to the viewport. Thus, some necessary transformations ad adjustments like clipping and cropping are performed on the window.

Window to viewport Transformation

The process of mapping the window port to the viewport is termed as 'Window to viewport Transformation'. It is also known as "Viewing Transformation" or "Windowing Transformation". It is defined as follows:

"Window to Viewport Transformation is the process of transforming a 2D world-coordinate object (Window Port) to device coordinates (Viewport). So, objects inside the world or clipping window are mapped to the viewport which is the area on the screen where world coordinates are mapped to be displayed."

Thus, we know the basic object description has been changed to the viewing reference frame, so we choose the window, and extend it in viewing coordinates and select or choose the viewport limits in normalized coordinate points.

Many other processes are performed while doing so like maintaining the aspect ratio of the clipping window and the viewport, clipping the excess parts, etc. This all comprises within the Window to the Viewport transformation process. There are various methods and algorithms to do so. We will study each of them in detail in the upcoming articles.

Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.