multiple rendering contexts
I have two windows I would like to render to, each with their own HDC.
I tried switching to the second window during rendering doing:
wglMakeCurrent(hDCSecondWindow, hRC);
where hRC is the only one created for both windows, but was created when the first hDC was made.
I do this but nothing shows up in the second window, and rendering in the first window stops.
How can I use the same hRC for both windows, but have rendering switch between the two ?
I've read before that you can have a single rendering context, but multiple HDCs. Anybody know how to do this correctly ?
Well I created and initialized 2 HDCs and 2 HGLRCs, but when I call wglMakeCurrent , my app crashes.
Here's the code
Here's the code
HDC MeshPreviewhDC, ViewporthDC;HGLRC MeshPreviewhRC, ViewporthRC;void Init(){ MeshPreviewhDC = GetDC(PanelMeshPreview->Handle); PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, 32, 0,0,0,0,0,0, 0,0, 0,0,0,0,0, 32, 0, 0, PFD_MAIN_PLANE, 0, 0,0, }; int PixelFormat = ChoosePixelFormat(MeshPreviewhDC, &pfd); SetPixelFormat(MeshPreviewhDC, PixelFormat, &pfd); MeshPreviewhRC = wglCreateContext(MeshPreviewhDC); if(MeshPreviewhRC == NULL) ShowMessage("hRC == NULL"); if(wglMakeCurrent(MeshPreviewhDC, MeshPreviewhRC) == false) ShowMessage("MakeCurrent failed."); ViewporthDC = GetDC(Viewport->Handle); PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, 32, 0,0,0,0,0,0, 0,0, 0,0,0,0,0, 32, 0, 0, PFD_MAIN_PLANE, 0, 0,0, }; int PixelFormat = ChoosePixelFormat(ViewporthDC, &pfd); SetPixelFormat(ViewporthDC, PixelFormat, &pfd); ViewporthRC = wglCreateContext(ViewporthDC); if(MeshPreviewhRC == NULL) ShowMessage("hRC == NULL"); if(wglMakeCurrent(ViewporthDC, ViewporthRC) == false) ShowMessage("MakeCurrent failed.");}void Render(){ wglMakeCurrent(ViewporthDC, ViewportRC); // render stuff wglMakeCurrent(MeshPreviewhDC, ViewportRC); // render stuff}The error I get is an error with atioglxx.dll
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement