mirror of
https://github.com/reactos/reactos.git
synced 2024-07-08 21:55:08 +00:00
more work on openg32
svn path=/trunk/; revision=7965
This commit is contained in:
parent
927fc7ad03
commit
809430ad58
|
@ -1,4 +1,4 @@
|
|||
/* $Id: opengl32.c,v 1.1 2004/02/01 07:11:06 royce Exp $
|
||||
/* $Id: opengl32.c,v 1.2 2004/02/01 17:07:16 royce Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -16,20 +16,59 @@
|
|||
|
||||
#define EXPORT __declspec(dllexport)
|
||||
|
||||
static void OPENGL32_ThreadDetach()
|
||||
{
|
||||
/* FIXME - do we need to release some HDC or something? */
|
||||
lpvData = (OPENGL32_ThreadData*)TlsGetValue ( OPENGL32_tls );
|
||||
if ( lpvData != NULL )
|
||||
LocalFree((HLOCAL) lpvData );
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved)
|
||||
{
|
||||
GLTHREADDATA* lpData = NULL;
|
||||
printf("OpenGL32.DLL DllMain called!\n");
|
||||
|
||||
switch ( Reason )
|
||||
{
|
||||
/* The DLL is loading due to process
|
||||
* initialization or a call to LoadLibrary.
|
||||
*/
|
||||
case DLL_PROCESS_ATTACH:
|
||||
/* FIXME - setup TLS */
|
||||
break;
|
||||
OPENGL32_tls = TlsAlloc();
|
||||
if ( 0xFFFFFFFF == OPENGL32_tls )
|
||||
return FALSE;
|
||||
OPENGL32_processdata.funclist_count = 1;
|
||||
OPENGL32_processdata.list = malloc ( sizeof(GLFUNCLIST*) * OPENGL32_processdata.funclist_count );
|
||||
OPENGL32_processdata.list[0] = malloc ( sizeof(GLFUNCLIST) );
|
||||
memset ( OPENGL32_processdata.list[0], 0, sizeof(GLFUNCLIST) );
|
||||
/* FIXME - load mesa32 into first funclist */
|
||||
/* FIXME - get list of ICDs from registry */
|
||||
// No break: Initialize the index for first thread.
|
||||
|
||||
/* The attached process creates a new thread. */
|
||||
case DLL_THREAD_ATTACH:
|
||||
lpData = (GLTHREADDATA*)LocalAlloc(LPTR, sizeof(GLTHREADDATA));
|
||||
if ( lpData != NULL )
|
||||
{
|
||||
memset ( lpData, 0, sizeof(GLTHREADDATA) );
|
||||
(void)TlsSetValue ( OPENGL32_tls, lpData );
|
||||
}
|
||||
lpData->hdc = NULL;
|
||||
/* FIXME - defaulting to mesa3d, but shouldn't */
|
||||
lpData->list = OPENGL32_processdata.list[0];
|
||||
break;
|
||||
|
||||
/* The thread of the attached process terminates. */
|
||||
case DLL_THREAD_DETACH:
|
||||
/* Release the allocated memory for this thread.*/
|
||||
OPENGL32_ThreadDetach();
|
||||
break;
|
||||
|
||||
/* DLL unload due to process termination or FreeLibrary. */
|
||||
case DLL_PROCESS_DETACH:
|
||||
OPENGL32_ThreadDetach();
|
||||
TlsFree(OPENGL32_tls);
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: opengl32.edf,v 1.1 2004/02/01 07:11:06 royce Exp $
|
||||
; $Id: opengl32.edf,v 1.2 2004/02/01 17:07:16 royce Exp $
|
||||
;
|
||||
; opengl32.edf
|
||||
;
|
||||
|
@ -12,7 +12,7 @@ glAccum=glAccum@8
|
|||
glAlphaFunc=glAlphaFunc@8
|
||||
glAreTexturesResident=glAreTexturesResident@12
|
||||
glArrayElement=glArrayElement@4
|
||||
glBegin=glBegin@0
|
||||
glBegin=glBegin@4
|
||||
glBindTexture=glBindTexture@8
|
||||
glBitmap=glBitmap@28
|
||||
glBlendFunc=glBlendFunc@8
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: opengl32.h,v 1.1 2004/02/01 07:11:06 royce Exp $
|
||||
/* $Id: opengl32.h,v 1.2 2004/02/01 17:07:16 royce Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -60,4 +60,20 @@ typedef struct tagGLFUNCLIST
|
|||
PGLEND glEnd;
|
||||
} GLFUNCLIST;
|
||||
|
||||
typedef struct tagGLPROCESSDATA
|
||||
{
|
||||
int funclist_count;
|
||||
GLFUNCLIST* lists; // array of GLFUNCLIST pointers
|
||||
} GLPROCESSDATA;
|
||||
|
||||
typedef struct tagGLTHREADDATA
|
||||
{
|
||||
HDC hdc; // current HDC
|
||||
GLFUNCLIST* list; // *current* func list
|
||||
/* FIXME - what else do we need here? */
|
||||
}; GLTHREADDATA;
|
||||
|
||||
extern DWORD OPENGL32_tls;
|
||||
extern GLPROCESSDATA OPENGL32_processdata;
|
||||
|
||||
#endif//OPENGL32_PRIVATE_H
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: stubs.c,v 1.1 2004/02/01 07:11:06 royce Exp $
|
||||
/* $Id: stubs.c,v 1.2 2004/02/01 17:07:16 royce Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -18,7 +18,7 @@ GLFUNCLIST*
|
|||
OPENGL32_GetFuncList(); // see bottom of this file...
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
void
|
||||
WINAPI
|
||||
|
@ -26,11 +26,14 @@ glAccum (
|
|||
GLenum op,
|
||||
GLfloat value )
|
||||
{
|
||||
UNIMPLEMENTED; /* FIXME */
|
||||
GLFUNCLIST* list = OPENGL32_GetFuncList();
|
||||
/* FIXME - jump directly to target... */
|
||||
if ( list )
|
||||
(*list->glAccum)(op,value);
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
static // not exported, except via wglGetProcAddress
|
||||
void
|
||||
|
@ -41,11 +44,11 @@ glAddSwapHintRectWIN (
|
|||
GLsizei width,
|
||||
GLsizei height )
|
||||
{
|
||||
UNIMPLEMENTED; /* FIXME */
|
||||
(*OPENGL32_GetFuncList()->glAddSwapHintRectWIN)(x,y,width,height);
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
void
|
||||
WINAPI
|
||||
|
@ -53,7 +56,7 @@ glAlphaFunc (
|
|||
GLenum func,
|
||||
GLclampf ref )
|
||||
{
|
||||
UNIMPLEMENTED; /* FIXME */
|
||||
(*OPENGL32_GetFuncList()->glAlphaFunc)(func,ref);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -511,23 +514,7 @@ wglUseFontOutlinesW=wglUseFontOutlinesW@32
|
|||
GLFUNCLIST*
|
||||
OPENGL32_GetFuncList()
|
||||
{
|
||||
/* FIXME - this is sooooo not right, but it's close... */
|
||||
static GLFUNCLIST* list = NULL;
|
||||
if ( !list )
|
||||
{
|
||||
list = malloc ( sizeof(GLFUNCLIST) );
|
||||
memset ( list, 0, sizeof(GLFUNCLIST) );
|
||||
list->glAccum = glAccum;
|
||||
list->glAddSwapHintRectWIN = glAddSwapHintRectWIN;
|
||||
list->glArrayElement = glArrayElement;
|
||||
list->glBegin = glBegin;
|
||||
list->glBindTexture = glBindTexture;
|
||||
list->glEnd = glEnd;
|
||||
/* FIXME - add more */
|
||||
/* FIXME - query registry looking for drivers, we actually
|
||||
need multiple GLFUNCLIST objects depending on which driver
|
||||
the end-user is currently interacting with
|
||||
*/
|
||||
}
|
||||
return list;
|
||||
threaddata = (OPENGL32_ThreadData*)TlsGetValue ( OPENGL32_tls );
|
||||
ASSERT(threaddata);
|
||||
return threaddata->list;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue