Using GLUT in Codeblocks

Source: Internet
Author: User

GLUT is an abbreviation, and its full name is called OpenGL Utility Toolkit, which is a toolkit that can be used to write OpenGL programs. The glut is ideal for learning OpenGL, but it is not suitable for developing relatively complex user interfaces. Today, let's talk about how to use glut in codeblocks.


This topic has been discussed in both English and Chinese, see http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/glut/, English version see "Using Glut in Codeblocks" (OpenGL) For Windows ".


Here, repeat it again.


First look at the output of a glut example program.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7E/D4/wKiom1cJkXyjdEvNAACEPZ9-E0w213.png "title=" Glut_ Shapes.png "alt=" Wkiom1cjkxyjdevnaacepz9-e0w213.png "/>

First, you need to prepare three files, Glut32.dll, Glut32.lib, Glut.h.

These three files can be downloaded from the Internet. Glut32 belongs to the dynamic link library,. h is required at compile time,. Lib records the basic information of the library function, the link needs, the. dll is the concrete function implementation, is the program to run the dynamic load.
Copy the Glut32.dll into the C:\windows/system.

Copy the Glut32.lib to C:\Program Files (x86) \codeblocks\mingw\lib.

Copy the glut.h to the C:\Program Files\codeblocks\mingw\include\gl.


Now, open codeblocks, create a new project, and select Glut Project.

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7E/D4/wKiom1cJlQLyk1_PAACSFHW0OhM882.png "title=" Glut_ Project.png "alt=" Wkiom1cjlqlyk1_paacsfhw0ohm882.png "/>

Give the project a name and then next specify the location of the GLUT toolkit.

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7E/D0/wKioL1cJljjQLGY2AACU0-0XmqE714.png "title=" Glut_ Location.png "alt=" Wkiol1cjljjqlgy2aacu0-0xmqe714.png "/>

Now that the project has been built up, click on compile to run it. As a result, many errors are found.

If you want to run successfully, you need to add the header file # include "Windows.h" in the auto-generated main.cpp, and then compile and run, you can have the above results window. The graphics device interface functions are included in the windows.h.




This article from "Hu A Knife" blog, declined reprint!

Using GLUT in Codeblocks

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.