On Tuesday 07 August 2007 06:54:37 am Alexandre Julliard wrote:
Roderick Colenbrander thunderbird2k@gmx.net writes:
Subject: [PATCH] Move WineD3D_CreateFakeGLContext and friends over to WGL. For this we need a HDC and one received from lets say GetDC(0) won't do. Further this HDC needs CS_OWNDC set. For this reason we need our own window class.
Why does it need CS_OWNDC? That sounds like a bug.
I ran across mailing list posts a while ago talking about OpenGL on Windows, and it mentioned that the window class had to have CS_OWNDC otherwise strange anomolies and crashes could pop up. Stefan Dösinger also said it's implied that D3D windows need the same. Searching google for 'opengl cs_owndc' brought up pages that mentioned buggy drivers need it, and as well, opengl.org's FAQ has it mentioned:
"error: Multiple access violations appear when running a Microsoft OpenGL MFC-based application.
solution: Set the CS_OWNDC style in the PreCreate*() routines in the view class."
http://www.opengl.org/resources/faq/technical/gettingstarted.htm
I can't say I know much about how HDCs work, but since OpenGL operates on HDCs and expects their state to remain constant through the life of the window, wouldn't it be a problem if DCs switched after a call to SetPixelFormat, or while it's part of the current context?