Cairo/OpenGL (was Re: methods for license conversion)

sig siguctua at gmail.com
Mon Jul 9 12:21:40 UTC 2007


On 09/07/07, Bert Freudenberg <bert at freudenbergs.de> wrote:
> On Jul 9, 2007, at 1:10 , sig wrote:
>
> > On 06/07/07, Blake <blake at kingdomrpg.com> wrote:
> >> On Thu, 05 Jul 2007 14:14:50 -0700, tim Rowledge
> >> <tim at rowledge.org> wrote:
> >>
> >> > Don't know the answer to that one; I was under the impression
> >> that Cairo
> >> > was 'just' graphics but I haven't really researched it per se.
> >> Given
> >>
> >> It's vector graphics, though you can build a UI with it. I
> >> (incorrectly)
> >> thought it mapped to native tools.
> >>
> > About Cairo, as noted on site:
> > Cairo is a 2D graphics library with support for multiple output
> > devices. Currently supported output targets include the X Window
> > System, Win32, image buffers, PostScript, PDF, and SVG file output.
> > Experimental backends include OpenGL (through glitz), Quartz, and XCB.
> >
> > 1 fact: i assume it proposes a cross-platform layer of abstraction on
> > top of existing graphics libraries (like DirecX/OpenGL whatever).
> > 2nd fact, i dont like: its 2D only.
>
> Since Morphic is 2D, too, that's a perfect match.
>
Yes, its 2D. Currently :)

> > I prefer to directly use OpenGL (which is already a cross-platform)
> > and provides enough capabilities to develop a UI using 2D graphics or
> > 3D (like composite desktops/games e.t.c). I think using OpenGL
> > directly for creating UI is better choice for squeak.
> > I implemented a scratch replacement of Canvas/Display stuff to use GL
> > via FFI for drawing morphic with squeak. Premiliary, based on rough
> > calculations it renders desktop 3 to 5 times faster than currently
> > used Balloon/BitBlt.
>
> Nice. I'd expect roughly the same from a native Cairo back-end.
>
> > Also, i noticed that changes needed to make use
> > of GL with morphic architecture is minimal, and opening a wide range
> > perspective for creating a stunning and fast UI for squeak, not
> > limited by third-party libraries, which providing own abstraction
> > layer(s).
>
> If speed is all you care about, then I agree. Recreating the quality
> Cairo provides based on an OpenGL layer is hard, though. Cairo is not
> so much about abstraction, but about providing a consistent rendering
> model and reliable high-quality results on any 2D output device from
> screen to printers.
>

But its only 2D. This is the point i don't like. For any application
where you need 3D, you have to use another external library, which
provides 3D API for your needs. And then you have to implement two
rendering models sitting at your head - 2D and 3D, and both supported
by different native libraries and 99% chances their not compatible, so
you actually will try to drive your car using two wheels instead of
one.
So, you finish up with using different native windows for rendering
3D. And when you want a 2D UI elements in your 3D windows - we are at
same 'invent wheel' point where we was before, because nobody having
support of it in natural way.

>From what i see, by using OpenGL as back-end i already having 2D
support, but on top of that i can use 3D, seamlessly mixing it with
2D. So you may have both 2D and 3D morphs/graphics in same window,
which much easier to develop , because you having single model. And
developing a 3D application which uses 2D UI will be much easier and
show better performance if you use single API for it, because you
don't need to transfer images from one rendering engine to another.

> > Anyways, to use modern graphics cards features with squeak, we have no
> > choice but to use some of the existing external libraries.
>
> Agreed.
>
> > And OpenGL is a winner here, without a doubt.
>
> I beg to differ. For one, there are two major platform with
> unreliable OpenGL hw support.
>
> But more importantly, OpenGL goes for quick-and-dirty, whereas Cairo
> does the-right-thing. Cairo chooses quality and reliability over raw
> performance (while performance still is adequate for interactive
> use). For a comparison and introduction see, for example,
>
>         http://people.freedesktop.org/~keithp/tutorials/cairo/cairo-
> tutorial.pdf
>
> This is not to say OpenGL is useless, far from it. But for high-
> quality 2D graphics, Cairo is clearly the better choice, *and* it's
> simple to use both if you need both 2D and 3D graphics:
>
>         http://cairographics.org/OpenGL/
>
> The current Cairo-backed graphics system for Squeak ("Rome") uses the
> software rasterizer of Cairo, which does not give a lot of speed-up
> (but looks awesome). However, folks at impara have combined Rome and
> HostWindows, thus rendering directly to OS windows using Cairo. That
> should be much faster while still providing high quality. Not sure of
> the current state of this, though.
>
> - Bert -
>
>
>
>



More information about the Squeak-dev mailing list