It was one of the most annoying bugs I ever seen.
I took HDC of window on which OGL was rendering only once at program starup.
There was three tabsheets on my Delphian form. When I switched between
first and third tabsheets all was OK. And when I switched between second
and third all was OK. But direct switching between first and second tabsheets
caused DC’s change. And it became no more valid, and that caused SwapBuffers
failure. (I dont do anything on switch, that’s Delphi). But sometimes DC
became valid for a short period of time.
(maybe, DC was switching randomly, sometimes coming to starting value).
When I started doing DC:=GetDC(Handle) each frame all became OK.
But it still isn’t clear.
PS.Should I call ReleaseDC after GetDC?