dsound: Add eax properties
[wine/multimedia.git] / dlls / gdi32 / opengl.c
blob1db261e14bedcc916285542c8debae88f8d1b1c3
1 /*
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
23 #include "config.h"
24 #include "wine/port.h"
26 #include <stdarg.h>
27 #include <string.h>
28 #include <stdlib.h>
30 #include "windef.h"
31 #include "winbase.h"
32 #include "wingdi.h"
33 #include "winerror.h"
34 #include "winternl.h"
35 #include "winnt.h"
36 #include "gdi_private.h"
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(wgl);
41 static const WCHAR opengl32W[] = {'o','p','e','n','g','l','3','2','.','d','l','l',0};
42 static HMODULE opengl32;
43 static INT (WINAPI *wglChoosePixelFormat)(HDC,const PIXELFORMATDESCRIPTOR *);
44 static INT (WINAPI *wglDescribePixelFormat)(HDC,INT,UINT,PIXELFORMATDESCRIPTOR*);
45 static INT (WINAPI *wglGetPixelFormat)(HDC);
46 static BOOL (WINAPI *wglSetPixelFormat)(HDC,INT,const PIXELFORMATDESCRIPTOR*);
47 static BOOL (WINAPI *wglSwapBuffers)(HDC);
49 /***********************************************************************
50 * __wine_get_wgl_driver (GDI32.@)
52 const struct wgl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version )
54 const struct wgl_funcs *ret = NULL;
55 DC * dc = get_dc_ptr( hdc );
57 if (dc)
59 PHYSDEV physdev = GET_DC_PHYSDEV( dc, wine_get_wgl_driver );
60 ret = physdev->funcs->wine_get_wgl_driver( physdev, version );
61 release_dc_ptr( dc );
63 return ret;
66 /******************************************************************************
67 * ChoosePixelFormat (GDI32.@)
69 INT WINAPI ChoosePixelFormat( HDC hdc, const PIXELFORMATDESCRIPTOR *pfd )
71 if (!wglChoosePixelFormat)
73 if (!opengl32) opengl32 = LoadLibraryW( opengl32W );
74 if (!(wglChoosePixelFormat = (void *)GetProcAddress( opengl32, "wglChoosePixelFormat" )))
75 return 0;
77 return wglChoosePixelFormat( hdc, pfd );
80 /******************************************************************************
81 * DescribePixelFormat (GDI32.@)
83 INT WINAPI DescribePixelFormat( HDC hdc, INT fmt, UINT size, PIXELFORMATDESCRIPTOR *pfd )
85 if (!wglDescribePixelFormat)
87 if (!opengl32) opengl32 = LoadLibraryW( opengl32W );
88 if (!(wglDescribePixelFormat = (void *)GetProcAddress( opengl32, "wglDescribePixelFormat" )))
89 return 0;
91 return wglDescribePixelFormat( hdc, fmt, size, pfd );
94 /******************************************************************************
95 * GetPixelFormat (GDI32.@)
97 INT WINAPI GetPixelFormat( HDC hdc )
99 if (!wglGetPixelFormat)
101 if (!opengl32) opengl32 = LoadLibraryW( opengl32W );
102 if (!(wglGetPixelFormat = (void *)GetProcAddress( opengl32, "wglGetPixelFormat" )))
103 return 0;
105 return wglGetPixelFormat( hdc );
108 /******************************************************************************
109 * SetPixelFormat (GDI32.@)
111 BOOL WINAPI SetPixelFormat( HDC hdc, INT fmt, const PIXELFORMATDESCRIPTOR *pfd )
113 if (!wglSetPixelFormat)
115 if (!opengl32) opengl32 = LoadLibraryW( opengl32W );
116 if (!(wglSetPixelFormat = (void *)GetProcAddress( opengl32, "wglSetPixelFormat" )))
117 return 0;
119 return wglSetPixelFormat( hdc, fmt, pfd );
122 /******************************************************************************
123 * SwapBuffers (GDI32.@)
125 BOOL WINAPI SwapBuffers( HDC hdc )
127 if (!wglSwapBuffers)
129 if (!opengl32) opengl32 = LoadLibraryW( opengl32W );
130 if (!(wglSwapBuffers = (void *)GetProcAddress( opengl32, "wglSwapBuffers" )))
131 return 0;
133 return wglSwapBuffers( hdc );