<div dir="ltr"><div><div><div><div><div><div><div><div><div>Neil, thanks a bunch! That did the trick! <br></div><div>In order to get this to work in Python, I sub classed Clutter Actor an added it in the init method. <br></div><br>But it also introduced a different problem: The z clipping is now too close, so <br></div>half of the model is cut off. I've been looking at the set_perspective function for the stage in clutter and<br></div>also tried some combinations of setting the frustum, perspective but with no luck. <br><br></div>Any input on that? <br><br></div>Also, if you have any idea on what to do about rotating the screen, I'm all ears. It might be <br></div>more suited for the Clutter list, but I tried that without getting an answer.. <br></div>My problem is this: The screen is a cell phone screen that has a vertical orientation by default, <br></div>but I need it horizontally. The only way I have found is by adding an actor that covert the stage and rotating and moving <br>that to the right position. The problem is that the touch screen coordinates are then referred to the stage and no longer corresponds <br></div><div>to the box I have added to the stage. Thus buttons do not get pressed etc. <br><br></div><div>Again, any feedback at all would be great : )<br></div><div><br></div><div>BTW, great work on Cogl! I love it!<br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr">Kind regards, <div>-Elias</div></div></div></div>
<br><div class="gmail_quote">2014-11-21 19:53 GMT+01:00 Neil Roberts <span dir="ltr"><<a href="mailto:neil@linux.intel.com" target="_blank">neil@linux.intel.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Elias,<br>
<br>
I think what you need to fix this is the depth buffer. The depth buffer<br>
is a GL feature to avoid painting parts of triangles that are obscured<br>
by something that was painted earlier but is closer to the viewer.<br>
<br>
It's a bit awkward to use the depth buffer with Mash. If you look at the<br>
lights example in the Mash source code you can see two lines where it it<br>
registers a callback before and after the paint signal of the model to<br>
enable and disable depth testing:<br>
<br>
<a href="https://github.com/clutter-project/mash/blob/master/examples/lights.c#L455" target="_blank">https://github.com/clutter-project/mash/blob/master/examples/lights.c#L455</a><br>
<br>
If you do something similar in your application it might just work. I'm<br>
not sure how tricky this is to do in Python.<br>
<br>
However, something to note is that this API to enable and disable the<br>
depth buffer is deprecated in Cogl and it might not be terribly<br>
efficient. The recommended way to do it now is to call<br>
cogl_pipeline_set_depth_state to enable it for the pipeline of the<br>
model. You can get access to the pipeline with mash_model_get_material.<br>
However I'm not sure how well this will work in Python and in practice<br>
it will probably just work fine to use the old deprecated way so I would<br>
recommend just doing that.<br>
<br>
Hope that helps.<br>
<br>
Regards,<br>
- Neil<br>
<div><div class="h5"><br>
Elias Bakken <<a href="mailto:elias.bakken@gmail.com">elias.bakken@gmail.com</a>> writes:<br>
<br>
> Hello, list!<br>
> I've been struggling for a long time with Mash and how to get a model<br>
> looking somewhat natural.<br>
> The only way a model will look is either flat shaded or something that<br>
> looks like transparent, but not quite..<br>
><br>
> I have recently extended Mash to also be able to load .STL models in<br>
> addition to .PLY since this is going to be used for a 3D-printer UI, but my<br>
> limited knowledge of 3D-graphics, shaders and blend strings has caused my<br>
> work to come to a halt.<br>
><br>
> Is there something in the new pipeline API that can cause not visible faces<br>
> to be drawn as well as the visible ones by default? If I set backface<br>
> culling to 1 (COGL_PIPELINE_CULL_FACE_MODE_BACK is not exposed for some<br>
> reason...), then the symptoms disappear, at least for simple model like a<br>
> cube, more complex models still have some "transparency", perhaps since<br>
> there are faces facing the camera...<br>
><br>
> Or is there something wrong with the shader:<br>
> <a href="https://github.com/clutter-project/mash/blob/master/mash/mash-light-set.c#L264" target="_blank">https://github.com/clutter-project/mash/blob/master/mash/mash-light-set.c#L264</a><br>
><br>
> See attachments (hopefully) for with/without backface culling.<br>
> Kind regards,<br>
> -Elias<br>
</div></div>> _______________________________________________<br>
> Cogl mailing list<br>
> <a href="mailto:Cogl@lists.freedesktop.org">Cogl@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/cogl" target="_blank">http://lists.freedesktop.org/mailman/listinfo/cogl</a><br>
_______________________________________________<br>
Cogl mailing list<br>
<a href="mailto:Cogl@lists.freedesktop.org">Cogl@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/cogl" target="_blank">http://lists.freedesktop.org/mailman/listinfo/cogl</a><br>
</blockquote></div><br></div>