I have asked this question on the beginner’s thread but not much luck so far. Maybe someone here could help me further.
I’m working on a simple application (let’s call that app. A) that will be launched from within a host application (let’s call that app. H). Both applications have an own OpenGL control to render some technical stuff on it.
When I launch A from outside of H, everything displays well on A’s canvas. However, when I launch it from within H, its OpenGL becomes black and nothing can be drawn on it.
A thread can have one current rendering context. A process can have multiple rendering contexts by means of multithreading. A thread must set a current rendering context before calling any OpenGL functions. Otherwise, all OpenGL calls are ignored.
Change your code to call wglMakeCurrent(rc) before refresh and wglMakeCurrent(NULL) after SwapBuffers. This will ensure that there is no overlapped RC’s in same thread. So…
H: event OnPaint