Differences between GL, Glu, and glut in OpenGL

Source: Internet
Author: User

Reprinted from: http://blog.csdn.net/zckloveczy/archive/2009/06/03/4240189.aspx

Thanks to the original author.

The GL library in OpenGL is the core library, the Glu is the practical library, the glut is the practical tool library, the GL is the core, the Glu is part of the GL encapsulation, And the glut is the cross-platform tool library of OpenGL, GL contains the most basic 3D functions, and Glu seems to be an aid to GL. If it counts well and does not need to use Glu, it can also achieve the same effect. Glut is a basic window interface and is independent of GL and Glu. If you do not like glut, you can replace it with MFC and Win32 windows, but glut is cross-platform, this ensures that the program we compile is cross-platform. If you use MFC or Win32, it can only be used on Windows. A major reason for choosing OpenGL is its cross-platform nature, so we can try our best to use the glut library.

Values of keys in the keyboard handler function in glut:

In glut, there are two keyboard functions: Maid (keyfcn) and fig (specialkeyfcn );

Void keyfcn (glubyte key, glint xmouse, glint ymouse)

The value of the parameter key is a character value or the corresponding ASCII code. The returned cursor coordinates (xmouse, ymouse) in the window are relative to the upper left corner of the window. When a specified button is pressed, we can start certain actions with the mouse position.

Void specialkeyfcn (glint specialkey, glint xmouse, glint ymouse)

The value of specialkey is an integer glut constant. Function key symbol constant: The symbol constant of the direction key is similar to that of the maid to the maid, and so on. The "backspace", "delete", and "escape" keys are specified using their ASCII code through the maid func, which are 8,127 and 27, respectively.

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.