Rendering to Multiple Cwnds

Hi i began writing a program that uses Opengl and everything has been going well. However when I attempt to add another cwnd object to my project, my rendering goes to hell. My scene will no longer draw in either window. Has anyone ever tried rendering to multiple cwnd’s in an mfc project before. If so, do i have to do something special to get my rendering down correctly.

If both windows are in the same thread, then you have to make a call to wglMakeCurrent before doing gl function calls.

To be on the safe side, you function should also make the context non-current

void gl_using_function()
{
wglMakeCurrent(hdc, glrc);
gl…
gl…
gl…
gl…

wglMakeCurrent(NULL, NULL);
}

Read the MSDN docs about wglCreateContext. I think it explains this.

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