Linux下搭建Qt+OpenGL .

测试了一天,终于能在Linux的QT环境下编写OpenGL程序了。

我原先认为Linux下的qt跟windows下的qt一样,装好qt后,openGL的库也装好了。只要包含头文件,就可以调用openGL的函数了。事实上,Linux的qt creator安装好后,虽然包含有openGL的头文件,但openGL库函数模块并没有包括在其中,还需另外安装。

Ubuntu下安装openGL库:

sudo apt-get install libgl-dev libglu-dev

我终端输如后提示

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libgl-dev is a virtual package provided by:
libgl1-mesa-swx11-dev 7.7.1-1ubuntu3
libgl1-mesa-dev 7.7.1-1ubuntu3
You should explicitly select one to install.
E: Package libgl-dev has no installation candidate

libgl1-mesa-swx11-dev 7.7.1-1ubuntu3
libgl1-mesa-dev 7.7.1-1ubuntu3

libgl1-mesa-dev: it is capable of
both direct and indirect rendering. For direct rendering, it can use DRI
modules from the libgl1-mesa-dri package to accelerate drawing.


libgl1-mesa-swx11-dev: This library provides a pure software rasteriser; it does not provide
a direct rendering-capable library, or one which uses GLX. For that,
please see libgl1-mesa-dev.
安装好库之后,openGL程序还会出现许多"undefined reference..."
网上看到说要:在*.pro中加了一条:CONFIG+= qt opengl warn_on release
我的做法是在*.pro中使 QT += opengl ,这样也能实现
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值