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...
-
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