[cairo] Mixing Cairo & Traditional 3D:

Jeremy Moles jeremy at emperorlinux.com
Tue Feb 7 16:17:11 PST 2006


I wasn't expecting an immediate response to this or anything, so I'm
just updating it with what I've tried so far. However, if what I'm
trying is impossible at the moment I hope someone will tell me before I
waste the rest of my free time after work trying to get this to go. :)

Firstly, I can successfully use glitz to setup my glX context correctly
to work with both of my "render functions." That is: I can use the code
I modified from cairogears to do the standard DRAWABLE->SURFACE->CONTEXT
dance in glitz and then, in my "render loop", simply make calls to GL
and everything works fine (lets call this function render_gl), never
once using anything to do w/ cairo. My function just spins a triangle on
it's X axis.

Alternatively, I can not make any calls to GL and instead use standard
cairo functions to draw paths, etc (lets call this function
render_cairo). This function creates a big, green X.

What I still can't do, however, is mix the too--even though, as far as I
understand, I should be able to. I'm still very much a newcomer to
Xlib/GL/Cairo, so I could be wrong in my assumptions about how this
should work. I've read through the GLX PDF from SGI, and that's where
I'm getting my information. Furthermore, my older code does a lot of
what glitz does for me--setting up the context, making it "compatible"
w/ X, etc. 

I've updated the link below to reflect the small progress I've made. It
almost works--or rather, the very first frame works. It may not be a
problem w/ glitz+cairo at all, but instead me not doing some steps
between raw GL calls and cairo calls to make the GL "states" sane.

http://www.cherustone.com/cairo.cpp

On Mon, 2006-02-06 at 19:32 -0500, Jeremy Moles wrote:
> I'm not sure if this question has been asked before, but my google-fu
> was weak and I wasn't able to come up with anything.
> 
> I've been thinking about using Cairo (particularly, glitz) as the 2D API
> for a small 3D engine I'm working with. I've been trying to integrate
> glitz (using the code from cairogears) with my 3D engine, but have been
> entirely unsuccessful, mostly in part to my non-understanding of Cairo
> at this low level.
> 
> Does anyone have any code demonstrating this? Or, better, can anyone
> write some very simple psuedocode showing how I should do it? The code
> I'm working with is here (much of it directly from cairogears):
> 
> http://www.cherustone.com/cairo.cpp
> 
> Any help w/ this would be greatly, greatly appreciated.
> 
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://cairographics.org/cgi-bin/mailman/listinfo/cairo



More information about the cairo mailing list