OpenGL calls across multiple threads

I am developing a graphics framework and I would like to have a separate thread for my 3D rendering.
I would like to render my 2D stuff from the application’s main thread (or something like UI thread) and all 3D from a separate thread.

I am using opengl es textures for rendering the 2D surface after it is created. So this makes me to use OpenGL ES calls from 2 threads. I am creating separate contexts from both threads and making the context current in their corresponding thread. When eglmakecurrent() is called for the first time from thread 1 it succeeds. When eglmakecurrent() is called again from thread 2 it fails. Any suggestions?

I am using the same surface created from eglCreateWindowSurface() on both the threads.
Is there any other way to mix the 3D and 2D is this environment?

The OS used is Linux.

Thanks,
hbar

An OpenGL context is created for a thread and work for a specific thread. Create 2 OpenGL contexts and share data between them. (wglShareLists under windows, no idea with egl).

Context could be bind on different “surfaces”.

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