Re: The best/standard way to use opengl in gtk



On Thu, 2010-09-30 at 16:08 +0100, Jeremy Henty wrote:

> I would  *not* recommend using  clutter for 3D modeling  software.

neither would I.

>   At
> work  I recently  had to  profile various  approaches to  GTK canvases
> (gdk,  foocanvas,  goocanvas,  clutter,  gtkglext).  We  write  genome
> browsers so we *have* to render thousands of items quickly.  I imagine
> 3D modeling  software would have  similar constraints.  We gave  up on
> clutter because of its performance.  Not only did it render slowly but
> creating a new  clutter item was O(number of  already existing items).

it's a scene graph: what did you expect? :-p

granted, we're using the painters algorithm when we should be using more
efficient ways of submitting geometry to the GPU - and we're working
into implementing that[0], but at the end of the day any actor needs to
be reachable through a graph.

if you want to draw elements you might want to use a single actor and
then use a VBO through the Cogl API - but, then again, you can use GL
directly with GtkGLExt.

it would make sense to use Clutter for the main modeling view if and
only if the rest of the application UI was using Clutter.

> GtkGlext was the only approach  that offered any hope of significantly
> improving on good old foocanvas.

clearly, since you need to drop down into raw GL, and that's all
GtkGLExt provides.

> Clutter seems to be focussed on eye-candy.

"eye-candy" has generally negative connotations. Clutter is meant to be
used to create compelling and dynamical user interfaces; it's an
equivalent to CoreAnimation on Quartz and WPF on Win32. would you create
a 3D modeling software using CALayers?

> BTW, if  you profile  clutter then be  careful: for most  toolkits you
> time the expose event handler, but in clutter that just sends an alert
> to  a separate  clutter animation  event stream  and triggers  a paint
> event handler.  Make sure you profile the right thing!

on X11 you get an expose event for real windows; in Clutter, the only
Window, as far as X11 is concerned, is the one implicitly created by a
Stage. gtk+ 2.x too has moved away from sub-windows; and in 3.x gtk
moves away from expose events delivered to widgets, in favour of a
Clutter-like approach of top-down "draw" calls sent to each widget.

ciao,
 Emmanuele.

[0] http://wiki.clutter-project.org/wiki/Cogl_Render_Lists

-- 
W: http://www.emmanuelebassi.name
B: http://blogs.gnome.org/ebassi



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]