Some OpenGL notes

Source: Internet
Author: User

Some OpenGL notes

Gluperspective

Gluperspective usage:

Void gluperspective (gldouble fovy, // angle gldouble aspect, // gldouble znear, // The distance between two cropping planes along the Z axis is close to gldouble zfar // The distance between the two cropping planes along the Z axis );

Remember, by default (that is, use the following statement)

glMatrixMode( GL_PROJECTION );glLoadIdentity( );

The following is the negative half-axis of the Z axis. When we use the gluperspective function, znear and zfar are defined relative to our view. Therefore, when drawing a graph, we must not consider that the Z axis coordinates of our graph can be displayed only when they are positive. On the contrary, the Z axis coordinates can be displayed only when they are negative.

Note: In the gluperspective () function, znear must be greater than 0. Once it is equal to 0 or less than 0, all 3D objects cannot be displayed.

Of course, zfar must be larger than znear, otherwise it cannot be displayed.

GlupostredisplayAnd Image

Note: The glupostredisplay () function cannot be called outside the rendering thread. If it is written outside the rendering thread, the call will be invalid.

Why is there latency (commonly known as "some cards") in Moving Windows when my screen is moving ")?

Because the game is basically drawn in one thread, the FPs of the window program is generally 60, depending on the update rate you set. This means that when you move the window, the system must refresh the screen 60 times in one second at the same time. That is to say, only once within 1/60 seconds will you respond to the operation of moving the window, I think the normal window will not be refreshed so frequently. Therefore, there will be some latency in moving the window, which is normal. Sometimes, when some large games perform intensive GPU operations, isn't there a situation where the mobile window cannot respond or the response is slow?

Crop

Glenable (gl_depth_test); // use the deep test glfrontface (gl_cw); // draw the front gl_cull_face clockwise; // remove the faces that are not the front.

If we set the front position of the clockwise drawing, once we draw a counter-clockwise drawing, it will not be displayed, because the front is not removed.

Display list

The declared display list and the rendered display list must be put upside down. Otherwise, the declared display list cannot be rendered. For example:

Void Init (void) {glnewlist (list1, gl_compile );... Gldlist (); glnewlist (list2, gl_compile );... Glendlist ();} void render (void) {/* error: list2 cannot be displayed. Glcalllist (list1); glcalllist (list2); */glcalllist (list2); glcalllist (list1 );}

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.