OpenGL es1.1.12 Chapter 2 2.10 2.10.1

Source: Internet
Author: User
Tags truncated

(Draft only, not sorted)

2.10 Coordinate Conversion

In the frame cache, vertex, normal, and texture coordinates are converted before they are used to generate an image. First, we will describe how to convert and control vertex coordinates.

Figure 2.5 shows the flowchart of the vertex conversion process. Vertex coordinates on GL are called object coordinates. Then, the model view is applied to object coordinates to generate eye coordinates and use another matrix, that is, the projection matrix is applied to the eye coordinate to generate the editing coordinate. Then, the perspective separation method is applied to the editing coordinates to generate the normalized device coordinates (normalized device coordinates ). The final view port conversion is applied to these coordinates to convert them into window coordinates.

The object coordinates, eye coordinates, and editing coordinates are four-dimensional, including X, Y, Z, and W coordinates. The model view and projection matrix are 4x4.


Figure 2.5 process of vertex Coordinate Transformation

If the object coordinate of a vertex is m, the eye coordinate of the vertex is


Similarly, if p is a projection matrix, the editing matrix is


The normalized device coordinate is

2.10.1 control viewpoint

The viewpoint conversion is determined by the viewpoint width and height. The aspect height is measured in pixels, which are PX and Py respectively. The center is (OX, Oy), and the Unit is also pixel. The vertex's window coordinate is defined as follows:

The coefficients and offsets are used in ZD, which are N and F. encode them using the following command:

Void depthrangef (clampf N, clampf F );

Void depthrangex (clampx N, clampx F );

Each N and F is restricted between [0, 1] and serves as the parameters of clampf and clampx. ZW is a fixed number of points. According to the depth cache of the frame cache, there must be enough bits. Assume that the value expressed by the number of points is, wherein, (for example, 1.0 indicates all the strings in the binary system)

Use the following command to set viewpoint conversion parameters:

Void viewport (int x, int y, sizei W, sizei H );

X and Y represent the coordinates in the lower left corner of the window, W and H represent the width and height of the window, and other parameters of the viewpoint can be obtained through the above equations, such as ox = (x + W) /2, oy = (Y + H)/2, PX = W, Py = H.

The width and height of the viewpoint must be truncated based on the maximum value of implementation independence. The maximum width and height can be obtained by executing the appropriate GET command. For details, see section 6th. The maximum viewpoint dimension must be greater than or equal to the visible dimension to be rendered. If W or H is negative, an invalid_value error occurs.

The condition for realizing viewpoint conversion is four integers and two truncated floating point numbers. In the initial state, W and H are set to the high window width value to be rendered by Gl. Ox is W/2, oy is H/2, n is 0.0, and F is 1.0.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.