ddraw/tests: Add another invalid arguments test for surface QI.
[wine.git] / dlls / gdi32 / opengl.c
blob578737994ab015b2218de422c5ed7d63dc8c9887
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"
39 static const WCHAR opengl32W[] = {'o','p','e','n','g','l','3','2','.','d','l','l',0};
40 static HMODULE opengl32;
41 static INT (WINAPI *wglChoosePixelFormat)(HDC,const PIXELFORMATDESCRIPTOR *);
42 static INT (WINAPI *wglDescribePixelFormat)(HDC,INT,UINT,PIXELFORMATDESCRIPTOR*);
43 static INT (WINAPI *wglGetPixelFormat)(HDC);
44 static BOOL (WINAPI *wglSetPixelFormat)(HDC,INT,const PIXELFORMATDESCRIPTOR*);
45 static BOOL (WINAPI *wglSwapBuffers)(HDC);
47 /***********************************************************************
48 * __wine_get_wgl_driver (GDI32.@)
50 struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version )
52 struct opengl_funcs *ret = NULL;
53 DC * dc = get_dc_ptr( hdc );
55 if (dc)
57 PHYSDEV physdev = GET_DC_PHYSDEV( dc, wine_get_wgl_driver );
58 ret = physdev->funcs->wine_get_wgl_driver( physdev, version );
59 release_dc_ptr( dc );
61 return ret;
64 /******************************************************************************
65 * ChoosePixelFormat (GDI32.@)
67 INT WINAPI ChoosePixelFormat( HDC hdc, const PIXELFORMATDESCRIPTOR *pfd )
69 if (!wglChoosePixelFormat)
71 if (!opengl32) opengl32 = LoadLibraryW( opengl32W );
72 if (!(wglChoosePixelFormat = (void *)GetProcAddress( opengl32, "wglChoosePixelFormat" )))
73 return 0;
75 return wglChoosePixelFormat( hdc, pfd );
78 /******************************************************************************
79 * DescribePixelFormat (GDI32.@)
81 INT WINAPI DescribePixelFormat( HDC hdc, INT fmt, UINT size, PIXELFORMATDESCRIPTOR *pfd )
83 if (!wglDescribePixelFormat)
85 if (!opengl32) opengl32 = LoadLibraryW( opengl32W );
86 if (!(wglDescribePixelFormat = (void *)GetProcAddress( opengl32, "wglDescribePixelFormat" )))
87 return 0;
89 return wglDescribePixelFormat( hdc, fmt, size, pfd );
92 /******************************************************************************
93 * GetPixelFormat (GDI32.@)
95 INT WINAPI GetPixelFormat( HDC hdc )
97 if (!wglGetPixelFormat)
99 if (!opengl32) opengl32 = LoadLibraryW( opengl32W );
100 if (!(wglGetPixelFormat = (void *)GetProcAddress( opengl32, "wglGetPixelFormat" )))
101 return 0;
103 return wglGetPixelFormat( hdc );
106 /******************************************************************************
107 * SetPixelFormat (GDI32.@)
109 BOOL WINAPI SetPixelFormat( HDC hdc, INT fmt, const PIXELFORMATDESCRIPTOR *pfd )
111 if (!wglSetPixelFormat)
113 if (!opengl32) opengl32 = LoadLibraryW( opengl32W );
114 if (!(wglSetPixelFormat = (void *)GetProcAddress( opengl32, "wglSetPixelFormat" )))
115 return FALSE;
117 return wglSetPixelFormat( hdc, fmt, pfd );
120 /******************************************************************************
121 * SwapBuffers (GDI32.@)
123 BOOL WINAPI SwapBuffers( HDC hdc )
125 if (!wglSwapBuffers)
127 if (!opengl32) opengl32 = LoadLibraryW( opengl32W );
128 if (!(wglSwapBuffers = (void *)GetProcAddress( opengl32, "wglSwapBuffers" )))
129 return FALSE;
131 return wglSwapBuffers( hdc );