OpenGL Learning Notes 1

zhaozj2021-02-16  58

OpenGL is a lot of graphics API's library, and the professional is called "graphical interface", so it is understood that these APIs are the basis of using OpenGL later. In order to achieve the purpose of using these APIs, at least one language is required, it is recommended to C language. Now popular programming is Win32 console and win32 application, which way is not important, mainly mastering its API usage is fine. OpenGL coordinate transformation is very characterized, in order to define 2 coordinate systems, the world coordinate system, the current drawing coordinate system, no matter how transformed, the world coordinate system does not move, with the screen center as the origin (0, 0, 0), You face the screen, your right is the x positive axis, the above is the Y positive axis, the screen points to your Z positive axis. The current drawing coordinate system is the coordinate system when drawing objects. When the program is initialized, the world coordinate system and the current drawing coordinate system are coincident. When the transform function such as GLTranslatef () is changed, the current drawing coordinate system is changed, and the changed position is the current drawing coordinate system. Your own X, Y, Z-axis changes, after changing, use the GlvertEx3f () drawing function drawing function drawing, is drawing in the current drawing coordinate system, all of the function parameters are also relative to the current drawing coordinate system Said.

GLLoadIdentity (): Another current drawing coordinate system from the new back to the world coordinate system, and also coincide. Gltranslatef (x, y, z): Make the plot coordinate system relative to the world coordinate lines along X, Y, Z axis units. GlvertEX3F (X, Y, Z): Draw a point in the current drawing coordinate system

GLCOLOR3F (R, G, B): Set the drawing color of the drawing function, if you don't touch Glcolor3f () again, the graphic color drawn after any drawing function will be this color. R, G, B range from 0.0 to 1.0. R-Blue, G-Green, B-Blue, Color is a mixture of these three color components, such as Glcolor3f (1.0, 1.0, 0.0) is yellow, Glcolor3f (1.0, 0.0, 0.0) is red.

GLROTATEF (Angle, X, Y, Z): and GLTranslateF () belong to a class of functions, GLTranslatef () is translation, and GLROTATEF is rotated, which is to make the current drawing coordinate system X, Y, Z rotate angle angle. The value of x, y, z is not 0 1, such as GLROTATEF (30, 1.0 F, 0.0F), is rotated about 30 degrees around the X-axis, GLROTATEF (30, 1.0F, 1.0F, 0.0F) is around The angle line of X, Y is 30 degrees.

转载请注明原文地址:https://www.9cbs.com/read-24486.html

New Post(0)