Cloudef / wlc

High-level Wayland compositor library
MIT License
330 stars 58 forks source link

Custom rendering #189

Closed kozec closed 8 years ago

kozec commented 8 years ago

Hello,

I'm trying to create WM with little more advanced rendering options and I'd like to override this block of repaint method

Is there some suggested way how to do that?

From what I understood from source, wlc_output_schedule_repaint is called from many places and that causes repaint to be called on later time, but it doesn't looks like there is way to intercept it. repaint method then emits two events, but neither of those has return value and panting is done entirely inside of library.

Cloudef commented 8 years ago

See output_render_pre and output_render_post callbacks, there is somewhat small example of using pre callback here https://github.com/Cloudef/wlc/blob/master/tests/wl-extension.c

From wlc-render.h:

/**
 * The functions in this file provide some basic rendering capabilities.
 * *_render(), *_read(), *_write() functions should only be called during post/pre render callbacks.
 * wlc_output_schedule_render() is exception and may be used to force wlc to render new frame (causing callbacks to trigger).
 *
 * For more advanced drawing you should directly use GLES2.
 * This is not documented as it's currently relying on the implementation details of wlc.
 */
kozec commented 8 years ago

I'm currently using output_render_post, where code simply clears output and redraws everything in different way.

But that means that everything is drawn two times, once by wlc library and once by my code. I'd like to skip that first draw, but it doesn't looks like it can be done just by using callbacks.

Cloudef commented 8 years ago

Nope, at that point I would really consider using libweston instead, the views being drawn and handled for you is sort of point of wlc.

kozec commented 8 years ago

Ok, I understand, I'll try that. Thank you anyway :)

kozec commented 8 years ago

(after finding that libweston doesn't even have api docs... :D)

By the way, would you accept patch that would allow attaching custom shaders (and probably uniform vars and values) to views?