Jaymin Kessler - 2013-12-29

I am trying to render from another thread besides the main thread, and I'm getting weird results. If I create the window and render from the main thread, everything works. However, if I create the window and render from one of my workload manager threads, everything renders fine but the window itself looks like its never updated. I get a constant spinning beachball, the window title never shows up, and the x/-/+ window buttons never show up.

I am guaranteeing that the rendering and init only ever takes place on the same worker thread, so I shouldn't have any threading issues. Like I said, the actual rendering seems to be working fine. It just feels like I'm missing something needed to update the window itself

Setup: 2009 Mac Pro, OSX Mavericks, ATI Radeon HD 4870 512 MB

Sample code (all called from my worker thread)

Init:

glfwSetErrorCallback( GlfwErrorHandler );
if( !glfwInit() )
{
    ASSERT_MSG( 0, "glfwInit failed" );
    return -1;
}

m_window = glfwCreateWindow(m_screen_size.x, m_screen_size.y, window_name, NULL, NULL);
if( !m_window )
{
    glfwTerminate( );
    ASSERT_MSG( 0, "glfwTerminate failed" );
    return -1;
}

glfwMakeContextCurrent( m_window );
// set a default projection
Reshape( m_screen_size.x, m_screen_size.y );

Render code (all called from the worker thread):

// draw some stuff

// end of frame
glfwSwapBuffers( m_window );

/* Poll for and process events */
glfwPollEvents( );

Again, rendering is working so I don't think its anything above. Maybe something in the window update is expecting OGL to be on the main thread.