2D Cartesian coordinates

3D Cartesian coordinate system

viewport

Notice: Viewport size ok! = Screen size setting viewport method

    glViewport(x, y, width, height)
Copy the code

X y Locate the lower left corner of the viewport with: height: width of the viewport

projection

Projection refers to the use of a group of lights to project the shape of an object onto a flat surface. The image obtained on this plane is also called a “projection”. Projection can be divided into orthographic projection and perspective projection. Orthographic projection: that is, the center line of the projection ray is perpendicular to the projection plane, perspective projection: the center line of the projection is not perpendicular to the projection plane.

Camera coordinate system

World coordinates, inertial coordinates, object coordinates

Coordinate transformation

We want to capture the image and display it on a 2D screen. It is the process of transforming from world coordinates to screen coordinates, in which the observer coordinates will greatly affect the image displayed on screen coordinates. After all, observer coordinates are the position that the observer chooses to display the imageOnly clipping coordinate system, normalized device coordinate system and screen coordinate system are defined in OpenGL. Local coordinate system (model coordinate system), world coordinate system and camera coordinate system are all customized coordinate systems designed for the convenience of users, and their relationship is shown in the figure below. Coordinate system transformation calculation