[Panel-devel] OpenGL applets
Zack Rusin
zack at kde.org
Fri Jul 6 01:20:11 CEST 2007
hey,
my flight leaves in the morning so i won't be able to commit this so if
someone wants to play with it, here you go.
this code allows you to write fully OpenGL based plasma applets. simply
inherit Plasma::GLApplet instead of Plasma::Applet and reimplement
GLApplet::paintGLInterface instead of Applet::paintInterface
the whole concept is rather trivial - in glapplet i do some nasty behind the
curtain hacks to redirect subsequent painting to a pbo, once the applets
finishes the rendering, we blend the contents of the pbo to the actual
qpainter invoked on the applet.
it works really nicely for small/medium size applets. fullscreen applets won't
work well due to fetches of the pbo contents. that could be eliminated by
caling setViewport(new QGLWidget()); in CoronaView and then in the GLApplet
checking whether the widget passed in paintInterface is a QGLWidget and if it
is, instead of fetching the contents of the fbo we could just use its content
as a texture (which would basically mean no slow-downs for applets of any
size). unfortunately it will introduce a flicker of the entire desktop as the
windows on top of the desktop are being moved (qglwidget doesn't handle well
obscuring of its contents).
attached is the patch to libplasma and two sample opengl applets. the first
one will fetch images from flicker and display them in a wheel. the other
will display 4096 animating (in a wave like pattern) cubes with each side of
a cube showing an animating svg (as you might guess that one is a little more
computationally intensive).
obligatory screenshots:
http://chaos.troll.no/~zrusin/plasmagl1.png
http://chaos.troll.no/~zrusin/plasmagl2.png
z
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plasmaglapplets.tar.bz2
Type: application/x-tbz
Size: 6523 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20070705/29c39669/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plasma_glapplet.diff
Type: text/x-diff
Size: 10335 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20070705/29c39669/attachment-0001.bin
More information about the Panel-devel
mailing list