2 * OpenGL function forwarding to the display driver
4 * Copyright (c) 1999 Lionel Ulmer
5 * Copyright (c) 2005 Raphael Junqueira
6 * Copyright (c) 2006 Roderick Colenbrander
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
33 #include "gdi_private.h"
36 static HMODULE opengl32
;
37 static INT (WINAPI
*wglChoosePixelFormat
)(HDC
,const PIXELFORMATDESCRIPTOR
*);
38 static INT (WINAPI
*wglDescribePixelFormat
)(HDC
,INT
,UINT
,PIXELFORMATDESCRIPTOR
*);
39 static INT (WINAPI
*wglGetPixelFormat
)(HDC
);
40 static BOOL (WINAPI
*wglSetPixelFormat
)(HDC
,INT
,const PIXELFORMATDESCRIPTOR
*);
41 static BOOL (WINAPI
*wglSwapBuffers
)(HDC
);
43 /***********************************************************************
44 * __wine_get_wgl_driver (GDI32.@)
46 struct opengl_funcs
* CDECL
__wine_get_wgl_driver( HDC hdc
, UINT version
)
48 struct opengl_funcs
*ret
= NULL
;
49 DC
* dc
= get_dc_ptr( hdc
);
53 PHYSDEV physdev
= GET_DC_PHYSDEV( dc
, wine_get_wgl_driver
);
54 ret
= physdev
->funcs
->wine_get_wgl_driver( physdev
, version
);
60 /******************************************************************************
61 * ChoosePixelFormat (GDI32.@)
63 INT WINAPI
ChoosePixelFormat( HDC hdc
, const PIXELFORMATDESCRIPTOR
*pfd
)
65 if (!wglChoosePixelFormat
)
67 if (!opengl32
) opengl32
= LoadLibraryW( L
"opengl32.dll" );
68 if (!(wglChoosePixelFormat
= (void *)GetProcAddress( opengl32
, "wglChoosePixelFormat" )))
71 return wglChoosePixelFormat( hdc
, pfd
);
74 /******************************************************************************
75 * DescribePixelFormat (GDI32.@)
77 INT WINAPI
DescribePixelFormat( HDC hdc
, INT fmt
, UINT size
, PIXELFORMATDESCRIPTOR
*pfd
)
79 if (!wglDescribePixelFormat
)
81 if (!opengl32
) opengl32
= LoadLibraryW( L
"opengl32.dll" );
82 if (!(wglDescribePixelFormat
= (void *)GetProcAddress( opengl32
, "wglDescribePixelFormat" )))
85 return wglDescribePixelFormat( hdc
, fmt
, size
, pfd
);
88 /******************************************************************************
89 * GetPixelFormat (GDI32.@)
91 INT WINAPI
GetPixelFormat( HDC hdc
)
93 if (!wglGetPixelFormat
)
95 if (!opengl32
) opengl32
= LoadLibraryW( L
"opengl32.dll" );
96 if (!(wglGetPixelFormat
= (void *)GetProcAddress( opengl32
, "wglGetPixelFormat" )))
99 return wglGetPixelFormat( hdc
);
102 /******************************************************************************
103 * SetPixelFormat (GDI32.@)
105 BOOL WINAPI
SetPixelFormat( HDC hdc
, INT fmt
, const PIXELFORMATDESCRIPTOR
*pfd
)
107 if (!wglSetPixelFormat
)
109 if (!opengl32
) opengl32
= LoadLibraryW( L
"opengl32.dll" );
110 if (!(wglSetPixelFormat
= (void *)GetProcAddress( opengl32
, "wglSetPixelFormat" )))
113 return wglSetPixelFormat( hdc
, fmt
, pfd
);
116 /******************************************************************************
117 * SwapBuffers (GDI32.@)
119 BOOL WINAPI
SwapBuffers( HDC hdc
)
123 if (!opengl32
) opengl32
= LoadLibraryW( L
"opengl32.dll" );
124 if (!(wglSwapBuffers
= (void *)GetProcAddress( opengl32
, "wglSwapBuffers" )))
127 return wglSwapBuffers( hdc
);