OpenGL renderer: handling subwindow messages
On windows we need to have a thread on the renderer process which handles windows messages sent to the subwindow we are creating during framebuffer initialization. We run this message pump in the main renderer thread and the server listener on a seperate thread.
This commit is contained in:
committed by
Guy Zadickario
parent
4672adab3f
commit
15680c5e69
@@ -73,7 +73,7 @@ public:
|
|||||||
|
|
||||||
EGLDisplay getDisplay() const { return m_eglDisplay; }
|
EGLDisplay getDisplay() const { return m_eglDisplay; }
|
||||||
EGLContext getContext() const { return m_eglContext; }
|
EGLContext getContext() const { return m_eglContext; }
|
||||||
|
EGLNativeWindowType getSubWindow() const { return m_subWin; }
|
||||||
bool bind_locked();
|
bool bind_locked();
|
||||||
bool unbind_locked();
|
bool unbind_locked();
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,32 @@ int main(int argc, char *argv[])
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
//
|
||||||
|
// run the server listener loop
|
||||||
|
//
|
||||||
server->Main(); // never returns
|
server->Main(); // never returns
|
||||||
|
#else
|
||||||
|
//
|
||||||
|
// on windows we need to handle messages for the
|
||||||
|
// created subwindow. So we run the server on a seperate
|
||||||
|
// thread and running the windows message pump loop
|
||||||
|
// in this main thread.
|
||||||
|
//
|
||||||
|
server->start();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Dispatch events for the subwindow
|
||||||
|
//
|
||||||
|
MSG msg;
|
||||||
|
HWND hWnd = FrameBuffer::getFB()->getSubWindow();
|
||||||
|
bool done = 0;
|
||||||
|
while(!done) {
|
||||||
|
GetMessage(&msg, hWnd, 0, 0);
|
||||||
|
TranslateMessage(&msg);
|
||||||
|
DispatchMessage(&msg);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user