Use OpenGL/GLUT configuration in Ubuntu and use GLUT in Codeblocks

Source: Internet
Author: User

Use OpenGL/GLUT in Ubuntu

 

The Ubuntu version is 12.04 LTS.

 

Article 1 Basic compilation environment Configuration

 

1. Create a basic compilation environment

Sudo apt-getinstall build-essential

 

2. Install OpenGL Library

Sudo apt-getinstall libgl1-mesa-dev

 

3. Install OpenGL Utilities

Sudo apt-getinstall libglu1-mesa-dev

 

4. Install OpenGL Utility ToolKit

Sudo apt-get install libglut-dev

Problem 1:

! An error occurred while running this command. The system prompts that the software package cannot be found!


To install the libglut3-dev, the error is the same.

Solution:

Install the freeglut3-dev instead of libglut-dev

Sudo apt-get installfreeglut3-dev

 

5. Compile the source code example. c.

6. Compile and run

Gcc example. c-oexample. out-lGL-lGLU-lglut

./Example. out

You can see the teapot here.

 

Article 2 Use glut in Codeblocks

1. Install codeblocks and create a new GLUT Project

Problem 2:

! When selecting the GLUT location, errors are always prompted. In fact, lib and. H files are already in/usr!


Solution:

Do not use the GLUT Project that comes with Codeblocks

Create a project manually, including the Linked Library file. The procedure is as follows:

 

2. Create a Console Application project

3. Contains link libraries related to OpenGL/Glut

Project à Build Options à Linkersettings

Add file: libGL. so libglut. so libGLU. sO

For example

 

4. Compile, compile, and run the source code.

 

The running effect is as follows,

 




References:

Http://blog.csdn.net/qqbaby2005/article/details/7798061
 

Http://hi.baidu.com/yanqiuge/item/aedd36189bc8e217e3f9861d

 

Http://blog.csdn.net/xiayang05/article/details/7647632

 

Http://blog.csdn.net/wangchenggggdn/article/details/7865973

 
Www.google.com.hk/url? Sa = t & IDC = j & q = & esrc = s & source = web & cd = 1 & ved = 0 cdemo-jaa & url = http://wiki.ubuntu-tw.org/index.php? Title = Howto_Install_OpenGL_Development_Environment & ei = 2syyUOm_K4PkiALdmoEw & usg = AFQjCNGo5zsj_X9pqZCL_JSQmldwLcrWkQ

 

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.