Linux(Ubuntu 14.04) setting up OpenGL
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的更多相关文章
- Linux ->> UBuntu 14.04 LTE下安装Hadoop 1.2.1(集群分布式模式)
安装步骤: 1) JDK -- Hadoop是用Java写的,不安装Java虚拟机怎么运行Hadoop的程序: 2)创建专门用于运行和执行hadoop任务(比如map和reduce任务)的linux用 ...
- Linux Ubuntu 14.04安装LAMP(Apache+MySQL+PHP)网站环境
从虚拟主机到VPS/服务器的过度,对于普通的非技术型的站长用户来说可能稍许有一些困难,麦子建议我们如果能够在虚拟主机环境中满足建站需要的, 还是用虚拟主机比较好.除非我们真的有需要或者希望从虚拟主机过 ...
- Git使用:Linux(Ubuntu 14.04 x64)下安装Git并配置连接GitHub
github是一个非常好的网络代码托管仓库,知晓许久,但是一直没有用起来,最近才开始使用git管理自己的文档和代码. Git是非常强大的版本管理工具,今天就告诉大家,如何在Linux下安装GIt,并且 ...
- Linux ->> UBuntu 14.04 LTE下设置静态IP地址
UBuntu 14.04 LTE设置IP地址和一些服务器版本的Linux还不太一样.以Centos 7.0为例,网卡IP地址的配置文件应该是/etc/sysconfig/network-scripts ...
- Linux ->> Ubuntu 14.04 LTE下配置SSH免密码登录
首先用apt-get命令安装SSH jerry@ubuntu:~$ sudo apt-get install ssh [sudo] password for jerry: Reading packag ...
- Linux ->> UBuntu 14.04 LTE下主机名称和IP地址解析
UBuntu 14.04 LTE下主机名称和IP地址解析一些相关的配置文件: /etc/hosts: 主机文件.手工配置IP地址和主机名称间的映射.格式为每行一条映射条项: <machine_n ...
- Linux ->> UBuntu 14.04 LTE下安装Hadoop 1.2.1(伪分布模式)
Hadoop的运行模式可分为单机模式.伪分布模式和分布模式. 首先无论哪种模式都需要安装JDK的,这一步之前的随笔Ubuntu 14.04 LTE下安装JDK 1.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 ...
- linux: ubuntu 14.04 和16.04 快速下载
由于官网服务器在国外,下载速度奇慢,所以我们可以利用阿里云镜像下载ubuntuubuntu 14.04:http://mirrors.aliyun.com/ubuntu-releases/14.04/ ...
随机推荐
- JavaScript,复习总结
ECMA(European Computer Manufacturers Association)欧洲计算机制造商协会.其制定很多标准:C#语言规范:C++/CLI语言规范:Eiffel语言:CD-R ...
- ffmpeg编译参数详解
Usage: configure [options]用 法:configure [选项]Options: [defaults in brackets after descriptions]选 项: ...
- ODBC简介
加载驱动 1 oracle Class.forName("oracle.JDBC.driver.OracleDriver") 2 DB2 Class.forName("c ...
- Spark之键值RDD转换(转载)
1.mapValus(fun):对[K,V]型数据中的V值map操作(例1):对每个的的年龄加2 object MapValues { def main(args: Array[String]) { ...
- c++中的<<函义
1.一个是左移运算:x = 4<< 2; 2.输出流运算:cout <<x;//X的值输出流到设备中.
- Submit Text 快捷键总结
Ctrl+D : 选择单词,重复可增加选择下一个相同的单词Ctrl+F : 查找内容Ctrl+G : 跳转到指定行Ctrl+H : 替换 Ctrl+J : 合并行(已选择需要合并的多行时)Ctr ...
- Android Paint的属性
在Paint中有很多的属性可以设置,比如可以设置阴影,颜色过滤等等,这些会产生不同的奇妙效果,今天就对各种属性探索一下. 方法一: 1 //设置绘制的颜色,a代表透明度,r,g,b代表颜色值. 2 s ...
- er3
<html xmlns:v="urn:schemas-microsoft-com:vml"xmlns:o="urn:schemas-microsoft-com:of ...
- Bootstrap Modal 垂直方向加滚动条
原文链接:http://blog.csdn.net/cyh1111/article/details/52960747 背景 使用Bootstrap Modal实现用户资料修改,由于用户信息过多,默认M ...
- Android Fragment 真正的完全解析(下)
转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/37992017 上篇博客中已经介绍了Fragment产生原因,以及一些基本的用法和 ...