[Cogl] Shader and blend string in Mash

Elias Bakken elias.bakken at gmail.com
Sat Nov 22 09:53:47 PST 2014


Neil, thanks a bunch! That did the trick!
In order to get this to work in Python, I sub classed Clutter Actor an
added it in the init method.

But it also introduced a different problem: The z clipping is now too
close, so
half of the model is cut off. I've been looking at the set_perspective
function for the stage in clutter and
also tried some combinations of setting the frustum, perspective but with
no luck.

Any input on that?

Also, if you have any idea on what to do about rotating the screen, I'm all
ears. It might be
more suited for the Clutter list, but I tried that without getting an
answer..
My problem is this: The screen is a cell phone screen that has a vertical
orientation by default,
but I need it horizontally. The only way I have found is by adding an actor
that covert the stage and rotating and moving
that to the right position. The problem is that the touch screen
coordinates are then referred to the stage and no longer corresponds
to the box I have added to the stage. Thus buttons do not get pressed etc.

Again, any feedback at all would be great : )

BTW, great work on Cogl! I love it!

Kind regards,
-Elias

2014-11-21 19:53 GMT+01:00 Neil Roberts <neil at linux.intel.com>:

> Hi Elias,
>
> I think what you need to fix this is the depth buffer. The depth buffer
> is a GL feature to avoid painting parts of triangles that are obscured
> by something that was painted earlier but is closer to the viewer.
>
> It's a bit awkward to use the depth buffer with Mash. If you look at the
> lights example in the Mash source code you can see two lines where it it
> registers a callback before and after the paint signal of the model to
> enable and disable depth testing:
>
> https://github.com/clutter-project/mash/blob/master/examples/lights.c#L455
>
> If you do something similar in your application it might just work. I'm
> not sure how tricky this is to do in Python.
>
> However, something to note is that this API to enable and disable the
> depth buffer is deprecated in Cogl and it might not be terribly
> efficient. The recommended way to do it now is to call
> cogl_pipeline_set_depth_state to enable it for the pipeline of the
> model. You can get access to the pipeline with mash_model_get_material.
> However I'm not sure how well this will work in Python and in practice
> it will probably just work fine to use the old deprecated way so I would
> recommend just doing that.
>
> Hope that helps.
>
> Regards,
> - Neil
>
> Elias Bakken <elias.bakken at gmail.com> writes:
>
> > Hello, list!
> > I've been struggling for a long time with Mash and how to get a model
> > looking somewhat natural.
> > The only way a model will look is either flat shaded or something that
> > looks like transparent, but not quite..
> >
> > I have recently extended Mash to also be able to load .STL models in
> > addition to .PLY since this is going to be used for a 3D-printer UI, but
> my
> > limited knowledge of 3D-graphics, shaders and blend strings has caused my
> > work to come to a halt.
> >
> > Is there something in the new pipeline API that can cause not visible
> faces
> > to be drawn as well as the visible ones by default? If I set backface
> > culling to 1 (COGL_PIPELINE_CULL_FACE_MODE_BACK is not exposed for some
> > reason...), then the symptoms disappear, at least for simple model like a
> > cube, more complex models still have some "transparency", perhaps since
> > there are faces facing the camera...
> >
> > Or is there something wrong with the shader:
> >
> https://github.com/clutter-project/mash/blob/master/mash/mash-light-set.c#L264
> >
> > See attachments (hopefully) for with/without backface culling.
> > Kind regards,
> > -Elias
> > _______________________________________________
> > Cogl mailing list
> > Cogl at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/cogl
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/cogl/attachments/20141122/d8f80992/attachment.html>


More information about the Cogl mailing list