dotgnu-pnet
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Pnet-developers] Handle problem


From: Rhys Weatherley
Subject: Re: [Pnet-developers] Handle problem
Date: Tue, 12 Oct 2004 08:26:41 +1000
User-agent: KMail/1.4.3

On Tuesday 12 October 2004 06:02 am, Dmitriy wrote:
> How to link(bind) OpenGL to window, which was created with PNET 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 PNET and linux?

Depends upon what you need.  Do you need the X11 window handle or the graphics 
context?  The display pointer?  The "Handle" property on a control should 
work in the Win32 version of pnet winforms to get the HWND, but returns 
IntPtr.Zero in the X11 version.

It is possible to get it via a round-about method.  "Graphics.Hdc" will return 
a GC handle that can be used to access the "Xsharp.Graphics" object 
underneath a control (see the code in 
System.Drawing.Xsharp/DrawingGraphics.cs for details).  From this, you can 
get the drawable handle, display pointer, and other X11 details.

The current interface is perhaps a little awkward, and could be improved by 
returning the drawable handle from "Control.Handle", if that's what you need.

Cheers,

Rhys.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]