[Mono-winforms-list] Handle Problem

Miguel de Icaza miguel@ximian.com
Tue, 12 Oct 2004 11:09:22 -0400


Hello,

> How to link(bind) OpenGL to window, which was created with MONO SWF?
> 
> for Windows and Microsoft .NET it is not a problem:
> We get a handle from window in C# code and in C++ code
> void Create(HWND hwnd)
> {
>   dc=GetDC(cwnd);
> 
>   int iPixelFormat = ChoosePixelFormat(dc,&rPFD);
>   if(!SetPixelFormat(dc,iPixelFormat,&rPFD)) FAIL("SetPixelFormat failed!");
>   if(!(hRC = wglCreateContext(dc))) FAIL("wglCreateContext failed!");
> //we have OpenGL context
> }
> 
> How TODO so under mono and linux?

Well, today Windows.Forms is not completed so I would not claim that you
can do this.  But thanks for pointing this out, if you could write a
complete sample, then we will make sure that the same mechanism is
available on Windows.Forms.

That being said, it seems that the above is too specific to Windows, as
the same concept of a "DC" does not exist in X windows.  The best thing
to do would be to pass the HWND (which we probably are mapping to X IDs
on X).

Where does `wglCreateContext' come from?