2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: lib/opengl32/wgl.c
5 * PURPOSE: OpenGL32 lib, wglXXX functions
6 * PROGRAMMER: Anich Gregor (blight)
11 #define WIN32_LEAN_AND_MEAN
18 BOOL
wglCopyContext( HGLRC src
, HGLRC dst
, UINT mask
)
23 HGLRC
wglCreateContext( HDC hdc
)
25 return wglCreateLayerContext( hdc
, 0 );
29 HGLRC
wglCreateLayerContext( HDC hdc
, int layer
)
32 WCHAR subKey
[1024] = L
"SOFTWARE\\Microsoft\\Windows NT\\"
33 "CurrentVersion\\OpenGLDrivers");
41 GLRC
*hglrc
, *drvHglrc
= NULL
;
43 if (GetObjectType( hdc
) != OBJ_DC
)
45 DBGPRINT( "Wrong object type" );
49 /* find out which icd to load */
50 ret
= RegOpenKeyExW( HKEY_LOCAL_MACHINE
, subKey
, 0, KEY_READ
, &hKey
);
51 if (ret
!= ERROR_SUCCESS
)
53 DBGPRINT( "Error: Couldn't open registry key '%ws'\n", subKey
);
57 /* allocate our GLRC */
58 hglrc
= HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof (GLRC
) );
65 ret
= RegEnumKeyExW( hKey
, dw
, driver
, &size
, NULL
, NULL
, NULL
, &time
);
66 if (ret
!= ERROR_SUCCESS
)
69 icd
= OPENGL32_LoadICDW( driver
);
73 drvHglrc
= icd
->DrvCreateLayerContext( hdc
, layer
);
76 DBGPRINT( "Info: DrvCreateLayerContext (driver = %ws) failed: %d\n",
77 icd
->driver_name
, GetLastError() );
78 OPENGL32_UnloadICD( icd
);
82 /* the ICD was loaded successfully and we got a HGLRC -- success! */
89 /* FIXME: fallback to mesa */
90 HeapFree( GetProcessHeap(), 0, hglrc
);
94 /* we have our GLRC in hglrc and the ICDs in drvHglrc */
95 hglrc
->hglrc
= drcHglrc
;
96 hglrc
->iFormat
= -1; /* what is this used for? */
98 hglrc
->threadid
= 0xFFFFFFFF; /* TODO: make sure this is the "invalid" value */
99 memcpy( hglrc
->func_list
, icd
->func_list
, sizeof (PVOID
) * GLIDX_COUNT
);
101 /* FIXME: fill NULL-pointers in hglrc->func_list with mesa functions */
103 /* FIXME: append hglrc to process-local list of contexts */
107 BOOL
wglDeleteContext( HGLRC hglrc
)
112 BOOL
wglDescribeLayerPlane( HDC hdc
, int iPixelFormat
, int iLayerPlane
,
113 UINT nBytes
, LPLAYERPLANEDESCRIPTOR plpd
)
118 HGLRC
wglGetCurrentContext()
123 HDC
wglGetCurrentDC()
128 int wglGetLayerPaletteEntries( HDC hdc
, int iLayerPlane
, int iStart
,
129 int cEntries
, CONST COLORREF
*pcr
)
134 PROC
wglGetProcAddress( LPCSTR proc
)
139 BOOL
wglMakeCurrent( HDC hdc
, HGLRC hglrc
)
144 BOOL
wglRealizeLayerPalette( HDC hdc
, int iLayerPlane
, BOOL bRealize
)
149 int wglSetLayerPaletteEntries( HDC hdc
, int iLayerPlane
, int iStart
,
150 int cEntries
, CONST COLORREF
*pcr
)
155 BOOL
wglShareLists( HGLRC hglrc1
, HGLRC hglrc2
)
160 BOOL
wglSwapLayerBuffers( HDC hdc
, UINT fuPlanes
)
165 BOOL
wglUseFontBitmapsA( HDC hdc
, DWORD first
, DWORD count
, DWORD listBase
)
170 BOOL
wglUseFontBitmapsW( HDC hdc
, DWORD first
, DWORD count
, DWORD listBase
)
175 BOOL
wglUseFontOutlinesA( HDC hdc
, DWORD first
, DWORD count
, DWORD listBase
,
176 FLOAT deviation
, FLOAT extrusion
, int format
,
177 LPGLYPHMETRICSFLOAT lpgmf
)
182 BOOL
wglUseFontOutlinesW( HDC hdc
, DWORD first
, DWORD count
, DWORD listBase
,
183 FLOAT deviation
, FLOAT extrusion
, int format
,
184 LPGLYPHMETRICSFLOAT lpgmf
)