MDI MFC degrading performance

I working on a project based on a MFC MDI framework and using OpenGL for drawing (only simple drawing no texturing, vertex shader etc…) Everithing work fine but after some windows creation and destruction the graphic performance of the system go down. I check all wglMakeCurrent and wglRelease… call’s and nothing is wrong. Any suggestion ?

Try using 1 OpenGL context shared amoung all of the views.

For multiple contexts, I had a similar problem when calling wglMakeCurrent before deleteing the context in OnDestroy. Graphics would get slow after 4 or 5 times. I mapped a close message and delete the context before any window destruction.


Thanks for the suggestion. But about the first suggestion “try to use only 1 RC…” in each MSDN etc… documentation all plubliser fix the attention on the fact that the RC must be per Thread or translating in MFC way per CView… In which way you thinck to share RC across Thread (mutex + multithreading ?). Thancks in advance and sorry for my poor english.