Ubuntu 14.04.2 LTS DeskTop installation OpenGL

Source: Internet
Author: User

    1. Installing OpenGL

      sudo apt-get update

      sudo apt-get install Libgl1-mesa-dev

      sudo apt-get install Libglu1-mesa-dev

      sudo apt-get install Freeglut3-dev

      The above 3 common OpenGL development packages are installed in turn, and the relationship of 3 packages can be summarized as follows: The latter package is the previous package

      Packaging, progressive, the purpose is to facilitate user development.


    2. Verify that the OpenGL development package is installed successfully

      First, you can command it by

      Dpkg-l Libgl1-mesa-dev Libglu1-mesa-dev Freeglut3-dev

      To see what happens after the package is installed: header files, library files, and so on, you can also view the corresponding directories directly.


    3. Summary

      If the system has all installed packages or can be installed, can not be solved by the package, you can:

      Apt-cache Search < package name string >

      Dpkg-l < package name string >

      and other similar function commands to view.

      More details about the Ubuntu package management system can be found on your own and there are many articles and blogs in this category.


    4. OpenGL test Code (code from the network, not my original)

/* * glteapot.c */#include  <gl/glut.h>void init (void) {     Glclearcolor (0.0, 0.0, 0.0, 0.0);     glmatrixmode (GL_PROJECTION);     glortho ( -5, 5, -5, 5, 5, 15);     glmatrixmode ( Gl_modelview);     glulookat (0, 0, 10, 0, 0, 0, 0, 1,  0);     return;} Void display (void) {    glclear (gl_color_buffer_bit);     glcolor3f (1.0, 0, 0);     glutwireteapot (3);     glflush ();     return;} Int main (int argc, char *argv[]) {    glutinit (&AMP;ARGC,&NBSP;ARGV);     glutinitdisplaymode (Glut_rgb | glut_single);     Glutinitwindowposition (0, 0);     glutinitwindowsize (300, 300);     glutcreatewindow ("Opengl 3d view (Teapot)");     init ();     glutdisplayfunc (display);     glutmainloop ();     return 0;}

Compile:

Gcc-o Glteapot Glteapot.c-lgl-lglu-lglut

Operating effects such as:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/82/7C/wKiom1dWk42j7VkjAAGMiAQWagQ806.jpg "title=" Qq20160607172518.jpg "alt=" Wkiom1dwk42j7vkjaagmiaqwagq806.jpg "/>

This article is from the "Jimokuangxiangqu" blog, make sure to keep this source http://4594296.blog.51cto.com/4584296/1787046

Ubuntu 14.04.2 LTS DeskTop installation OpenGL

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.