Silly questions about Hwnd and HDC

Ivan de Jesus Deras ivan_deras at yahoo.es
Sat Nov 6 02:09:15 CET 2004


You can get an HDC using
1. hDC=GetDC(NULL)

2. hDC=CreateCompatibleDC(NULL) needs ReleaseDC
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/devcons_499f.asp

WinID isn't really needed if you want an HDC ...

--- Ole Jacob Hagen <waterthrill at yahoo.no> escribió: 
> Hi.
> 
> As you already knows, I am making the opengl module.
> But I have encountered some problems. It might be an
> error, bug or just 
> me. ;-)
> 
> To create Context's for rendering, I need to have a
> valid HDC value.
> To get the HDC -value (HDC = handle device context
> for GDI), which can 
> be obtained by:
> GetDC(WinID), where the WinId can be collected from
> winId = 
> ((QWidget*)d->paintDevice)->winId(), or can be set
> to NULL. I've 
> experienced HDC values to 345432, and so on.
> 
> After I've collected the HDC aDc, and WId win,  and
> after choosing, 
> setting and desribing the  pixelformat,then I want
> to create a context, 
> with wglCreateContext(aDc), that has a rendering
> context, named rc as 
> output.
> 
> all these functions fails:
> 
> 1.  ChoosePixelFormat( hdc, pfd )
> 2.  SetPixelFormat( hdc, pixelFormat, pfd ))
> 3.  DescribePixelFormat( hdc, pixelFormat, sizeof(
> PIXELFORMATDESCRIPTOR 
> ), pfd ):
> 4.  wglCreateContext(aDc) fails.
> 
> 1-3 can be found in the method choosePixelFormat,
> while 4 can be found 
> in chooseContext.
> 
> I wonder if there could be something wrong with the
> winId and/or HDC value.
> When I run the gear-example, and prints out the
> winId to the GearWidget, 
> it gives me:
> "gear.cpp: w.winId() = 969982032"
> In the QGLContext::chooseContext( const QGLContext*
> shareContext ), the 
> WinId is equal NULL, or another value.
> They are never the same as the gear.cpp WinId. Is
> this right?
> 
> What behaviour is expected?
> 
> Sorry if my questions are totally wrong, but the
> opengl implementation 
> needs both HDC and WId, to work on windows.
> 
> Cheers,
> 
> Ole J.
> 
> 
> 
> 
> 
> _______________________________________________
> kde-cygwin mailing list
> kde-cygwin at kde.org
> https://mail.kde.org/mailman/listinfo/kde-cygwin
>  


		
______________________________________________
Renovamos el Correo Yahoo!: ¡100 MB GRATIS!
Nuevos servicios, más seguridad
http://correo.yahoo.es


More information about the kde-cygwin mailing list