2004-02-02 05:36:37 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* FILE: lib/opengl32/wgl.c
|
2004-02-06 17:22:55 +00:00
|
|
|
* PURPOSE: OpenGL32 lib, rosglXXX functions
|
2004-02-02 05:36:37 +00:00
|
|
|
* PROGRAMMER: Anich Gregor (blight)
|
|
|
|
* UPDATE HISTORY:
|
|
|
|
* Feb 2, 2004: Created
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#include <windows.h>
|
2004-02-06 18:17:18 +00:00
|
|
|
#include "teb.h"
|
2004-02-02 05:36:37 +00:00
|
|
|
#include "opengl32.h"
|
|
|
|
|
2004-02-06 18:17:18 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif//__cplusplus
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
2004-02-06 20:31:15 +00:00
|
|
|
#define UNIMPLEMENTED DBGPRINT( "UNIMPLEMENTED" )
|
2004-02-06 18:17:18 +00:00
|
|
|
#endif//_MSC_VER
|
2004-02-02 05:36:37 +00:00
|
|
|
|
2004-02-03 14:23:42 +00:00
|
|
|
/* FUNCTION: Append OpenGL Rendering Context (GLRC) to list
|
|
|
|
* ARGUMENTS: [IN] glrc: GLRC to append to list
|
|
|
|
*/
|
2004-02-06 18:17:18 +00:00
|
|
|
static
|
|
|
|
void
|
|
|
|
WGL_AppendContext( GLRC *glrc )
|
2004-02-03 14:23:42 +00:00
|
|
|
{
|
2004-02-05 04:28:11 +00:00
|
|
|
/* synchronize */
|
|
|
|
if (WaitForSingleObject( OPENGL32_processdata.glrc_mutex, INFINITE ) ==
|
|
|
|
WAIT_FAILED)
|
|
|
|
{
|
|
|
|
DBGPRINT( "Error: WaitForSingleObject() failed (%d)", GetLastError() );
|
|
|
|
return; /* FIXME: do we have to expect such an error and handle it? */
|
|
|
|
}
|
|
|
|
|
2004-02-03 14:23:42 +00:00
|
|
|
if (OPENGL32_processdata.glrc_list == NULL)
|
|
|
|
OPENGL32_processdata.glrc_list = glrc;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GLRC *p = OPENGL32_processdata.glrc_list;
|
|
|
|
while (p->next != NULL)
|
|
|
|
p = p->next;
|
|
|
|
p->next = glrc;
|
|
|
|
}
|
2004-02-05 04:28:11 +00:00
|
|
|
|
|
|
|
/* release mutex */
|
|
|
|
if (!ReleaseMutex( OPENGL32_processdata.glrc_mutex ))
|
|
|
|
DBGPRINT( "Error: ReleaseMutex() failed (%d)", GetLastError() );
|
2004-02-03 14:23:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* FUNCTION: Remove OpenGL Rendering Context (GLRC) from list
|
|
|
|
* ARGUMENTS: [IN] glrc: GLRC to remove from list
|
|
|
|
*/
|
2004-02-06 18:17:18 +00:00
|
|
|
static
|
|
|
|
void
|
|
|
|
WGL_RemoveContext( GLRC *glrc )
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
2004-02-05 04:28:11 +00:00
|
|
|
/* synchronize */
|
|
|
|
if (WaitForSingleObject( OPENGL32_processdata.glrc_mutex, INFINITE ) ==
|
|
|
|
WAIT_FAILED)
|
|
|
|
{
|
|
|
|
DBGPRINT( "Error: WaitForSingleObject() failed (%d)", GetLastError() );
|
|
|
|
return; /* FIXME: do we have to expect such an error and handle it? */
|
|
|
|
}
|
|
|
|
|
2004-02-03 14:23:42 +00:00
|
|
|
if (glrc == OPENGL32_processdata.glrc_list)
|
|
|
|
OPENGL32_processdata.glrc_list = glrc->next;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GLRC *p = OPENGL32_processdata.glrc_list;
|
|
|
|
while (p != NULL)
|
|
|
|
{
|
|
|
|
if (p->next == glrc)
|
|
|
|
{
|
|
|
|
p->next = glrc->next;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
p = p->next;
|
|
|
|
}
|
|
|
|
DBGPRINT( "Error: GLRC 0x%08x not found in list!", glrc );
|
|
|
|
}
|
2004-02-05 04:28:11 +00:00
|
|
|
|
|
|
|
/* release mutex */
|
|
|
|
if (!ReleaseMutex( OPENGL32_processdata.glrc_mutex ))
|
|
|
|
DBGPRINT( "Error: ReleaseMutex() failed (%d)", GetLastError() );
|
2004-02-03 14:23:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* FUNCTION: Check wether a GLRC is in the list
|
|
|
|
* ARGUMENTS: [IN] glrc: GLRC to remove from list
|
|
|
|
*/
|
2004-02-06 18:17:18 +00:00
|
|
|
static
|
|
|
|
BOOL
|
|
|
|
WGL_ContainsContext( GLRC *glrc )
|
2004-02-03 14:23:42 +00:00
|
|
|
{
|
2004-02-06 13:59:13 +00:00
|
|
|
GLRC *p;
|
2004-02-03 14:23:42 +00:00
|
|
|
|
2004-02-06 13:59:13 +00:00
|
|
|
/* synchronize */
|
|
|
|
if (WaitForSingleObject( OPENGL32_processdata.glrc_mutex, INFINITE ) ==
|
|
|
|
WAIT_FAILED)
|
|
|
|
{
|
|
|
|
DBGPRINT( "Error: WaitForSingleObject() failed (%d)", GetLastError() );
|
|
|
|
return FALSE; /* FIXME: do we have to expect such an error and handle it? */
|
|
|
|
}
|
|
|
|
|
|
|
|
p = OPENGL32_processdata.glrc_list;
|
2004-02-03 14:23:42 +00:00
|
|
|
while (p != NULL)
|
|
|
|
{
|
|
|
|
if (p == glrc)
|
|
|
|
return TRUE;
|
|
|
|
p = p->next;
|
|
|
|
}
|
|
|
|
|
2004-02-06 13:59:13 +00:00
|
|
|
/* release mutex */
|
|
|
|
if (!ReleaseMutex( OPENGL32_processdata.glrc_mutex ))
|
|
|
|
DBGPRINT( "Error: ReleaseMutex() failed (%d)", GetLastError() );
|
|
|
|
|
2004-02-02 17:59:23 +00:00
|
|
|
return FALSE;
|
2004-02-02 05:36:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-05 04:28:11 +00:00
|
|
|
/* FUNCTION: SetContextCallBack passed to DrvSetContext. Gets called whenever
|
|
|
|
* the current GL context (dispatch table) is to be changed - can
|
|
|
|
* be multiple times for one DrvSetContext call.
|
|
|
|
* ARGUMENTS: [IN] table Function pointer table (first DWORD is number of
|
|
|
|
* functions)
|
2004-02-12 23:56:15 +00:00
|
|
|
* RETURNS: unkown (maybe void?)
|
2004-02-05 04:28:11 +00:00
|
|
|
*/
|
2004-02-06 18:17:18 +00:00
|
|
|
DWORD
|
|
|
|
CALLBACK
|
|
|
|
WGL_SetContextCallBack( const ICDTable *table )
|
2004-02-05 04:28:11 +00:00
|
|
|
{
|
2004-02-06 13:59:13 +00:00
|
|
|
/* UINT i;*/
|
|
|
|
TEB *teb;
|
|
|
|
PROC *tebTable, *tebDispatchTable;
|
2004-02-12 23:56:15 +00:00
|
|
|
INT size;
|
2004-02-06 13:59:13 +00:00
|
|
|
|
|
|
|
teb = NtCurrentTeb();
|
|
|
|
tebTable = (PROC *)teb->glTable;
|
|
|
|
tebDispatchTable = (PROC *)teb->glDispatchTable;
|
|
|
|
|
2004-02-12 23:56:15 +00:00
|
|
|
if (table != NULL)
|
|
|
|
{
|
|
|
|
DBGPRINT( "Function count: %d\n", table->num_funcs );
|
2004-02-06 13:59:13 +00:00
|
|
|
|
2004-02-12 23:56:15 +00:00
|
|
|
/* save table */
|
|
|
|
size = sizeof (PROC) * table->num_funcs;
|
|
|
|
memcpy( tebTable, table->dispatch_table, size );
|
|
|
|
memset( tebTable + table->num_funcs, 0,
|
|
|
|
sizeof (table->dispatch_table) - size );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DBGPRINT( "Unsetting current context" );
|
|
|
|
memset( tebTable, 0, sizeof (table->dispatch_table) );
|
|
|
|
}
|
2004-02-06 13:59:13 +00:00
|
|
|
|
|
|
|
/* FIXME: pull in software fallbacks -- need mesa */
|
|
|
|
#if 0 /* unused atm */
|
|
|
|
for (i = 0; i < (sizeof (table->dispatch_table) / sizeof (PROC)); i++)
|
|
|
|
{
|
|
|
|
if (tebTable[i] == NULL)
|
|
|
|
{
|
|
|
|
/* FIXME: fallback */
|
|
|
|
DBGPRINT( "Warning: GL proc #%d is NULL!", i );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* put in empty functions as long as we dont have a fallback */
|
|
|
|
#define X(func, ret, typeargs, args, icdidx, tebidx, stack) \
|
|
|
|
if (tebTable[icdidx] == NULL) \
|
|
|
|
{ \
|
2004-02-12 23:56:15 +00:00
|
|
|
if (table != NULL) \
|
|
|
|
DBGPRINT( "Warning: GL proc '%s' is NULL", #func ); \
|
2004-02-06 13:59:13 +00:00
|
|
|
tebTable[icdidx] = (PROC)glEmptyFunc##stack; \
|
|
|
|
}
|
|
|
|
GLFUNCS_MACRO
|
|
|
|
#undef X
|
|
|
|
|
|
|
|
/* fill teb->glDispatchTable for fast calls */
|
|
|
|
#define X(func, ret, typeargs, args, icdidx, tebidx, stack) \
|
|
|
|
if (tebidx >= 0) \
|
|
|
|
tebDispatchTable[tebidx] = tebTable[icdidx];
|
|
|
|
GLFUNCS_MACRO
|
|
|
|
#undef X
|
|
|
|
|
2004-02-05 04:28:11 +00:00
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2004-02-03 14:23:42 +00:00
|
|
|
|
|
|
|
|
2004-02-06 20:31:15 +00:00
|
|
|
/* FUNCTION: Attempts to find the best matching pixel format for HDC
|
|
|
|
* ARGUMENTS: [IN] pdf PFD describing what kind of format you want
|
|
|
|
* RETURNS: one-based positive format index on success, 0 on failure
|
|
|
|
*/
|
|
|
|
#define BUFFERDEPTH_SCORE(want, have) \
|
|
|
|
((want == 0) ? (0) : ((want < have) ? (1) : ((want > have) ? (3) : (0))))
|
2004-02-06 18:17:18 +00:00
|
|
|
int
|
|
|
|
APIENTRY
|
|
|
|
rosglChoosePixelFormat( HDC hdc, CONST PIXELFORMATDESCRIPTOR *pfd )
|
2004-02-06 13:59:13 +00:00
|
|
|
{
|
2004-02-06 20:31:15 +00:00
|
|
|
GLDRIVERDATA *icd;
|
|
|
|
PIXELFORMATDESCRIPTOR icdPfd;
|
|
|
|
int i;
|
2004-02-11 17:39:24 +00:00
|
|
|
int best = 0;
|
2004-02-06 20:31:15 +00:00
|
|
|
int score, bestScore = 0x7fff; /* used to choose a pfd if no exact match */
|
|
|
|
int icdNumFormats;
|
|
|
|
const DWORD compareFlags = PFD_DRAW_TO_WINDOW | PFD_DRAW_TO_BITMAP |
|
|
|
|
PFD_SUPPORT_GDI | PFD_SUPPORT_OPENGL;
|
|
|
|
|
|
|
|
/* load ICD */
|
|
|
|
icd = OPENGL32_LoadICDForHDC( hdc );
|
|
|
|
if (icd == NULL)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* check input */
|
|
|
|
if (pfd->nSize != sizeof (PIXELFORMATDESCRIPTOR) || pfd->nVersion != 1)
|
|
|
|
{
|
2004-02-12 23:56:15 +00:00
|
|
|
OPENGL32_UnloadICD( icd );
|
2004-02-06 20:31:15 +00:00
|
|
|
SetLastError( 0 ); /* FIXME: use appropriate errorcode */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get number of formats -- FIXME: use 1 or 0 as index? */
|
2004-02-11 17:39:24 +00:00
|
|
|
icdNumFormats = icd->DrvDescribePixelFormat( hdc, 0,
|
2004-02-06 20:31:15 +00:00
|
|
|
sizeof (PIXELFORMATDESCRIPTOR), NULL );
|
|
|
|
if (icdNumFormats == 0)
|
|
|
|
{
|
2004-02-11 17:39:24 +00:00
|
|
|
DBGPRINT( "Error: DrvDescribePixelFormat failed (%d)", GetLastError() );
|
2004-02-12 23:56:15 +00:00
|
|
|
OPENGL32_UnloadICD( icd );
|
2004-02-06 20:31:15 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2004-02-11 17:39:24 +00:00
|
|
|
DBGPRINT( "Info: Enumerating %d pixelformats", icdNumFormats );
|
2004-02-06 20:31:15 +00:00
|
|
|
|
|
|
|
/* try to find best format */
|
|
|
|
for (i = 0; i < icdNumFormats; i++)
|
|
|
|
{
|
|
|
|
if (icd->DrvDescribePixelFormat( hdc, i + 1,
|
|
|
|
sizeof (PIXELFORMATDESCRIPTOR), &icdPfd ) == 0)
|
|
|
|
{
|
|
|
|
DBGPRINT( "Warning: DrvDescribePixelFormat failed (%d)",
|
|
|
|
GetLastError() );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compare flags */
|
|
|
|
if ((pfd->dwFlags & compareFlags) != (icdPfd.dwFlags & compareFlags))
|
|
|
|
continue;
|
|
|
|
if (!(pfd->dwFlags & PFD_DOUBLEBUFFER_DONTCARE) &&
|
|
|
|
((pfd->dwFlags & PFD_DOUBLEBUFFER) != (icdPfd.dwFlags & PFD_DOUBLEBUFFER)))
|
|
|
|
continue;
|
|
|
|
if (!(pfd->dwFlags & PFD_STEREO_DONTCARE) &&
|
|
|
|
((pfd->dwFlags & PFD_STEREO) != (icdPfd.dwFlags & PFD_STEREO)))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* check other attribs */
|
|
|
|
score = 0; /* higher is worse */
|
|
|
|
if (pfd->iPixelType != icdPfd.iPixelType)
|
|
|
|
score += 5; /* this is really bad i think */
|
|
|
|
if (pfd->iLayerType != icdPfd.iLayerType)
|
|
|
|
score += 15; /* this is very very bad ;) */
|
|
|
|
|
|
|
|
score += BUFFERDEPTH_SCORE(pfd->cAlphaBits, icdPfd.cAlphaBits);
|
|
|
|
score += BUFFERDEPTH_SCORE(pfd->cAccumBits, icdPfd.cAccumBits);
|
|
|
|
score += BUFFERDEPTH_SCORE(pfd->cDepthBits, icdPfd.cDepthBits);
|
|
|
|
score += BUFFERDEPTH_SCORE(pfd->cStencilBits, icdPfd.cStencilBits);
|
|
|
|
score += BUFFERDEPTH_SCORE(pfd->cAuxBuffers, icdPfd.cAuxBuffers);
|
|
|
|
|
|
|
|
/* check score */
|
|
|
|
if (score < bestScore)
|
|
|
|
{
|
|
|
|
bestScore = score;
|
|
|
|
best = i + 1;
|
|
|
|
if (bestScore == 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-02-11 17:39:24 +00:00
|
|
|
if (best == 0)
|
2004-02-06 20:31:15 +00:00
|
|
|
SetLastError( 0 ); /* FIXME: set appropriate error */
|
2004-02-12 23:56:15 +00:00
|
|
|
OPENGL32_UnloadICD( icd );
|
2004-02-06 20:31:15 +00:00
|
|
|
|
2004-02-11 17:39:24 +00:00
|
|
|
DBGPRINT( "Info: Suggesting pixelformat %d", best );
|
2004-02-06 20:31:15 +00:00
|
|
|
return best;
|
2004-02-06 13:59:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-03 14:23:42 +00:00
|
|
|
/* FUNCTION: Copy data specified by mask from one GLRC to another.
|
|
|
|
* ARGUMENTS: [IN] src Source GLRC
|
|
|
|
* [OUT] dst Destination GLRC
|
|
|
|
* [IN] mask Bitfield like given to glPushAttrib()
|
|
|
|
* RETURN: TRUE on success, FALSE on failure
|
|
|
|
*/
|
2004-02-06 18:17:18 +00:00
|
|
|
BOOL
|
|
|
|
APIENTRY
|
|
|
|
rosglCopyContext( HGLRC hsrc, HGLRC hdst, UINT mask )
|
2004-02-03 14:23:42 +00:00
|
|
|
{
|
|
|
|
GLRC *src = (GLRC *)hsrc;
|
|
|
|
GLRC *dst = (GLRC *)hdst;
|
|
|
|
|
|
|
|
/* check glrcs */
|
|
|
|
if (!WGL_ContainsContext( src ))
|
|
|
|
{
|
|
|
|
DBGPRINT( "Error: src GLRC not found!" );
|
|
|
|
return FALSE; /* FIXME: SetLastError() */
|
|
|
|
}
|
|
|
|
if (!WGL_ContainsContext( dst ))
|
|
|
|
{
|
|
|
|
DBGPRINT( "Error: dst GLRC not found!" );
|
|
|
|
return FALSE; /* FIXME: SetLastError() */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* I think this is only possible within one ICD */
|
|
|
|
if (src->icd != src->icd)
|
|
|
|
{
|
|
|
|
DBGPRINT( "Error: src and dst GLRC use different ICDs!" );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* copy data (call ICD) */
|
|
|
|
return src->icd->DrvCopyContext( src->hglrc, dst->hglrc, mask );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* FUNCTION: Create a new GL Rendering Context for the given plane on
|
|
|
|
* the given DC.
|
|
|
|
* ARGUMENTS: [IN] hdc Handle for DC for which to create context
|
|
|
|
* [IN] layer Layer number to bind (draw?) to
|
|
|
|
* RETURNS: NULL on failure, new GLRC on success
|
|
|
|
*/
|
2004-02-06 18:17:18 +00:00
|
|
|
HGLRC
|
|
|
|
APIENTRY
|
|
|
|
rosglCreateLayerContext( HDC hdc, int layer )
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
2004-02-06 17:22:55 +00:00
|
|
|
/* LONG ret;
|
2004-02-02 05:36:37 +00:00
|
|
|
WCHAR driver[256];
|
2004-02-06 17:22:55 +00:00
|
|
|
DWORD dw, size;*/
|
2004-02-02 05:36:37 +00:00
|
|
|
|
2004-02-06 13:59:13 +00:00
|
|
|
GLDRIVERDATA *icd = NULL;
|
2004-02-03 14:23:42 +00:00
|
|
|
GLRC *glrc;
|
2004-02-02 17:59:23 +00:00
|
|
|
HGLRC drvHglrc = NULL;
|
2004-02-02 05:36:37 +00:00
|
|
|
|
2004-02-09 08:00:15 +00:00
|
|
|
/* if (GetObjectType( hdc ) != OBJ_DC)
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
2004-02-03 14:23:42 +00:00
|
|
|
DBGPRINT( "Error: hdc is not a DC handle!" );
|
2004-02-02 05:36:37 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2004-02-09 08:00:15 +00:00
|
|
|
*/
|
2004-02-02 05:36:37 +00:00
|
|
|
/* allocate our GLRC */
|
2004-02-03 14:23:42 +00:00
|
|
|
glrc = (GLRC*)HeapAlloc( GetProcessHeap(),
|
|
|
|
HEAP_ZERO_MEMORY | HEAP_GENERATE_EXCEPTIONS, sizeof (GLRC) );
|
2004-02-05 04:28:11 +00:00
|
|
|
if (glrc == NULL)
|
2004-02-02 05:36:37 +00:00
|
|
|
return NULL;
|
|
|
|
|
2004-02-06 17:22:55 +00:00
|
|
|
#if 0 /* old code */
|
2004-02-03 14:23:42 +00:00
|
|
|
/* try to find an ICD */
|
2004-02-05 04:28:11 +00:00
|
|
|
for (dw = 0; drvHglrc == NULL; dw++) /* enumerate values */
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
2004-02-05 04:28:11 +00:00
|
|
|
size = sizeof (driver) / sizeof (driver[0]);
|
|
|
|
ret = OPENGL32_RegEnumDrivers( dw, driver, &size );
|
|
|
|
if (ret != ERROR_SUCCESS)
|
2004-02-02 05:36:37 +00:00
|
|
|
break;
|
|
|
|
|
2004-02-02 17:59:23 +00:00
|
|
|
icd = OPENGL32_LoadICD( driver );
|
2004-02-03 14:23:42 +00:00
|
|
|
if (icd == NULL) /* try next ICD */
|
2004-02-02 05:36:37 +00:00
|
|
|
continue;
|
|
|
|
|
2004-02-05 04:28:11 +00:00
|
|
|
if (icd->DrvCreateLayerContext)
|
|
|
|
drvHglrc = icd->DrvCreateLayerContext( hdc, layer );
|
2004-02-06 17:22:55 +00:00
|
|
|
if (drvHglrc == NULL)
|
2004-02-05 04:28:11 +00:00
|
|
|
{
|
|
|
|
if (layer == 0)
|
|
|
|
drvHglrc = icd->DrvCreateContext( hdc );
|
|
|
|
else
|
|
|
|
DBGPRINT( "Warning: CreateLayerContext not supported by ICD!" );
|
|
|
|
}
|
2004-02-03 14:23:42 +00:00
|
|
|
if (drvHglrc == NULL) /* try next ICD */
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
2004-02-05 04:28:11 +00:00
|
|
|
DBGPRINT( "Info: DrvCreateContext (driver = %ws) failed: %d",
|
2004-02-02 05:36:37 +00:00
|
|
|
icd->driver_name, GetLastError() );
|
|
|
|
OPENGL32_UnloadICD( icd );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2004-02-03 14:23:42 +00:00
|
|
|
/* the ICD was loaded successfully and we got a HGLRC in drvHglrc */
|
2004-02-02 05:36:37 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-02-06 13:59:13 +00:00
|
|
|
if (drvHglrc == NULL || icd == NULL) /* no ICD was found */
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
|
|
|
/* FIXME: fallback to mesa */
|
2004-02-05 04:28:11 +00:00
|
|
|
DBGPRINT( "Error: No working ICD found!" );
|
2004-02-03 14:23:42 +00:00
|
|
|
HeapFree( GetProcessHeap(), 0, glrc );
|
2004-02-02 05:36:37 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2004-02-06 17:22:55 +00:00
|
|
|
#endif /* unused */
|
|
|
|
|
|
|
|
/* load ICD */
|
|
|
|
icd = OPENGL32_LoadICDForHDC( hdc );
|
|
|
|
if (icd == NULL)
|
|
|
|
{
|
|
|
|
DBGPRINT( "Couldn't get ICD by HDC :-(" );
|
|
|
|
/* FIXME: fallback? */
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* create context */
|
2004-02-06 20:31:15 +00:00
|
|
|
if (icd->DrvCreateLayerContext != NULL)
|
2004-02-06 17:22:55 +00:00
|
|
|
drvHglrc = icd->DrvCreateLayerContext( hdc, layer );
|
|
|
|
if (drvHglrc == NULL)
|
|
|
|
{
|
2004-02-06 20:31:15 +00:00
|
|
|
if (layer == 0 && icd->DrvCreateContext != NULL)
|
2004-02-06 17:22:55 +00:00
|
|
|
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;
|
|
|
|
}
|
2004-02-02 05:36:37 +00:00
|
|
|
|
2004-02-03 14:23:42 +00:00
|
|
|
/* we have our GLRC in glrc and the ICD's GLRC in drvHglrc */
|
|
|
|
glrc->hglrc = drvHglrc;
|
|
|
|
glrc->icd = icd;
|
2004-02-02 05:36:37 +00:00
|
|
|
|
2004-02-03 14:23:42 +00:00
|
|
|
/* append glrc to context list */
|
|
|
|
WGL_AppendContext( glrc );
|
|
|
|
|
|
|
|
return (HGLRC)glrc;
|
2004-02-02 05:36:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-06 18:17:18 +00:00
|
|
|
/* FUNCTION: Create a new GL Rendering Context for the given DC.
|
|
|
|
* ARGUMENTS: [IN] hdc Handle for DC for which to create context
|
|
|
|
* RETURNS: NULL on failure, new GLRC on success
|
|
|
|
*/
|
|
|
|
HGLRC
|
|
|
|
APIENTRY
|
|
|
|
rosglCreateContext( HDC hdc )
|
|
|
|
{
|
|
|
|
return rosglCreateLayerContext( hdc, 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-03 14:23:42 +00:00
|
|
|
/* FUNCTION: Delete an OpenGL context
|
|
|
|
* ARGUMENTS: [IN] hglrc Handle to GLRC to delete; must not be a threads RC!
|
|
|
|
* RETURNS: TRUE on success, FALSE otherwise
|
|
|
|
*/
|
2004-02-06 18:17:18 +00:00
|
|
|
BOOL
|
|
|
|
APIENTRY
|
|
|
|
rosglDeleteContext( HGLRC hglrc )
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
2004-02-03 14:23:42 +00:00
|
|
|
GLRC *glrc = (GLRC *)hglrc;
|
|
|
|
|
|
|
|
/* check if we know about this context */
|
|
|
|
if (!WGL_ContainsContext( glrc ))
|
|
|
|
{
|
|
|
|
DBGPRINT( "Error: hglrc not found!" );
|
|
|
|
return FALSE; /* FIXME: SetLastError() */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* make sure GLRC is not current for some thread */
|
|
|
|
if (glrc->is_current)
|
|
|
|
{
|
|
|
|
DBGPRINT( "Error: GLRC is current for DC 0x%08x", glrc->hdc );
|
|
|
|
return FALSE; /* FIXME: SetLastError() */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* release ICD's context */
|
|
|
|
if (glrc->hglrc != NULL)
|
|
|
|
{
|
|
|
|
if (!glrc->icd->DrvDeleteContext( glrc->hglrc ))
|
|
|
|
{
|
|
|
|
DBGPRINT( "Warning: DrvDeleteContext() failed (%d)", GetLastError() );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* free resources */
|
2004-02-06 17:22:55 +00:00
|
|
|
OPENGL32_UnloadICD( glrc->icd );
|
2004-02-03 14:23:42 +00:00
|
|
|
WGL_RemoveContext( glrc );
|
|
|
|
HeapFree( GetProcessHeap(), 0, glrc );
|
|
|
|
|
|
|
|
return TRUE;
|
2004-02-02 05:36:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-06 18:17:18 +00:00
|
|
|
BOOL
|
|
|
|
APIENTRY
|
|
|
|
rosglDescribeLayerPlane( HDC hdc, int iPixelFormat, int iLayerPlane,
|
2004-02-02 17:59:23 +00:00
|
|
|
UINT nBytes, LPLAYERPLANEDESCRIPTOR plpd )
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
2004-02-06 13:59:13 +00:00
|
|
|
UNIMPLEMENTED;
|
|
|
|
return FALSE;
|
|
|
|
}
|
2004-02-03 14:23:42 +00:00
|
|
|
|
|
|
|
|
2004-02-06 18:17:18 +00:00
|
|
|
int
|
|
|
|
APIENTRY
|
|
|
|
rosglDescribePixelFormat( HDC hdc, int iFormat, UINT nBytes,
|
2004-02-06 13:59:13 +00:00
|
|
|
LPPIXELFORMATDESCRIPTOR pfd )
|
|
|
|
{
|
2004-02-06 17:22:55 +00:00
|
|
|
int ret = 0;
|
|
|
|
GLDRIVERDATA *icd = OPENGL32_LoadICDForHDC( hdc );
|
|
|
|
|
|
|
|
if (icd != NULL)
|
|
|
|
{
|
|
|
|
ret = icd->DrvDescribePixelFormat( hdc, iFormat, nBytes, pfd );
|
|
|
|
if (ret == 0)
|
2004-02-11 17:39:24 +00:00
|
|
|
DBGPRINT( "Error: DrvDescribePixelFormat(format=%d) failed (%d)", iFormat, GetLastError() );
|
2004-02-12 23:56:15 +00:00
|
|
|
OPENGL32_UnloadICD( icd );
|
2004-02-06 17:22:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: implement own functionality? */
|
|
|
|
return ret;
|
2004-02-02 05:36:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-03 14:23:42 +00:00
|
|
|
/* FUNCTION: Return the current GLRC
|
|
|
|
* RETURNS: Current GLRC (NULL if none was set current)
|
|
|
|
*/
|
2004-02-06 18:17:18 +00:00
|
|
|
HGLRC
|
|
|
|
APIENTRY
|
|
|
|
rosglGetCurrentContext()
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
2004-02-03 14:23:42 +00:00
|
|
|
return (HGLRC)(OPENGL32_threaddata->glrc);
|
2004-02-02 05:36:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-03 14:23:42 +00:00
|
|
|
/* FUNCTION: Return the current DC
|
|
|
|
* RETURNS: NULL on failure, current DC otherwise
|
|
|
|
*/
|
2004-02-06 18:17:18 +00:00
|
|
|
HDC
|
|
|
|
APIENTRY
|
|
|
|
rosglGetCurrentDC()
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
2004-02-03 14:23:42 +00:00
|
|
|
/* FIXME: is it correct to return NULL when there is no current GLRC or
|
|
|
|
is there another way to find out the wanted HDC? */
|
|
|
|
if (OPENGL32_threaddata->glrc == NULL)
|
|
|
|
return NULL;
|
|
|
|
return (HDC)(OPENGL32_threaddata->glrc->hdc);
|
2004-02-02 05:36:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-06 18:17:18 +00:00
|
|
|
int
|
|
|
|
APIENTRY
|
|
|
|
rosglGetLayerPaletteEntries( HDC hdc, int iLayerPlane, int iStart,
|
2004-02-03 14:23:42 +00:00
|
|
|
int cEntries, COLORREF *pcr )
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
2004-02-06 13:59:13 +00:00
|
|
|
UNIMPLEMENTED;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-06 18:17:18 +00:00
|
|
|
int
|
|
|
|
WINAPI
|
|
|
|
rosglGetPixelFormat( HDC hdc )
|
2004-02-06 13:59:13 +00:00
|
|
|
{
|
2004-02-09 08:00:15 +00:00
|
|
|
if (OPENGL32_processdata.cachedHdc == hdc)
|
|
|
|
return OPENGL32_processdata.cachedFormat;
|
|
|
|
|
|
|
|
/* FIXME: create real implementation of this function */
|
|
|
|
DBGPRINT( "Warning: Pixel format not cached, returning 0" );
|
|
|
|
|
2004-02-02 17:59:23 +00:00
|
|
|
return 0;
|
2004-02-02 05:36:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-03 14:23:42 +00:00
|
|
|
/* FUNCTION: Get the address for an OpenGL extension function from the current ICD.
|
|
|
|
* ARGUMENTS: [IN] proc: Name of the function to look for
|
|
|
|
* RETURNS: The address of the proc or NULL on failure.
|
|
|
|
*/
|
2004-02-06 18:17:18 +00:00
|
|
|
PROC
|
|
|
|
APIENTRY
|
|
|
|
rosglGetProcAddress( LPCSTR proc )
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
2004-02-03 14:23:42 +00:00
|
|
|
if (OPENGL32_threaddata->glrc == NULL)
|
|
|
|
{
|
|
|
|
DBGPRINT( "Error: No current GLRC!" );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (proc[0] == 'g' && proc[1] == 'l') /* glXXX */
|
|
|
|
{
|
2004-02-12 23:56:15 +00:00
|
|
|
PROC glXXX = NULL;
|
|
|
|
GLDRIVERDATA *icd = OPENGL32_threaddata->glrc->icd;
|
|
|
|
glXXX = icd->DrvGetProcAddress( proc );
|
2004-02-03 14:23:42 +00:00
|
|
|
if (glXXX)
|
|
|
|
{
|
|
|
|
DBGPRINT( "Info: Proc \"%s\" loaded from ICD.", proc );
|
|
|
|
return glXXX;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: go through own functions? */
|
2004-02-06 17:22:55 +00:00
|
|
|
DBGPRINT( "Warning: Unsupported GL extension: %s", proc );
|
2004-02-03 14:23:42 +00:00
|
|
|
}
|
2004-02-05 04:28:11 +00:00
|
|
|
if (proc[0] == 'w' && proc[1] == 'g' && proc[2] == 'l') /* wglXXX */
|
2004-02-03 14:23:42 +00:00
|
|
|
{
|
|
|
|
/* FIXME: support wgl extensions? (there are such IIRC) */
|
2004-02-06 17:22:55 +00:00
|
|
|
DBGPRINT( "Warning: Unsupported WGL extension: %s", proc );
|
2004-02-03 14:23:42 +00:00
|
|
|
}
|
2004-02-05 04:28:11 +00:00
|
|
|
if (proc[0] == 'g' && proc[1] == 'l' && proc[2] == 'u') /* gluXXX */
|
2004-02-03 14:23:42 +00:00
|
|
|
{
|
2004-02-05 04:28:11 +00:00
|
|
|
/* FIXME: do we support these as well? */
|
2004-02-06 17:22:55 +00:00
|
|
|
DBGPRINT( "Warning: GLU extension %s requested, returning NULL", proc );
|
2004-02-03 14:23:42 +00:00
|
|
|
}
|
|
|
|
|
2004-02-02 17:59:23 +00:00
|
|
|
return NULL;
|
2004-02-02 05:36:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-03 14:23:42 +00:00
|
|
|
/* FUNCTION: make the given GLRC the threads current GLRC for hdc
|
|
|
|
* ARGUMENTS: [IN] hdc Handle for a DC to be drawn on
|
|
|
|
* [IN] hglrc Handle for a GLRC to make current
|
|
|
|
* RETURNS: TRUE on success, FALSE otherwise
|
|
|
|
*/
|
2004-02-06 18:17:18 +00:00
|
|
|
BOOL
|
|
|
|
APIENTRY
|
|
|
|
rosglMakeCurrent( HDC hdc, HGLRC hglrc )
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
2004-02-03 14:23:42 +00:00
|
|
|
GLRC *glrc = (GLRC *)hglrc;
|
2004-02-11 17:39:24 +00:00
|
|
|
ICDTable *icdTable = NULL;
|
2004-02-03 14:23:42 +00:00
|
|
|
|
2004-02-06 13:59:13 +00:00
|
|
|
/* flush current context */
|
|
|
|
if (OPENGL32_threaddata->glrc != NULL)
|
|
|
|
{
|
|
|
|
glFlush();
|
|
|
|
}
|
2004-02-05 04:28:11 +00:00
|
|
|
|
2004-02-12 23:56:15 +00:00
|
|
|
/* check if current context is unset */
|
|
|
|
if (glrc == NULL)
|
2004-02-03 14:23:42 +00:00
|
|
|
{
|
2004-02-12 23:56:15 +00:00
|
|
|
if (OPENGL32_threaddata->glrc != NULL)
|
|
|
|
{
|
|
|
|
OPENGL32_threaddata->glrc->is_current = FALSE;
|
|
|
|
OPENGL32_threaddata->glrc = NULL;
|
|
|
|
}
|
2004-02-03 14:23:42 +00:00
|
|
|
}
|
2004-02-12 23:56:15 +00:00
|
|
|
else
|
2004-02-03 14:23:42 +00:00
|
|
|
{
|
2004-02-12 23:56:15 +00:00
|
|
|
/* check hdc */
|
|
|
|
if (GetObjectType( hdc ) != OBJ_DC && GetObjectType( hdc ) != OBJ_MEMDC)
|
|
|
|
{
|
|
|
|
DBGPRINT( "Error: hdc is not a DC handle!" );
|
|
|
|
return FALSE;
|
|
|
|
}
|
2004-02-03 14:23:42 +00:00
|
|
|
|
2004-02-12 23:56:15 +00:00
|
|
|
/* check if we know about this glrc */
|
|
|
|
if (!WGL_ContainsContext( glrc ))
|
|
|
|
{
|
|
|
|
DBGPRINT( "Error: hglrc not found!" );
|
|
|
|
return FALSE; /* FIXME: SetLastError() */
|
|
|
|
}
|
2004-02-03 14:23:42 +00:00
|
|
|
|
2004-02-12 23:56:15 +00:00
|
|
|
/* check if it is available */
|
|
|
|
if (glrc->is_current && glrc->thread_id != GetCurrentThreadId()) /* used by another thread */
|
2004-02-03 14:23:42 +00:00
|
|
|
{
|
2004-02-12 23:56:15 +00:00
|
|
|
DBGPRINT( "Error: hglrc is current for thread 0x%08x", glrc->thread_id );
|
|
|
|
return FALSE; /* FIXME: SetLastError() */
|
2004-02-03 14:23:42 +00:00
|
|
|
}
|
2004-02-12 23:56:15 +00:00
|
|
|
|
|
|
|
/* call the ICD */
|
|
|
|
if (glrc->hglrc != NULL)
|
|
|
|
{
|
|
|
|
icdTable = glrc->icd->DrvSetContext( hdc, glrc->hglrc,
|
|
|
|
WGL_SetContextCallBack );
|
|
|
|
if (icdTable == NULL)
|
|
|
|
{
|
|
|
|
DBGPRINT( "Error: DrvSetContext failed (%d)\n", GetLastError() );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
DBGPRINT( "Info: DrvSetContext succeeded!" );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* make it current */
|
|
|
|
if (OPENGL32_threaddata->glrc != NULL)
|
|
|
|
OPENGL32_threaddata->glrc->is_current = FALSE;
|
|
|
|
glrc->is_current = TRUE;
|
|
|
|
glrc->thread_id = GetCurrentThreadId();
|
|
|
|
glrc->hdc = hdc;
|
|
|
|
OPENGL32_threaddata->glrc = glrc;
|
2004-02-03 14:23:42 +00:00
|
|
|
}
|
|
|
|
|
2004-02-12 23:56:15 +00:00
|
|
|
WGL_SetContextCallBack( icdTable );
|
2004-02-03 14:23:42 +00:00
|
|
|
|
2004-02-11 17:39:24 +00:00
|
|
|
if (icdTable != NULL)
|
|
|
|
if (WGL_SetContextCallBack( icdTable ) != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
DBGPRINT( "Warning: WGL_SetContextCallBack failed!" );
|
|
|
|
}
|
|
|
|
|
2004-02-03 14:23:42 +00:00
|
|
|
return TRUE;
|
2004-02-02 05:36:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-06 18:17:18 +00:00
|
|
|
BOOL
|
|
|
|
APIENTRY
|
|
|
|
rosglRealizeLayerPalette( HDC hdc, int iLayerPlane, BOOL bRealize )
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
2004-02-06 13:59:13 +00:00
|
|
|
UNIMPLEMENTED;
|
2004-02-02 17:59:23 +00:00
|
|
|
return FALSE;
|
2004-02-02 05:36:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-06 18:17:18 +00:00
|
|
|
int
|
|
|
|
APIENTRY
|
|
|
|
rosglSetLayerPaletteEntries( HDC hdc, int iLayerPlane, int iStart,
|
|
|
|
int cEntries, CONST COLORREF *pcr )
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
2004-02-06 13:59:13 +00:00
|
|
|
UNIMPLEMENTED;
|
2004-02-02 17:59:23 +00:00
|
|
|
return 0;
|
2004-02-02 05:36:37 +00:00
|
|
|
}
|
|
|
|
|
2004-02-06 13:59:13 +00:00
|
|
|
|
2004-02-06 18:17:18 +00:00
|
|
|
BOOL
|
|
|
|
WINAPI
|
|
|
|
rosglSetPixelFormat( HDC hdc, int iFormat, CONST PIXELFORMATDESCRIPTOR *pfd )
|
2004-02-06 13:59:13 +00:00
|
|
|
{
|
2004-02-06 17:22:55 +00:00
|
|
|
GLDRIVERDATA *icd;
|
|
|
|
|
|
|
|
icd = OPENGL32_LoadICDForHDC( hdc );
|
|
|
|
if (icd == NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (!icd->DrvSetPixelFormat( hdc, iFormat, pfd ))
|
|
|
|
{
|
2004-02-11 17:39:24 +00:00
|
|
|
DBGPRINT( "Warning: DrvSetPixelFormat(format=%d) failed (%d)",
|
|
|
|
iFormat, GetLastError() );
|
2004-02-12 23:56:15 +00:00
|
|
|
OPENGL32_UnloadICD( icd );
|
2004-02-06 17:22:55 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-02-09 08:00:15 +00:00
|
|
|
OPENGL32_processdata.cachedHdc = hdc;
|
|
|
|
OPENGL32_processdata.cachedFormat = iFormat;
|
2004-02-12 23:56:15 +00:00
|
|
|
OPENGL32_UnloadICD( icd );
|
2004-02-09 08:00:15 +00:00
|
|
|
|
2004-02-06 17:22:55 +00:00
|
|
|
return TRUE;
|
2004-02-06 13:59:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-03 14:23:42 +00:00
|
|
|
/* FUNCTION: Enable display-list sharing between multiple GLRCs
|
|
|
|
* ARGUMENTS: [IN] hglrc1 GLRC number 1
|
|
|
|
* [IN] hglrc2 GLRC number 2
|
|
|
|
* RETURNS: TRUR on success, FALSE on failure
|
|
|
|
*/
|
2004-02-06 18:17:18 +00:00
|
|
|
BOOL
|
|
|
|
APIENTRY
|
|
|
|
rosglShareLists( HGLRC hglrc1, HGLRC hglrc2 )
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
2004-02-03 14:23:42 +00:00
|
|
|
GLRC *glrc1 = (GLRC *)hglrc1;
|
|
|
|
GLRC *glrc2 = (GLRC *)hglrc2;
|
|
|
|
|
|
|
|
/* check glrcs */
|
|
|
|
if (!WGL_ContainsContext( glrc1 ))
|
|
|
|
{
|
|
|
|
DBGPRINT( "Error: hglrc1 not found!" );
|
|
|
|
return FALSE; /* FIXME: SetLastError() */
|
|
|
|
}
|
|
|
|
if (!WGL_ContainsContext( glrc2 ))
|
|
|
|
{
|
|
|
|
DBGPRINT( "Error: hglrc2 not found!" );
|
|
|
|
return FALSE; /* FIXME: SetLastError() */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* I think this is only possible within one ICD */
|
|
|
|
if (glrc1->icd != glrc2->icd)
|
|
|
|
{
|
|
|
|
DBGPRINT( "Error: hglrc1 and hglrc2 use different ICDs!" );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* share lists (call ICD) */
|
|
|
|
return glrc1->icd->DrvShareLists( glrc1->hglrc, glrc2->hglrc );
|
|
|
|
}
|
|
|
|
|
2004-02-06 13:59:13 +00:00
|
|
|
|
2004-02-03 14:23:42 +00:00
|
|
|
/* FUNCTION: Flushes GL and swaps front/back buffer if appropriate
|
|
|
|
* ARGUMENTS: [IN] hdc Handle to device context to swap buffers for
|
|
|
|
* RETURNS: TRUE on success, FALSE on failure
|
|
|
|
*/
|
2004-02-06 18:17:18 +00:00
|
|
|
BOOL
|
|
|
|
APIENTRY
|
|
|
|
rosglSwapBuffers( HDC hdc )
|
2004-02-03 14:23:42 +00:00
|
|
|
{
|
2004-02-06 17:22:55 +00:00
|
|
|
GLDRIVERDATA *icd = OPENGL32_LoadICDForHDC( hdc );
|
|
|
|
if (icd != NULL)
|
|
|
|
{
|
|
|
|
if (!icd->DrvSwapBuffers( hdc ))
|
|
|
|
{
|
|
|
|
DBGPRINT( "Error: DrvSwapBuffers failed (%d)", GetLastError() );
|
2004-02-12 23:56:15 +00:00
|
|
|
OPENGL32_UnloadICD( icd );
|
2004-02-06 17:22:55 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2004-02-12 23:56:15 +00:00
|
|
|
OPENGL32_UnloadICD( icd );
|
2004-02-06 17:22:55 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2004-02-03 14:23:42 +00:00
|
|
|
|
2004-02-06 17:22:55 +00:00
|
|
|
/* FIXME: implement own functionality? */
|
2004-02-02 17:59:23 +00:00
|
|
|
return FALSE;
|
2004-02-02 05:36:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-06 18:17:18 +00:00
|
|
|
BOOL
|
|
|
|
APIENTRY
|
|
|
|
rosglSwapLayerBuffers( HDC hdc, UINT fuPlanes )
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
2004-02-06 13:59:13 +00:00
|
|
|
UNIMPLEMENTED;
|
2004-02-02 17:59:23 +00:00
|
|
|
return FALSE;
|
2004-02-02 05:36:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-06 18:17:18 +00:00
|
|
|
BOOL
|
|
|
|
APIENTRY
|
|
|
|
rosglUseFontBitmapsA( HDC hdc, DWORD first, DWORD count, DWORD listBase )
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
2004-02-06 13:59:13 +00:00
|
|
|
UNIMPLEMENTED;
|
2004-02-02 17:59:23 +00:00
|
|
|
return FALSE;
|
2004-02-02 05:36:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-06 18:17:18 +00:00
|
|
|
BOOL
|
|
|
|
APIENTRY
|
|
|
|
rosglUseFontBitmapsW( HDC hdc, DWORD first, DWORD count, DWORD listBase )
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
2004-02-06 13:59:13 +00:00
|
|
|
UNIMPLEMENTED;
|
2004-02-02 17:59:23 +00:00
|
|
|
return FALSE;
|
2004-02-02 05:36:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-06 18:17:18 +00:00
|
|
|
BOOL
|
|
|
|
APIENTRY
|
|
|
|
rosglUseFontOutlinesA( HDC hdc, DWORD first, DWORD count, DWORD listBase,
|
2004-02-03 14:23:42 +00:00
|
|
|
FLOAT deviation, FLOAT extrusion, int format,
|
|
|
|
LPGLYPHMETRICSFLOAT lpgmf )
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
2004-02-06 13:59:13 +00:00
|
|
|
UNIMPLEMENTED;
|
2004-02-02 17:59:23 +00:00
|
|
|
return FALSE;
|
2004-02-02 05:36:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-06 18:17:18 +00:00
|
|
|
BOOL
|
|
|
|
APIENTRY
|
|
|
|
rosglUseFontOutlinesW( HDC hdc, DWORD first, DWORD count, DWORD listBase,
|
2004-02-03 14:23:42 +00:00
|
|
|
FLOAT deviation, FLOAT extrusion, int format,
|
|
|
|
LPGLYPHMETRICSFLOAT lpgmf )
|
2004-02-02 05:36:37 +00:00
|
|
|
{
|
2004-02-06 13:59:13 +00:00
|
|
|
UNIMPLEMENTED;
|
2004-02-02 17:59:23 +00:00
|
|
|
return FALSE;
|
2004-02-02 05:36:37 +00:00
|
|
|
}
|
|
|
|
|
2004-02-06 18:17:18 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}; // extern "C"
|
|
|
|
#endif//__cplusplus
|
|
|
|
|
2004-02-03 14:23:42 +00:00
|
|
|
/* EOF */
|