mirror of
https://github.com/reactos/reactos.git
synced 2024-07-21 03:37:57 +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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -16,20 +16,59 @@
|
||||||
|
|
||||||
#define EXPORT __declspec(dllexport)
|
#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)
|
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved)
|
||||||
{
|
{
|
||||||
|
GLTHREADDATA* lpData = NULL;
|
||||||
printf("OpenGL32.DLL DllMain called!\n");
|
printf("OpenGL32.DLL DllMain called!\n");
|
||||||
|
|
||||||
switch ( Reason )
|
switch ( Reason )
|
||||||
{
|
{
|
||||||
|
/* The DLL is loading due to process
|
||||||
|
* initialization or a call to LoadLibrary.
|
||||||
|
*/
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
/* FIXME - setup TLS */
|
OPENGL32_tls = TlsAlloc();
|
||||||
break;
|
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:
|
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;
|
break;
|
||||||
|
|
||||||
|
/* The thread of the attached process terminates. */
|
||||||
case DLL_THREAD_DETACH:
|
case DLL_THREAD_DETACH:
|
||||||
|
/* Release the allocated memory for this thread.*/
|
||||||
|
OPENGL32_ThreadDetach();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* DLL unload due to process termination or FreeLibrary. */
|
||||||
case DLL_PROCESS_DETACH:
|
case DLL_PROCESS_DETACH:
|
||||||
|
OPENGL32_ThreadDetach();
|
||||||
|
TlsFree(OPENGL32_tls);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return TRUE;
|
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
|
; opengl32.edf
|
||||||
;
|
;
|
||||||
|
@ -12,7 +12,7 @@ glAccum=glAccum@8
|
||||||
glAlphaFunc=glAlphaFunc@8
|
glAlphaFunc=glAlphaFunc@8
|
||||||
glAreTexturesResident=glAreTexturesResident@12
|
glAreTexturesResident=glAreTexturesResident@12
|
||||||
glArrayElement=glArrayElement@4
|
glArrayElement=glArrayElement@4
|
||||||
glBegin=glBegin@0
|
glBegin=glBegin@4
|
||||||
glBindTexture=glBindTexture@8
|
glBindTexture=glBindTexture@8
|
||||||
glBitmap=glBitmap@28
|
glBitmap=glBitmap@28
|
||||||
glBlendFunc=glBlendFunc@8
|
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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -60,4 +60,20 @@ typedef struct tagGLFUNCLIST
|
||||||
PGLEND glEnd;
|
PGLEND glEnd;
|
||||||
} GLFUNCLIST;
|
} 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
|
#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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -18,7 +18,7 @@ GLFUNCLIST*
|
||||||
OPENGL32_GetFuncList(); // see bottom of this file...
|
OPENGL32_GetFuncList(); // see bottom of this file...
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
WINAPI
|
WINAPI
|
||||||
|
@ -26,11 +26,14 @@ glAccum (
|
||||||
GLenum op,
|
GLenum op,
|
||||||
GLfloat value )
|
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
|
static // not exported, except via wglGetProcAddress
|
||||||
void
|
void
|
||||||
|
@ -41,11 +44,11 @@ glAddSwapHintRectWIN (
|
||||||
GLsizei width,
|
GLsizei width,
|
||||||
GLsizei height )
|
GLsizei height )
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED; /* FIXME */
|
(*OPENGL32_GetFuncList()->glAddSwapHintRectWIN)(x,y,width,height);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
WINAPI
|
WINAPI
|
||||||
|
@ -53,7 +56,7 @@ glAlphaFunc (
|
||||||
GLenum func,
|
GLenum func,
|
||||||
GLclampf ref )
|
GLclampf ref )
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED; /* FIXME */
|
(*OPENGL32_GetFuncList()->glAlphaFunc)(func,ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -511,23 +514,7 @@ wglUseFontOutlinesW=wglUseFontOutlinesW@32
|
||||||
GLFUNCLIST*
|
GLFUNCLIST*
|
||||||
OPENGL32_GetFuncList()
|
OPENGL32_GetFuncList()
|
||||||
{
|
{
|
||||||
/* FIXME - this is sooooo not right, but it's close... */
|
threaddata = (OPENGL32_ThreadData*)TlsGetValue ( OPENGL32_tls );
|
||||||
static GLFUNCLIST* list = NULL;
|
ASSERT(threaddata);
|
||||||
if ( !list )
|
return threaddata->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;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue