mirror of
https://github.com/reactos/reactos.git
synced 2024-12-30 19:14:31 +00:00
patch by blight:
more WGL stuff implemented, bugfixes and finally found out how to get the driver name from/for a HDC svn path=/trunk/; revision=8052
This commit is contained in:
parent
008cec6fdf
commit
796b118754
5 changed files with 208 additions and 112 deletions
|
@ -8,8 +8,6 @@
|
||||||
* Feb 2, 2004: Created
|
* Feb 2, 2004: Created
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* FIXME: everything in this file ;-) */
|
|
||||||
|
|
||||||
/* On a x86 we call the ICD functions in a special-way:
|
/* On a x86 we call the ICD functions in a special-way:
|
||||||
*
|
*
|
||||||
* For every glXXX function we export a glXXX entry-point which loads the
|
* For every glXXX function we export a glXXX entry-point which loads the
|
||||||
|
@ -47,34 +45,37 @@ typedef double GLdouble;
|
||||||
typedef double GLclampd;
|
typedef double GLclampd;
|
||||||
typedef void GLvoid;
|
typedef void GLvoid;
|
||||||
|
|
||||||
void STDCALL glEmptyFunc0() {}
|
int STDCALL glEmptyFunc0() { return 0; }
|
||||||
void STDCALL glEmptyFunc4( long l1 ) {}
|
int STDCALL glEmptyFunc4( long l1 ) { return 0; }
|
||||||
void STDCALL glEmptyFunc8( long l1, long l2 ) {}
|
int STDCALL glEmptyFunc8( long l1, long l2 ) { return 0; }
|
||||||
void STDCALL glEmptyFunc12( long l1, long l2, long l3 ) {}
|
int STDCALL glEmptyFunc12( long l1, long l2, long l3 ) { return 0; }
|
||||||
void STDCALL glEmptyFunc16( long l1, long l2, long l3, long l4 ) {}
|
int STDCALL glEmptyFunc16( long l1, long l2, long l3, long l4 ) { return 0; }
|
||||||
void STDCALL glEmptyFunc20( long l1, long l2, long l3, long l4, long l5 ) {}
|
int STDCALL glEmptyFunc20( long l1, long l2, long l3, long l4, long l5 )
|
||||||
void STDCALL glEmptyFunc24( long l1, long l2, long l3, long l4, long l5,
|
{ return 0; }
|
||||||
long l6 ) {}
|
int STDCALL glEmptyFunc24( long l1, long l2, long l3, long l4, long l5,
|
||||||
void STDCALL glEmptyFunc28( long l1, long l2, long l3, long l4, long l5,
|
long l6 ) { return 0; }
|
||||||
long l6, long l7 ) {}
|
int STDCALL glEmptyFunc28( long l1, long l2, long l3, long l4, long l5,
|
||||||
void STDCALL glEmptyFunc32( long l1, long l2, long l3, long l4, long l5,
|
long l6, long l7 ) { return 0; }
|
||||||
long l6, long l7, long l8 ) {}
|
int STDCALL glEmptyFunc32( long l1, long l2, long l3, long l4, long l5,
|
||||||
void STDCALL glEmptyFunc36( long l1, long l2, long l3, long l4, long l5,
|
long l6, long l7, long l8 ) { return 0; }
|
||||||
long l6, long l7, long l8, long l9 ) {}
|
int STDCALL glEmptyFunc36( long l1, long l2, long l3, long l4, long l5,
|
||||||
void STDCALL glEmptyFunc40( long l1, long l2, long l3, long l4, long l5,
|
long l6, long l7, long l8, long l9 ) { return 0; }
|
||||||
long l6, long l7, long l8, long l9, long l10 ) {}
|
int STDCALL glEmptyFunc40( long l1, long l2, long l3, long l4, long l5,
|
||||||
void STDCALL glEmptyFunc44( long l1, long l2, long l3, long l4, long l5,
|
long l6, long l7, long l8, long l9, long l10 )
|
||||||
long l6, long l7, long l8, long l9, long l10,
|
{ return 0; }
|
||||||
long l11 ) {}
|
int STDCALL glEmptyFunc44( long l1, long l2, long l3, long l4, long l5,
|
||||||
void STDCALL glEmptyFunc48( long l1, long l2, long l3, long l4, long l5,
|
long l6, long l7, long l8, long l9, long l10,
|
||||||
long l6, long l7, long l8, long l9, long l10,
|
long l11 ) { return 0; }
|
||||||
long l11, long l12 ) {}
|
int STDCALL glEmptyFunc48( long l1, long l2, long l3, long l4, long l5,
|
||||||
void STDCALL glEmptyFunc52( long l1, long l2, long l3, long l4, long l5,
|
long l6, long l7, long l8, long l9, long l10,
|
||||||
long l6, long l7, long l8, long l9, long l10,
|
long l11, long l12 ) { return 0; }
|
||||||
long l11, long l12, long l13 ) {}
|
int STDCALL glEmptyFunc52( long l1, long l2, long l3, long l4, long l5,
|
||||||
void STDCALL glEmptyFunc56( long l1, long l2, long l3, long l4, long l5,
|
long l6, long l7, long l8, long l9, long l10,
|
||||||
long l6, long l7, long l8, long l9, long l10,
|
long l11, long l12, long l13 ) { return 0; }
|
||||||
long l11, long l12, long l13, long l14 ) {}
|
int STDCALL glEmptyFunc56( long l1, long l2, long l3, long l4, long l5,
|
||||||
|
long l6, long l7, long l8, long l9, long l10,
|
||||||
|
long l11, long l12, long l13, long l14 )
|
||||||
|
{ return 0; }
|
||||||
|
|
||||||
|
|
||||||
# define X(func, ret, typeargs, args, icdidx, tebidx, stack) \
|
# define X(func, ret, typeargs, args, icdidx, tebidx, stack) \
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: opengl32.c,v 1.10 2004/02/06 13:59:13 royce Exp $
|
/* $Id: opengl32.c,v 1.11 2004/02/06 17:22:55 royce Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -18,6 +18,8 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "opengl32.h"
|
#include "opengl32.h"
|
||||||
|
|
||||||
|
#define EXT_GET_DRIVERNAME 0x1001 /* ExtEscape code to get driver name */
|
||||||
|
|
||||||
/* function prototypes */
|
/* function prototypes */
|
||||||
/*static BOOL OPENGL32_LoadDrivers();*/
|
/*static BOOL OPENGL32_LoadDrivers();*/
|
||||||
static void OPENGL32_AppendICD( GLDRIVERDATA *icd );
|
static void OPENGL32_AppendICD( GLDRIVERDATA *icd );
|
||||||
|
@ -356,12 +358,36 @@ static BOOL OPENGL32_UnloadDriver( GLDRIVERDATA *icd )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* FUNCTION: Load ICD from HDC (shared ICD data)
|
||||||
|
* RETURNS: GLDRIVERDATA pointer on success, NULL otherwise.
|
||||||
|
* NOTES: Make sure the handle you pass in is one for a DC!
|
||||||
|
* Increases the refcount of the ICD - use
|
||||||
|
* OPENGL32_UnloadICD to release the ICD.
|
||||||
|
*/
|
||||||
|
GLDRIVERDATA *OPENGL32_LoadICDForHDC( HDC hdc )
|
||||||
|
{
|
||||||
|
WCHAR name[256];
|
||||||
|
DWORD dwInput = 0;
|
||||||
|
LONG ret;
|
||||||
|
|
||||||
|
/* get driver name */
|
||||||
|
ret = ExtEscape( hdc, EXT_GET_DRIVERNAME, sizeof (dwInput), (LPCSTR)&dwInput,
|
||||||
|
sizeof (name), (LPSTR)name );
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
DBGPRINT( "Warning: ExtEscape to get the drivername failed!!! (%d)", GetLastError() );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* load driver (or get a reference) */
|
||||||
|
return OPENGL32_LoadICD( name );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* FUNCTION: Load ICD (shared ICD data)
|
/* FUNCTION: Load ICD (shared ICD data)
|
||||||
* RETURNS: GLDRIVERDATA pointer on success, NULL otherwise.
|
* RETURNS: GLDRIVERDATA pointer on success, NULL otherwise.
|
||||||
*/
|
*/
|
||||||
GLDRIVERDATA *OPENGL32_LoadICD ( LPCWSTR driver )
|
GLDRIVERDATA *OPENGL32_LoadICD( LPCWSTR driver )
|
||||||
{
|
{
|
||||||
GLDRIVERDATA *icd;
|
GLDRIVERDATA *icd;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; $Id: opengl32.edf,v 1.3 2004/02/05 04:28:11 royce Exp $
|
; $Id: opengl32.edf,v 1.4 2004/02/06 17:22:55 royce Exp $
|
||||||
;
|
;
|
||||||
; opengl32.edf
|
; opengl32.edf
|
||||||
;
|
;
|
||||||
|
@ -375,27 +375,27 @@ glVertexPointer=glVertexPointer@16
|
||||||
glViewport=glViewport@16
|
glViewport=glViewport@16
|
||||||
|
|
||||||
wglChoosePixelFormat=GDI32.ChoosePixelFormat
|
wglChoosePixelFormat=GDI32.ChoosePixelFormat
|
||||||
wglCopyContext=wglCopyContext@12
|
wglCopyContext=rosglCopyContext@12
|
||||||
wglCreateContext=wglCreateContext@4
|
wglCreateContext=rosglCreateContext@4
|
||||||
wglCreateLayerContext=wglCreateLayerContext@8
|
wglCreateLayerContext=rosglCreateLayerContext@8
|
||||||
wglDeleteContext=wglDeleteContext@4
|
wglDeleteContext=rosglDeleteContext@4
|
||||||
wglDescribeLayerPlane=wglDescribeLayerPlane@20
|
wglDescribeLayerPlane=rosglDescribeLayerPlane@20
|
||||||
wglDescribePixelFormat=GDI32.DescribePixelFormat
|
wglDescribePixelFormat=GDI32.DescribePixelFormat
|
||||||
wglGetCurrentContext=wglGetCurrentContext@0
|
wglGetCurrentContext=rosglGetCurrentContext@0
|
||||||
wglGetCurrentDC=wglGetCurrentDC@0
|
wglGetCurrentDC=rosglGetCurrentDC@0
|
||||||
;wglGetDefaultProcAddress=wglGetDefaultProcAddress@
|
;wglGetDefaultProcAddress=rosglGetDefaultProcAddress@
|
||||||
wglGetLayerPaletteEntries=wglGetLayerPaletteEntries@20
|
wglGetLayerPaletteEntries=rosglGetLayerPaletteEntries@20
|
||||||
wglGetPixelFormat=GDI32.GetPixelFormat
|
wglGetPixelFormat=GDI32.GetPixelFormat
|
||||||
wglGetProcAddress=wglGetProcAddress@4
|
wglGetProcAddress=rosglGetProcAddress@4
|
||||||
wglMakeCurrent=wglMakeCurrent@8
|
wglMakeCurrent=rosglMakeCurrent@8
|
||||||
wglRealizeLayerPalette=wglRealizeLayerPalette@12
|
wglRealizeLayerPalette=rosglRealizeLayerPalette@12
|
||||||
wglSetLayerPaletteEntries=wglSetLayerPaletteEntries@20
|
wglSetLayerPaletteEntries=rosglSetLayerPaletteEntries@20
|
||||||
wglSetPixelFormat=GDI32.SetPixelFormat
|
wglSetPixelFormat=GDI32.SetPixelFormat
|
||||||
wglShareLists=wglShareLists@8
|
wglShareLists=rosglShareLists@8
|
||||||
wglSwapBuffers=GDI32.SwapBuffers
|
wglSwapBuffers=GDI32.SwapBuffers
|
||||||
wglSwapLayerBuffers=wglSwapLayerBuffers@8
|
wglSwapLayerBuffers=rosglSwapLayerBuffers@8
|
||||||
;wglSwapMultipleBuffers=wglSwapMultipleBuffers@
|
;wglSwapMultipleBuffers=rosglSwapMultipleBuffers@
|
||||||
wglUseFontBitmapsA=wglUseFontBitmapsA@16
|
wglUseFontBitmapsA=rosglUseFontBitmapsA@16
|
||||||
wglUseFontBitmapsW=wglUseFontBitmapsW@16
|
wglUseFontBitmapsW=rosglUseFontBitmapsW@16
|
||||||
wglUseFontOutlinesA=wglUseFontOutlinesA@32
|
wglUseFontOutlinesA=rosglUseFontOutlinesA@32
|
||||||
wglUseFontOutlinesW=wglUseFontOutlinesW@32
|
wglUseFontOutlinesW=rosglUseFontOutlinesW@32
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: opengl32.h,v 1.9 2004/02/06 13:59:13 royce Exp $
|
/* $Id: opengl32.h,v 1.10 2004/02/06 17:22:55 royce Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -131,33 +131,34 @@ extern GLPROCESSDATA OPENGL32_processdata;
|
||||||
#define OPENGL32_threaddata ((GLTHREADDATA *)TlsGetValue( OPENGL32_tls ))
|
#define OPENGL32_threaddata ((GLTHREADDATA *)TlsGetValue( OPENGL32_tls ))
|
||||||
|
|
||||||
/* function prototypes */
|
/* function prototypes */
|
||||||
|
GLDRIVERDATA *OPENGL32_LoadICDForHDC( HDC hdc );
|
||||||
GLDRIVERDATA *OPENGL32_LoadICD( LPCWSTR driver );
|
GLDRIVERDATA *OPENGL32_LoadICD( LPCWSTR driver );
|
||||||
BOOL OPENGL32_UnloadICD( GLDRIVERDATA *icd );
|
BOOL OPENGL32_UnloadICD( GLDRIVERDATA *icd );
|
||||||
DWORD OPENGL32_RegEnumDrivers( DWORD idx, LPWSTR name, LPDWORD cName );
|
DWORD OPENGL32_RegEnumDrivers( DWORD idx, LPWSTR name, LPDWORD cName );
|
||||||
DWORD OPENGL32_RegGetDriverInfo( LPCWSTR driver, GLDRIVERDATA *icd );
|
DWORD OPENGL32_RegGetDriverInfo( LPCWSTR driver, GLDRIVERDATA *icd );
|
||||||
|
|
||||||
/* empty gl functions from gl.c */
|
/* empty gl functions from gl.c */
|
||||||
void STDCALL glEmptyFunc0();
|
int STDCALL glEmptyFunc0();
|
||||||
void STDCALL glEmptyFunc4( long );
|
int STDCALL glEmptyFunc4( long );
|
||||||
void STDCALL glEmptyFunc8( long, long );
|
int STDCALL glEmptyFunc8( long, long );
|
||||||
void STDCALL glEmptyFunc12( long, long, long );
|
int STDCALL glEmptyFunc12( long, long, long );
|
||||||
void STDCALL glEmptyFunc16( long, long, long, long );
|
int STDCALL glEmptyFunc16( long, long, long, long );
|
||||||
void STDCALL glEmptyFunc20( long, long, long, long, long );
|
int STDCALL glEmptyFunc20( long, long, long, long, long );
|
||||||
void STDCALL glEmptyFunc24( long, long, long, long, long, long );
|
int STDCALL glEmptyFunc24( long, long, long, long, long, long );
|
||||||
void STDCALL glEmptyFunc28( long, long, long, long, long, long, long );
|
int STDCALL glEmptyFunc28( long, long, long, long, long, long, long );
|
||||||
void STDCALL glEmptyFunc32( long, long, long, long, long, long, long, long );
|
int STDCALL glEmptyFunc32( long, long, long, long, long, long, long, long );
|
||||||
void STDCALL glEmptyFunc36( long, long, long, long, long, long, long, long,
|
int STDCALL glEmptyFunc36( long, long, long, long, long, long, long, long,
|
||||||
long );
|
long );
|
||||||
void STDCALL glEmptyFunc40( long, long, long, long, long, long, long, long,
|
int STDCALL glEmptyFunc40( long, long, long, long, long, long, long, long,
|
||||||
long, long );
|
long, long );
|
||||||
void STDCALL glEmptyFunc44( long, long, long, long, long, long, long, long,
|
int STDCALL glEmptyFunc44( long, long, long, long, long, long, long, long,
|
||||||
long, long, long );
|
long, long, long );
|
||||||
void STDCALL glEmptyFunc48( long, long, long, long, long, long, long, long,
|
int STDCALL glEmptyFunc48( long, long, long, long, long, long, long, long,
|
||||||
long, long, long, long );
|
long, long, long, long );
|
||||||
void STDCALL glEmptyFunc52( long, long, long, long, long, long, long, long,
|
int STDCALL glEmptyFunc52( long, long, long, long, long, long, long, long,
|
||||||
long, long, long, long, long );
|
long, long, long, long, long );
|
||||||
void STDCALL glEmptyFunc56( long, long, long, long, long, long, long, long,
|
int STDCALL glEmptyFunc56( long, long, long, long, long, long, long, long,
|
||||||
long, long, long, long, long, long );
|
long, long, long, long, long, long );
|
||||||
|
|
||||||
#endif//OPENGL32_PRIVATE_H
|
#endif//OPENGL32_PRIVATE_H
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: lib/opengl32/wgl.c
|
* FILE: lib/opengl32/wgl.c
|
||||||
* PURPOSE: OpenGL32 lib, wglXXX functions
|
* PURPOSE: OpenGL32 lib, rosglXXX functions
|
||||||
* PROGRAMMER: Anich Gregor (blight)
|
* PROGRAMMER: Anich Gregor (blight)
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* Feb 2, 2004: Created
|
* Feb 2, 2004: Created
|
||||||
|
@ -12,6 +12,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <ntos/types.h>
|
#include <ntos/types.h>
|
||||||
#include <napi/teb.h>
|
#include <napi/teb.h>
|
||||||
|
#include <GL/gl.h>
|
||||||
|
|
||||||
#include "opengl32.h"
|
#include "opengl32.h"
|
||||||
|
|
||||||
|
@ -170,7 +171,7 @@ DWORD CALLBACK WGL_SetContextCallBack( const ICDTable *table )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int WINAPI wglChoosePixelFormat( HDC hdc, CONST PIXELFORMATDESCRIPTOR *pfd )
|
int APIENTRY rosglChoosePixelFormat( HDC hdc, CONST PIXELFORMATDESCRIPTOR *pfd )
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -183,7 +184,7 @@ int WINAPI wglChoosePixelFormat( HDC hdc, CONST PIXELFORMATDESCRIPTOR *pfd )
|
||||||
* [IN] mask Bitfield like given to glPushAttrib()
|
* [IN] mask Bitfield like given to glPushAttrib()
|
||||||
* RETURN: TRUE on success, FALSE on failure
|
* RETURN: TRUE on success, FALSE on failure
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI wglCopyContext( HGLRC hsrc, HGLRC hdst, UINT mask )
|
BOOL APIENTRY rosglCopyContext( HGLRC hsrc, HGLRC hdst, UINT mask )
|
||||||
{
|
{
|
||||||
GLRC *src = (GLRC *)hsrc;
|
GLRC *src = (GLRC *)hsrc;
|
||||||
GLRC *dst = (GLRC *)hdst;
|
GLRC *dst = (GLRC *)hdst;
|
||||||
|
@ -216,9 +217,10 @@ BOOL WINAPI wglCopyContext( HGLRC hsrc, HGLRC hdst, UINT mask )
|
||||||
* ARGUMENTS: [IN] hdc Handle for DC for which to create context
|
* ARGUMENTS: [IN] hdc Handle for DC for which to create context
|
||||||
* RETURNS: NULL on failure, new GLRC on success
|
* RETURNS: NULL on failure, new GLRC on success
|
||||||
*/
|
*/
|
||||||
HGLRC WINAPI wglCreateContext( HDC hdc )
|
HGLRC APIENTRY rosglCreateLayerContext( HDC hdc, int layer );
|
||||||
|
HGLRC APIENTRY rosglCreateContext( HDC hdc )
|
||||||
{
|
{
|
||||||
return wglCreateLayerContext( hdc, 0 );
|
return rosglCreateLayerContext( hdc, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -228,11 +230,11 @@ HGLRC WINAPI wglCreateContext( HDC hdc )
|
||||||
* [IN] layer Layer number to bind (draw?) to
|
* [IN] layer Layer number to bind (draw?) to
|
||||||
* RETURNS: NULL on failure, new GLRC on success
|
* RETURNS: NULL on failure, new GLRC on success
|
||||||
*/
|
*/
|
||||||
HGLRC WINAPI wglCreateLayerContext( HDC hdc, int layer )
|
HGLRC APIENTRY rosglCreateLayerContext( HDC hdc, int layer )
|
||||||
{
|
{
|
||||||
LONG ret;
|
/* LONG ret;
|
||||||
WCHAR driver[256];
|
WCHAR driver[256];
|
||||||
DWORD dw, size;
|
DWORD dw, size;*/
|
||||||
|
|
||||||
GLDRIVERDATA *icd = NULL;
|
GLDRIVERDATA *icd = NULL;
|
||||||
GLRC *glrc;
|
GLRC *glrc;
|
||||||
|
@ -250,6 +252,7 @@ HGLRC WINAPI wglCreateLayerContext( HDC hdc, int layer )
|
||||||
if (glrc == NULL)
|
if (glrc == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
#if 0 /* old code */
|
||||||
/* try to find an ICD */
|
/* try to find an ICD */
|
||||||
for (dw = 0; drvHglrc == NULL; dw++) /* enumerate values */
|
for (dw = 0; drvHglrc == NULL; dw++) /* enumerate values */
|
||||||
{
|
{
|
||||||
|
@ -264,7 +267,7 @@ HGLRC WINAPI wglCreateLayerContext( HDC hdc, int layer )
|
||||||
|
|
||||||
if (icd->DrvCreateLayerContext)
|
if (icd->DrvCreateLayerContext)
|
||||||
drvHglrc = icd->DrvCreateLayerContext( hdc, layer );
|
drvHglrc = icd->DrvCreateLayerContext( hdc, layer );
|
||||||
if (drvHglrc)
|
if (drvHglrc == NULL)
|
||||||
{
|
{
|
||||||
if (layer == 0)
|
if (layer == 0)
|
||||||
drvHglrc = icd->DrvCreateContext( hdc );
|
drvHglrc = icd->DrvCreateContext( hdc );
|
||||||
|
@ -290,6 +293,36 @@ HGLRC WINAPI wglCreateLayerContext( HDC hdc, int layer )
|
||||||
HeapFree( GetProcessHeap(), 0, glrc );
|
HeapFree( GetProcessHeap(), 0, glrc );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#endif /* unused */
|
||||||
|
|
||||||
|
/* load ICD */
|
||||||
|
icd = OPENGL32_LoadICDForHDC( hdc );
|
||||||
|
if (icd == NULL)
|
||||||
|
{
|
||||||
|
DBGPRINT( "Couldn't get ICD by HDC :-(" );
|
||||||
|
/* FIXME: fallback? */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* create context */
|
||||||
|
if (icd->DrvCreateLayerContext)
|
||||||
|
drvHglrc = icd->DrvCreateLayerContext( hdc, layer );
|
||||||
|
if (drvHglrc == NULL)
|
||||||
|
{
|
||||||
|
if (layer == 0)
|
||||||
|
drvHglrc = icd->DrvCreateContext( hdc );
|
||||||
|
else
|
||||||
|
DBGPRINT( "Warning: CreateLayerContext not supported by ICD!" );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (drvHglrc == NULL)
|
||||||
|
{
|
||||||
|
/* FIXME: fallback to mesa? */
|
||||||
|
DBGPRINT( "Error: DrvCreate[Layer]Context failed! (%d)", GetLastError() );
|
||||||
|
OPENGL32_UnloadICD( icd );
|
||||||
|
HeapFree( GetProcessHeap(), 0, glrc );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* we have our GLRC in glrc and the ICD's GLRC in drvHglrc */
|
/* we have our GLRC in glrc and the ICD's GLRC in drvHglrc */
|
||||||
glrc->hglrc = drvHglrc;
|
glrc->hglrc = drvHglrc;
|
||||||
|
@ -307,7 +340,7 @@ HGLRC WINAPI wglCreateLayerContext( HDC hdc, int layer )
|
||||||
* ARGUMENTS: [IN] hglrc Handle to GLRC to delete; must not be a threads RC!
|
* ARGUMENTS: [IN] hglrc Handle to GLRC to delete; must not be a threads RC!
|
||||||
* RETURNS: TRUE on success, FALSE otherwise
|
* RETURNS: TRUE on success, FALSE otherwise
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI wglDeleteContext( HGLRC hglrc )
|
BOOL APIENTRY rosglDeleteContext( HGLRC hglrc )
|
||||||
{
|
{
|
||||||
GLRC *glrc = (GLRC *)hglrc;
|
GLRC *glrc = (GLRC *)hglrc;
|
||||||
|
|
||||||
|
@ -336,6 +369,7 @@ BOOL WINAPI wglDeleteContext( HGLRC hglrc )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free resources */
|
/* free resources */
|
||||||
|
OPENGL32_UnloadICD( glrc->icd );
|
||||||
WGL_RemoveContext( glrc );
|
WGL_RemoveContext( glrc );
|
||||||
HeapFree( GetProcessHeap(), 0, glrc );
|
HeapFree( GetProcessHeap(), 0, glrc );
|
||||||
|
|
||||||
|
@ -343,7 +377,7 @@ BOOL WINAPI wglDeleteContext( HGLRC hglrc )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI wglDescribeLayerPlane( HDC hdc, int iPixelFormat, int iLayerPlane,
|
BOOL APIENTRY rosglDescribeLayerPlane( HDC hdc, int iPixelFormat, int iLayerPlane,
|
||||||
UINT nBytes, LPLAYERPLANEDESCRIPTOR plpd )
|
UINT nBytes, LPLAYERPLANEDESCRIPTOR plpd )
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
|
@ -351,18 +385,28 @@ BOOL WINAPI wglDescribeLayerPlane( HDC hdc, int iPixelFormat, int iLayerPlane,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int WINAPI wglDescribePixelFormat( HDC hdc, int iFormat, UINT nBytes,
|
int APIENTRY rosglDescribePixelFormat( HDC hdc, int iFormat, UINT nBytes,
|
||||||
LPPIXELFORMATDESCRIPTOR pfd )
|
LPPIXELFORMATDESCRIPTOR pfd )
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
int ret = 0;
|
||||||
return 0;
|
GLDRIVERDATA *icd = OPENGL32_LoadICDForHDC( hdc );
|
||||||
|
|
||||||
|
if (icd != NULL)
|
||||||
|
{
|
||||||
|
ret = icd->DrvDescribePixelFormat( hdc, iFormat, nBytes, pfd );
|
||||||
|
if (ret == 0)
|
||||||
|
DBGPRINT( "Error: DrvDescribePixelFormat failed (%d)", GetLastError() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME: implement own functionality? */
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* FUNCTION: Return the current GLRC
|
/* FUNCTION: Return the current GLRC
|
||||||
* RETURNS: Current GLRC (NULL if none was set current)
|
* RETURNS: Current GLRC (NULL if none was set current)
|
||||||
*/
|
*/
|
||||||
HGLRC WINAPI wglGetCurrentContext()
|
HGLRC APIENTRY rosglGetCurrentContext()
|
||||||
{
|
{
|
||||||
return (HGLRC)(OPENGL32_threaddata->glrc);
|
return (HGLRC)(OPENGL32_threaddata->glrc);
|
||||||
}
|
}
|
||||||
|
@ -371,7 +415,7 @@ HGLRC WINAPI wglGetCurrentContext()
|
||||||
/* FUNCTION: Return the current DC
|
/* FUNCTION: Return the current DC
|
||||||
* RETURNS: NULL on failure, current DC otherwise
|
* RETURNS: NULL on failure, current DC otherwise
|
||||||
*/
|
*/
|
||||||
HDC WINAPI wglGetCurrentDC()
|
HDC APIENTRY rosglGetCurrentDC()
|
||||||
{
|
{
|
||||||
/* FIXME: is it correct to return NULL when there is no current GLRC or
|
/* FIXME: is it correct to return NULL when there is no current GLRC or
|
||||||
is there another way to find out the wanted HDC? */
|
is there another way to find out the wanted HDC? */
|
||||||
|
@ -381,7 +425,7 @@ HDC WINAPI wglGetCurrentDC()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int WINAPI wglGetLayerPaletteEntries( HDC hdc, int iLayerPlane, int iStart,
|
int APIENTRY rosglGetLayerPaletteEntries( HDC hdc, int iLayerPlane, int iStart,
|
||||||
int cEntries, COLORREF *pcr )
|
int cEntries, COLORREF *pcr )
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
|
@ -389,7 +433,7 @@ int WINAPI wglGetLayerPaletteEntries( HDC hdc, int iLayerPlane, int iStart,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int WINAPI wglGetPixelFormat( HDC hdc )
|
int APIENTRY rosglGetPixelFormat( HDC hdc )
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -400,7 +444,7 @@ int WINAPI wglGetPixelFormat( HDC hdc )
|
||||||
* ARGUMENTS: [IN] proc: Name of the function to look for
|
* ARGUMENTS: [IN] proc: Name of the function to look for
|
||||||
* RETURNS: The address of the proc or NULL on failure.
|
* RETURNS: The address of the proc or NULL on failure.
|
||||||
*/
|
*/
|
||||||
PROC WINAPI wglGetProcAddress( LPCSTR proc )
|
PROC APIENTRY rosglGetProcAddress( LPCSTR proc )
|
||||||
{
|
{
|
||||||
if (OPENGL32_threaddata->glrc == NULL)
|
if (OPENGL32_threaddata->glrc == NULL)
|
||||||
{
|
{
|
||||||
|
@ -418,17 +462,17 @@ PROC WINAPI wglGetProcAddress( LPCSTR proc )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: go through own functions? */
|
/* FIXME: go through own functions? */
|
||||||
DBGPRINT( "Unsupported GL extension: %s", proc );
|
DBGPRINT( "Warning: Unsupported GL extension: %s", proc );
|
||||||
}
|
}
|
||||||
if (proc[0] == 'w' && proc[1] == 'g' && proc[2] == 'l') /* wglXXX */
|
if (proc[0] == 'w' && proc[1] == 'g' && proc[2] == 'l') /* wglXXX */
|
||||||
{
|
{
|
||||||
/* FIXME: support wgl extensions? (there are such IIRC) */
|
/* FIXME: support wgl extensions? (there are such IIRC) */
|
||||||
DBGPRINT( "Unsupported WGL extension: %s", proc );
|
DBGPRINT( "Warning: Unsupported WGL extension: %s", proc );
|
||||||
}
|
}
|
||||||
if (proc[0] == 'g' && proc[1] == 'l' && proc[2] == 'u') /* gluXXX */
|
if (proc[0] == 'g' && proc[1] == 'l' && proc[2] == 'u') /* gluXXX */
|
||||||
{
|
{
|
||||||
/* FIXME: do we support these as well? */
|
/* FIXME: do we support these as well? */
|
||||||
DBGPRINT( "GLU extension %s requested, returning NULL", proc );
|
DBGPRINT( "Warning: GLU extension %s requested, returning NULL", proc );
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -440,7 +484,7 @@ PROC WINAPI wglGetProcAddress( LPCSTR proc )
|
||||||
* [IN] hglrc Handle for a GLRC to make current
|
* [IN] hglrc Handle for a GLRC to make current
|
||||||
* RETURNS: TRUE on success, FALSE otherwise
|
* RETURNS: TRUE on success, FALSE otherwise
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI wglMakeCurrent( HDC hdc, HGLRC hglrc )
|
BOOL APIENTRY rosglMakeCurrent( HDC hdc, HGLRC hglrc )
|
||||||
{
|
{
|
||||||
GLRC *glrc = (GLRC *)hglrc;
|
GLRC *glrc = (GLRC *)hglrc;
|
||||||
|
|
||||||
|
@ -493,25 +537,37 @@ BOOL WINAPI wglMakeCurrent( HDC hdc, HGLRC hglrc )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI wglRealizeLayerPalette( HDC hdc, int iLayerPlane, BOOL bRealize )
|
BOOL APIENTRY rosglRealizeLayerPalette( HDC hdc, int iLayerPlane, BOOL bRealize )
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int WINAPI wglSetLayerPaletteEntries( HDC hdc, int iLayerPlane, int iStart,
|
int APIENTRY rosglSetLayerPaletteEntries( HDC hdc, int iLayerPlane, int iStart,
|
||||||
int cEntries, CONST COLORREF *pcr )
|
int cEntries, CONST COLORREF *pcr )
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI wglSetPixelFormat( HDC hdc, int iFormat, CONST PIXELFORMATDESCRIPTOR *pfd )
|
BOOL APIENTRY rosglSetPixelFormat( HDC hdc, int iFormat,
|
||||||
|
CONST PIXELFORMATDESCRIPTOR *pfd )
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
GLDRIVERDATA *icd;
|
||||||
return FALSE;
|
|
||||||
|
icd = OPENGL32_LoadICDForHDC( hdc );
|
||||||
|
if (icd == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!icd->DrvSetPixelFormat( hdc, iFormat, pfd ))
|
||||||
|
{
|
||||||
|
DBGPRINT( "Warning: DrvSetPixelFormat failed (%d)", GetLastError() );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -520,7 +576,7 @@ BOOL WINAPI wglSetPixelFormat( HDC hdc, int iFormat, CONST PIXELFORMATDESCRIPTOR
|
||||||
* [IN] hglrc2 GLRC number 2
|
* [IN] hglrc2 GLRC number 2
|
||||||
* RETURNS: TRUR on success, FALSE on failure
|
* RETURNS: TRUR on success, FALSE on failure
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI wglShareLists( HGLRC hglrc1, HGLRC hglrc2 )
|
BOOL APIENTRY rosglShareLists( HGLRC hglrc1, HGLRC hglrc2 )
|
||||||
{
|
{
|
||||||
GLRC *glrc1 = (GLRC *)hglrc1;
|
GLRC *glrc1 = (GLRC *)hglrc1;
|
||||||
GLRC *glrc2 = (GLRC *)hglrc2;
|
GLRC *glrc2 = (GLRC *)hglrc2;
|
||||||
|
@ -553,8 +609,9 @@ BOOL WINAPI wglShareLists( HGLRC hglrc1, HGLRC hglrc2 )
|
||||||
* ARGUMENTS: [IN] hdc Handle to device context to swap buffers for
|
* ARGUMENTS: [IN] hdc Handle to device context to swap buffers for
|
||||||
* RETURNS: TRUE on success, FALSE on failure
|
* RETURNS: TRUE on success, FALSE on failure
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI wglSwapBuffers( HDC hdc )
|
BOOL APIENTRY rosglSwapBuffers( HDC hdc )
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
/* check if there is a current GLRC */
|
/* check if there is a current GLRC */
|
||||||
if (OPENGL32_threaddata->glrc == NULL)
|
if (OPENGL32_threaddata->glrc == NULL)
|
||||||
{
|
{
|
||||||
|
@ -573,35 +630,46 @@ BOOL WINAPI wglSwapBuffers( HDC hdc )
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* FIXME: implement own functionality */
|
GLDRIVERDATA *icd = OPENGL32_LoadICDForHDC( hdc );
|
||||||
|
if (icd != NULL)
|
||||||
|
{
|
||||||
|
if (!icd->DrvSwapBuffers( hdc ))
|
||||||
|
{
|
||||||
|
DBGPRINT( "Error: DrvSwapBuffers failed (%d)", GetLastError() );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME: implement own functionality? */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI wglSwapLayerBuffers( HDC hdc, UINT fuPlanes )
|
BOOL APIENTRY rosglSwapLayerBuffers( HDC hdc, UINT fuPlanes )
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI wglUseFontBitmapsA( HDC hdc, DWORD first, DWORD count, DWORD listBase )
|
BOOL APIENTRY rosglUseFontBitmapsA( HDC hdc, DWORD first, DWORD count, DWORD listBase )
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI wglUseFontBitmapsW( HDC hdc, DWORD first, DWORD count, DWORD listBase )
|
BOOL APIENTRY rosglUseFontBitmapsW( HDC hdc, DWORD first, DWORD count, DWORD listBase )
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI wglUseFontOutlinesA( HDC hdc, DWORD first, DWORD count, DWORD listBase,
|
BOOL APIENTRY rosglUseFontOutlinesA( HDC hdc, DWORD first, DWORD count, DWORD listBase,
|
||||||
FLOAT deviation, FLOAT extrusion, int format,
|
FLOAT deviation, FLOAT extrusion, int format,
|
||||||
LPGLYPHMETRICSFLOAT lpgmf )
|
LPGLYPHMETRICSFLOAT lpgmf )
|
||||||
{
|
{
|
||||||
|
@ -610,7 +678,7 @@ BOOL WINAPI wglUseFontOutlinesA( HDC hdc, DWORD first, DWORD count, DWORD listBa
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL WINAPI wglUseFontOutlinesW( HDC hdc, DWORD first, DWORD count, DWORD listBase,
|
BOOL APIENTRY rosglUseFontOutlinesW( HDC hdc, DWORD first, DWORD count, DWORD listBase,
|
||||||
FLOAT deviation, FLOAT extrusion, int format,
|
FLOAT deviation, FLOAT extrusion, int format,
|
||||||
LPGLYPHMETRICSFLOAT lpgmf )
|
LPGLYPHMETRICSFLOAT lpgmf )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue