1. Install c/c++ compilation package.

2. install openGL and freeGlut library

sudo apt-get install mesa-common-dev

sudo apt-get install freeglut3-dev

3. testing: run this code (comes from openGL red book) by save it as a cpp file. Then open the terminal and navigate to the directory containing this cpp file.

g++ text.cpp -lglut -lGL
Then you will get an a.out. run it by

./a.out4. Done

 #include "GL/freeglut.h"
#include "GL/gl.h" /* display function - code from:
http://fly.cc.fer.hr/~unreal/theredbook/chapter01.html
This is the actual usage of the OpenGL library.
The following code is the same for any platform */
void renderFunction()
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
glBegin(GL_POLYGON);
glVertex2f(-0.5, -0.5);
glVertex2f(-0.5, 0.5);
glVertex2f(0.5, 0.5);
glVertex2f(0.5, -0.5);
glEnd();
glFlush();
} /* Main method - main entry point of application
the freeglut library does the window creation work for us,
regardless of the platform. */
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowSize(,);
glutInitWindowPosition(,);
glutCreateWindow("OpenGL - First window demo");
glutDisplayFunc(renderFunction);
glutMainLoop();
return ;
}

Note: Fell free to context me.

 

Linux(Ubuntu 14.04) setting up OpenGL的更多相关文章

  1. Linux ->> UBuntu 14.04 LTE下安装Hadoop 1.2.1(集群分布式模式)

    安装步骤: 1) JDK -- Hadoop是用Java写的,不安装Java虚拟机怎么运行Hadoop的程序: 2)创建专门用于运行和执行hadoop任务(比如map和reduce任务)的linux用 ...

  2. Linux Ubuntu 14.04安装LAMP(Apache+MySQL+PHP)网站环境

    从虚拟主机到VPS/服务器的过度,对于普通的非技术型的站长用户来说可能稍许有一些困难,麦子建议我们如果能够在虚拟主机环境中满足建站需要的, 还是用虚拟主机比较好.除非我们真的有需要或者希望从虚拟主机过 ...

  3. Git使用:Linux(Ubuntu 14.04 x64)下安装Git并配置连接GitHub

    github是一个非常好的网络代码托管仓库,知晓许久,但是一直没有用起来,最近才开始使用git管理自己的文档和代码. Git是非常强大的版本管理工具,今天就告诉大家,如何在Linux下安装GIt,并且 ...

  4. Linux ->> UBuntu 14.04 LTE下设置静态IP地址

    UBuntu 14.04 LTE设置IP地址和一些服务器版本的Linux还不太一样.以Centos 7.0为例,网卡IP地址的配置文件应该是/etc/sysconfig/network-scripts ...

  5. Linux ->> Ubuntu 14.04 LTE下配置SSH免密码登录

    首先用apt-get命令安装SSH jerry@ubuntu:~$ sudo apt-get install ssh [sudo] password for jerry: Reading packag ...

  6. Linux ->> UBuntu 14.04 LTE下主机名称和IP地址解析

    UBuntu 14.04 LTE下主机名称和IP地址解析一些相关的配置文件: /etc/hosts: 主机文件.手工配置IP地址和主机名称间的映射.格式为每行一条映射条项: <machine_n ...

  7. Linux ->> UBuntu 14.04 LTE下安装Hadoop 1.2.1(伪分布模式)

    Hadoop的运行模式可分为单机模式.伪分布模式和分布模式. 首先无论哪种模式都需要安装JDK的,这一步之前的随笔Ubuntu 14.04 LTE下安装JDK 1.8中已经做了.这里就不多说了. 其次 ...

  8. Linux Ubuntu 14.04 LTS下VirtualBox连接USB

    1.环境 主机:Ubuntu 14.04 LTS 虚拟机:Windows 7 专业版本 VirtualBox: 图形用户界面版本 5.1.8 r111374 (Qt5.6.1) 2.在主机上给Virt ...

  9. linux: ubuntu 14.04 和16.04 快速下载

    由于官网服务器在国外,下载速度奇慢,所以我们可以利用阿里云镜像下载ubuntuubuntu 14.04:http://mirrors.aliyun.com/ubuntu-releases/14.04/ ...

随机推荐

  1. MSDTC故障排除,DTCTester用法 (二)

    摘自:https://support.microsoft.com/zh-cn/kb/293799#bookmark-4 ———————————————————————————— 概要 DTCTeste ...

  2. [转] How to debug a ARM Cortex-M hard fault exception

    how to debug a ARM Cortex-M hard fault exception

  3. “You couldn’t see my tears cause I am in the water.“ Fish said to water.“But I could feel your tears cause you are in my heart..“ Answered water.

    “You couldn’t see my tears cause I am in the water.“ Fish said to water.“But I could feel your tears ...

  4. PHP base64

    <?php header('Content-type:text/html;charset=utf-8'); function image_base64($image_file) { // get ...

  5. echarts在IE8下遮挡其他组件的问题

    echarts的图在IE8下会浮在上层遮挡住其他组件,解决方式是页面中引入 <meta http-equiv="X-UA-Compatible" content=" ...

  6. 写入文件(txt格式)

    #region 写入文件       /// <summary>       /// 写入文件       /// </summary>       /// <param ...

  7. [密码学] C++ 实现 AES128 加密算法

    概述 清理邮箱的时候翻出来的. 很久以前写的,理解加密算法用的,当时记得是还撸了两天晚上撸出来的代码,放上来留个纪念好啦. 补上Tutorial,就当考古吧. 写代码时候毕竟年轻,问题也不少,但现在这 ...

  8. jshzoi

    解题报告——2018级2016第二学期第一周作业   解题报告——2018级2016第二学期第一周作业 D 算24 题目描述 描述 给出4个小于10个正整数,你可以使用加减乘除4种运算以及括号把这4个 ...

  9. 2.OC蓝牙功能

    一.  最早的蓝牙框架是GameKit,iOS7之前用的比较多,它有只能支持iOS设备间的传输,但是使用步骤简单,我们只需要搞清楚两个类就可以了. GKPeerPickerController:熟称浏 ...

  10. HTLM5第一天的内容

    网页的本质就是超级文本标记语言:Hyper Text Markup Language 网页的组成:结构(HTML)  样式(CSS)  行为(JavaScript) 万维网联盟:W3C:World W ...