WineD3D: move fake context code over to WGL

Joseph Garvin k04jg02 at kzoo.edu
Wed Aug 8 00:43:42 CDT 2007


Alexandre Julliard wrote:
> Roderick Colenbrander <thunderbird2k at 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 came across this today in the wxWidgets library. Although it's not 
clear it affects newer windows versions, this comment tries to explain, 
quoting src/msw/glcanvas.cpp:

  /*
  From Angel Popov <jumpo at bitex.com>
 
  Here are two snips from a dicussion in the OpenGL Gamedev list that 
explains
  how this problem can be fixed:
 
  "There are 5 common DCs available in Win95. These are aquired when you 
call
  GetDC or GetDCEx from a window that does _not_ have the OWNDC flag.
  OWNDC flagged windows do not get their DC from the common DC pool, the 
issue
  is they require 800 bytes each from the limited 64Kb local heap for GDI."
 
  "The deal is, if you hold onto one of the 5 shared DC's too long (as 
GL apps
  do), Win95 will actually "steal" it from you.  MakeCurrent fails,
  apparently, because Windows re-assigns the HDC to a different window.  
The
  only way to prevent this, the only reliable means, is to set CS_OWNDC."
  */




More information about the wine-devel mailing list