mmdevapi: Query MemoryWineUnixFuncs virtual memory and store the resulting handle.
[wine.git] / dlls / gdi32 / opengl.c
blob0fbd851f67e0dffc5669db860a964fa967127362
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 <stdarg.h>
24 #include <string.h>
25 #include <stdlib.h>
27 #include "windef.h"
28 #include "winbase.h"
29 #include "wingdi.h"
30 #include "winerror.h"
31 #include "winternl.h"
32 #include "winnt.h"
35 static HMODULE opengl32;
36 static INT (WINAPI *wglChoosePixelFormat)(HDC,const PIXELFORMATDESCRIPTOR *);
37 static INT (WINAPI *wglDescribePixelFormat)(HDC,INT,UINT,PIXELFORMATDESCRIPTOR*);
38 static INT (WINAPI *wglGetPixelFormat)(HDC);
39 static BOOL (WINAPI *wglSetPixelFormat)(HDC,INT,const PIXELFORMATDESCRIPTOR*);
40 static BOOL (WINAPI *wglSwapBuffers)(HDC);
42 /******************************************************************************
43 * ChoosePixelFormat (GDI32.@)
45 INT WINAPI ChoosePixelFormat( HDC hdc, const PIXELFORMATDESCRIPTOR *pfd )
47 if (!wglChoosePixelFormat)
49 if (!opengl32) opengl32 = LoadLibraryW( L"opengl32.dll" );
50 if (!(wglChoosePixelFormat = (void *)GetProcAddress( opengl32, "wglChoosePixelFormat" )))
51 return 0;
53 return wglChoosePixelFormat( hdc, pfd );
56 /******************************************************************************
57 * DescribePixelFormat (GDI32.@)
59 INT WINAPI DescribePixelFormat( HDC hdc, INT fmt, UINT size, PIXELFORMATDESCRIPTOR *pfd )
61 if (!wglDescribePixelFormat)
63 if (!opengl32) opengl32 = LoadLibraryW( L"opengl32.dll" );
64 if (!(wglDescribePixelFormat = (void *)GetProcAddress( opengl32, "wglDescribePixelFormat" )))
65 return 0;
67 return wglDescribePixelFormat( hdc, fmt, size, pfd );
70 /******************************************************************************
71 * GetPixelFormat (GDI32.@)
73 INT WINAPI GetPixelFormat( HDC hdc )
75 if (!wglGetPixelFormat)
77 if (!opengl32) opengl32 = LoadLibraryW( L"opengl32.dll" );
78 if (!(wglGetPixelFormat = (void *)GetProcAddress( opengl32, "wglGetPixelFormat" )))
79 return 0;
81 return wglGetPixelFormat( hdc );
84 /******************************************************************************
85 * SetPixelFormat (GDI32.@)
87 BOOL WINAPI SetPixelFormat( HDC hdc, INT fmt, const PIXELFORMATDESCRIPTOR *pfd )
89 if (!wglSetPixelFormat)
91 if (!opengl32) opengl32 = LoadLibraryW( L"opengl32.dll" );
92 if (!(wglSetPixelFormat = (void *)GetProcAddress( opengl32, "wglSetPixelFormat" )))
93 return FALSE;
95 return wglSetPixelFormat( hdc, fmt, pfd );
98 /******************************************************************************
99 * SwapBuffers (GDI32.@)
101 BOOL WINAPI SwapBuffers( HDC hdc )
103 if (!wglSwapBuffers)
105 if (!opengl32) opengl32 = LoadLibraryW( L"opengl32.dll" );
106 if (!(wglSwapBuffers = (void *)GetProcAddress( opengl32, "wglSwapBuffers" )))
107 return FALSE;
109 return wglSwapBuffers( hdc );