<p><br>
On Apr 8, 2012 3:33 AM, &quot;Martin Owens&quot; &lt;<a href="mailto:doctormo@gmail.com">doctormo@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Hey Cogl Devs, (Just Robert and Neil?)<br>
&gt;<br>
&gt; Version: libcogl9 1.10.0 / gir1.2-cogl-1.0<br>
&gt;<br>
&gt; I&#39;m using Cogl using gobject introspection, in conjunction with Clutter.<br>
&gt; But I&#39;m having a problem using materials. Trying to do anything with<br>
&gt; Cogl objects causes a segfault, anything at all. Which means things<br>
&gt; like:<br>
&gt;<br>
&gt; m = ClutterTexture.get_cogl_material()<br>
&gt; Cogl.set_source(m)<br>
&gt;<br>
&gt; works ok, but:<br>
&gt;<br>
&gt; m.set_color4ub(255, 255, 255, 128)<br>
&gt; Cogl.Material.set_color4ub(m, 255, 255, 255, 128)<br>
&gt; print m<br>
&gt;<br>
&gt; Cause SEGFAULTS in Py_GetAttr, recursive_isinstance,  PyFile_WriteObject<br>
&gt; respectively.<br>
&gt;<br>
&gt; I did manage to workaround the SEGFAULT caused by cogl trying to unref<br>
&gt; the material after it had existed in python. Using the `del m` to remove<br>
&gt; it completely from the python namespace stops the odd duality.<br>
&gt;<br>
&gt; Literally looking at cogl-material in the wrong way causes it to blow up<br>
&gt; in ones face. I wonder what Clutter does that Cogl needs, maybe some<br>
&gt; sort of cooling rod ;-). Any ideas either working around these issues or<br>
&gt; trying to debug them using gdb, I&#39;d be open to tracking through them.<br>
&gt;<br>
&gt; Best Regards, Martin Owens<br></p>
<p>Hi Martin,</p>
<p>We&#39;ve only recently started looking at language bindings for Cogl so I&#39;m sorry that at the moment things aren&#39;t as simple as you might wish if you aren&#39;t using C.</p>
<p>The thing is Cogl doesn&#39;t use gobject and so gobject intospection doesn&#39;t really work for us to create language bindings. We have a few boxed types really just to allow clutter&#39;s api to expose CoglMaterial and CoglMatrix but it&#39;s not surprising to me that they fall apart if you give them a funny look.</p>

<p>Because our api doesn&#39;t follow a lot of classic gobject api patterns I&#39;m not really sure how far we can get using gobject introspection for full cogl bindings. I&#39;m not sure that just shoe horning cogl through g-i by creating dummy boxed types is going to have a great result. It might give us bindings a bit quicker than doing them manually but I think perhaps they would be a bad fit.</p>

<p>I was recently hoping to at least try and use the .gir data as a basis for v8 bindings I was working on but really hit a brick wall with using the scanner to get the data I wanted and at this point I&#39;m thinking it will just be simpler for us to use somthing like c2xml to extract an initial markup for our api and extend that with annotations by hand for our specific use cases. </p>

<p>Similarly for java bindings Neil found a pretty elegant way of marking up the cogl api using java annotations for the front-end api and then the compiler has some tricks to programatically access those annotations so we can generate final bindings.</p>

<p>Since I also find it disapointing how locked away the gtk-doc annotations we have in Cogl are currently I&#39;ve recently been looking at doing a one-off export of all our gtk-doc data into a simple xml schema which we can combine with the markup of the prototypes and I&#39;m interested to find out if that would be good enough for us to then generate our bindings and html documentation from.</p>

<p>I guess that this is perhaps not the answer you were hoping for but I hope it gives some insight into what we&#39;ve been thinking and toying with recently.</p>
<p>If there is a strong interest in g-i based bindings specifically then certainly we&#39;d be open to ideas and help figuring out if it would be workable, but at the moment I think perhaps Cogl breaks too many assumptions about gobject based apis that it&#39;s possibly not the right tool to try and use for us.</p>

<p>Kind regards,<br>
- Robert</p>
<p>&gt;<br>
&gt; _______________________________________________<br>
&gt; Cogl mailing list<br>
&gt; <a href="mailto:Cogl@lists.freedesktop.org">Cogl@lists.freedesktop.org</a><br>
&gt; <a href="http://lists.freedesktop.org/mailman/listinfo/cogl">http://lists.freedesktop.org/mailman/listinfo/cogl</a><br>
</p>