I am writing to you from Singapore.I need you help.
I have a problem with OpenGL and MFC, which has driven me mad.
I am developing a multi-document application with opengl display for a
research project. I create a CDisplayView class for OpenGLdisplay.
CDisplayView is instanced in 4 split windows.
When I run the application, everything looks fine with different 3D
objects in the 4 views. But, when I shut down and restart my computer,and
runsystem(CTRL-F5), objects in one window was frozen which are supposed to
rotate with mouse movement. The rest 3 windows are ok. Tracing down the
problem, I find it is because "wglMakeCurrent (m_HDC, m_HGLRC )" is failed
(return 0). However both m_HDC and m_HGLRC are valid (passed by VERIFY).
Sometimes I find the error code is 2000, which means invalid pixles. But
it works fine for the other three windows.
Strange enough, I run it in debug mode (F5), It's all ok. Once run and
pass by F5, it becomes to response correctly all the way by CTRL-F5.
The same story repeats when I restart my computer.
Would you please give me any indication or help.
Thanks in advance.
Ju Feng
CAE/CAD/CAM Centre
National University of Singapore
also, when wglmakecurrent returns 0, call getlasterror, and see what the
error was.
--
alen
Each window has its own context.
The code was 2000, a pixle-related error.
Thanks again.
Ju Feng
Alen Ladavac (e...@nospam.marvin.cc.fer.hr) wrote:
: which opengl card/driver are you running that on? perhaps there is a bug in
oh, that is the "invalid pixel format" error code. are you calling
SetPixelFormat() on each window before you create its context? have you set
the CS_OWNDC flag for the window class of those windows?
--
alen
Yes, I call SetPixelFormat() each time create the context?
would you please show me how to set CS_OWNDC style? It seems like for
older version.
thanks
ju feng