wince port, glcanvas position not changing

Selçuk Cihan selcukcihan at gmail.com
Tue Feb 12 08:54:38 PST 2008


On Feb 7, 2008 4:49 PM, Vadim Zeitlin <vadim at wxwidgets.org> wrote:
>  I know absolutely nothing about OpenGL ES but my guess would be that you
> need to call some ES function to synchronize its idea of where the viewport
> is with the real window rectangle because the code you show should position
> the window correctly (but why not add some wxLogMessage(GetPosition()) to
> make certain).

I have looked for some functionality in OpenglES and EGL that would
solve my problem and there seems to be none.

I have used GetPosition and the position was correct; however the
canvas does not show up at the position returned by GetPosition. I
have noticed that i altered the code(and forgot about it) in
wxglmodule class slightly: at bool wxGLModule::RegisterClasses() there
is a line that should read     wndclass.style         = CS_HREDRAW |
CS_VREDRAW | CS_DBLCLKS | CS_OWNDC;

unfortunately, CS_OWNDC does not exist on windows mobile and i
commented it out. I am not sure if that is the problem, but i have
tried the desktop version with CS_OWNDC commented out, the result was
ok, i mean canvas position was correct. However it may be the case
that the position was correct just by chance, so i can not really be
sure. In wxGLModule code, there is a piece of comment saying that

    // We have to register a special window class because we need the CS_OWNDC
    // style for GLCanvas.

  /*
  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."
  */

Lastly, i have noticed a difference in the execution of my application
for mobile and for desktop. In desktop, when i call Update() on
TestGLCanvas::OnSize event, the execution reaches
TestGLCanvas::OnPaint event. However; on windows mobile, when Update()
is called, TestGLCanvas::OnPaint event is not triggered.

Still, any ideas are truely appreciated. Have a nice day.




More information about the wx-users mailing list