ubuntu12.04上Using cairo with OpenGL 例子编译

GTK+ 中的 OpenGL

http://liyanrui.is-programmer.com/2009/1/20/gtk-opengl.6934.html

 GtkGLExt官网

http://projects.gnome.org/gtkglext/download.html

帮助手册

https://developer.gnome.org/gtkglext/stable/


在cairo中使用opengl的步骤

http://cairographics.org/OpenGL/

General approach

Which steps should one usually take in order to get cairo-drawn vector-graphics into an OpenGL-rendered scene...

  • Setup your OpenGL-context, e.g. via SDL orgtk+/GtkGlExt.

  • Create your cairo-surface/context (maybe even glitz-based) you want to use as a source for later texture-map generation.

  • Render into the cairo-context with normal cairo-calls.

  • Copy the cairo-surface into an OpenGL-texture with glTexImage2D().

  • Use this texture to map your OpenGL-primitives with.

  • Rendering to the cairo-surface and copying that to the OpenGL-texture afterwards, can also be done in your rendering-loop, if you want to animate the cairo-graphics themselves from frame to frame.

  • For the time being disregard the idea of drawing into the same surface or texture with cairo- and OpenGL-calls. This is possible, but not in a very straight forward fashion. Also threadding-issues are not covered here at the moment. Everything happens in one thread right now.


安装opengl开发环境

sudo apt-get install mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev

 

下载gtkglext

git clone git://git.gnome.org/gtkglext

 

编译安装gtkglext

./bootstrap

./configure --prefix=/usr/gtkglext

make

make install

(在bootstrap阶段可能需要安装gtk-doc-tools)

 

编译例程

svn checkout http://gtk-gl-slider.googlecode.com/svn/ gtk-gl-slider-read-only

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/gtkglext/lib/pkgconfig

export LD_LIBRARY_PATH=/usr/gtkglext/lib

修改Makefile 添加-static使用静态库

make

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值