Draw to a GtkGLArea from a different thread

Hello there,

I’m currently trying to get MLT working with my GTK app using OpenGL - it basically creates a thread and fires an event in which you have to make the context current and fire a MLT event yourself afterwards. Here’s a bit of Qt code for reference, showing what I’m exactly trying to do: https://github.com/mltframework/mlt/blob/master/src/modules/qt/consumer_qglsl.cpp If I understand it correctly, it is actually creating a separate, off-screen, shared context - which doesn’t seem to be possible in GTK afaik.

I found out that you can use a GtkGLArea for using OpenGL in GTK, but I think it is designed to be used within the render signal and not from a different thread. I also found this question on SO which seems to describe my issue, but it is still unanswered.

I’m not really sure if this is actually the right approach to solve my problem - I’m still pretty new to OpenGL development :slight_smile:

You cannot use GTK API from different threads.

You can create a GdkGLContext for a specific GtkGLArea, using the GtkGLArea::create-context signal, but the rendering must happen in the same thread.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.