Author: khornicek Date: Fri Nov 6 15:52:27 2009 New Revision: 43987
URL: http://svn.reactos.org/svn/reactos?rev=43987&view=rev Log: - opengl support for arwinss
Added: branches/arwinss/reactos/dll/win32/winent.drv/ogldrv.c (with props) Modified: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c branches/arwinss/reactos/dll/win32/winent.drv/winent.rbuild
Modified: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent... ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] Fri Nov 6 15:52:27 2009 @@ -77,13 +77,6 @@
return RosGdiBitBlt(physDevDst->hKernelDC, xDst, yDst, width, height, physDevSrc->hKernelDC, xSrc, ySrc, rop); -} - -int CDECL RosDrv_ChoosePixelFormat(NTDRV_PDEVICE *physDev, - const PIXELFORMATDESCRIPTOR *ppfd) -{ - UNIMPLEMENTED; - return 0; }
BOOL CDECL RosDrv_Chord( NTDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom, @@ -205,15 +198,6 @@
/* Return result */ return res; -} - -int CDECL RosDrv_DescribePixelFormat(NTDRV_PDEVICE *physDev, - int iPixelFormat, - UINT nBytes, - PIXELFORMATDESCRIPTOR *ppfd) -{ - UNIMPLEMENTED; - return 0; }
BOOL CDECL RosDrv_Ellipse( NTDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom ) @@ -352,12 +336,6 @@ return RosGdiGetPixel(physDev->hKernelDC, ptPixel.x, ptPixel.y); }
-int CDECL RosDrv_GetPixelFormat(NTDRV_PDEVICE *physDev) -{ - UNIMPLEMENTED; - return 0; -} - UINT CDECL RosDrv_GetSystemPaletteEntries( NTDRV_PDEVICE *physDev, UINT start, UINT count, LPPALETTEENTRY entries ) { @@ -726,14 +704,6 @@ LPtoDP(physDev->hUserDC, &ptPixel, 1);
return RosGdiSetPixel(physDev->hKernelDC, ptPixel.x, ptPixel.y, color); -} - -BOOL CDECL RosDrv_SetPixelFormat(NTDRV_PDEVICE *physDev, - int iPixelFormat, - const PIXELFORMATDESCRIPTOR *ppfd) -{ - UNIMPLEMENTED; - return FALSE; }
COLORREF CDECL RosDrv_SetTextColor( NTDRV_PDEVICE *physDev, COLORREF color ) @@ -782,12 +752,6 @@ physDevSrc->hKernelDC, xSrc, ySrc, widthSrc, heightSrc, rop); }
-BOOL CDECL RosDrv_SwapBuffers(NTDRV_PDEVICE *physDev) -{ - UNIMPLEMENTED; - return FALSE; -} - BOOL CDECL RosDrv_UnrealizePalette( HPALETTE hpal ) { UNIMPLEMENTED;
Added: branches/arwinss/reactos/dll/win32/winent.drv/ogldrv.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent... ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/ogldrv.c (added) +++ branches/arwinss/reactos/dll/win32/winent.drv/ogldrv.c [iso-8859-1] Fri Nov 6 15:52:27 2009 @@ -1,0 +1,110 @@ +/* + * PROJECT: ReactOS + * LICENSE: LGPL + * FILE: dll/win32/winent.drv/ogldrv.c + * PURPOSE: OpenGL driver for ReactOS/Windows + * PROGRAMMERS: Kamil Hornicek + */ + +/* INCLUDES ***************************************************************/ + +#include "windows.h" +#include "wingdi.h" +#include "ntrosgdi.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(rosogldrv); + +typedef INT (WINAPI *CHOOSEPIXELFMT) (HDC, CONST PIXELFORMATDESCRIPTOR *); +typedef INT (WINAPI *DESCRIBEPIXELFMT) (HDC, INT, UINT, PIXELFORMATDESCRIPTOR *); +typedef INT (WINAPI *GETPIXELFMT) (HDC); +typedef BOOL (WINAPI *SETPIXELFMT) (HDC, INT, CONST PIXELFORMATDESCRIPTOR *); +typedef BOOL (WINAPI *SWAPBUFFERS) (HDC); + +static CHOOSEPIXELFMT glChoosePixelFormat = NULL; +static DESCRIBEPIXELFMT glDescribePixelFormat = NULL; +static GETPIXELFMT glGetPixelFormat = NULL; +static SETPIXELFMT glSetPixelFormat = NULL; +static SWAPBUFFERS glSwapBuffers = NULL; + +/* FUNCTIONS **************************************************************/ + +BOOL InitOGL(VOID) +{ + HMODULE hOGL; + + hOGL = LoadLibraryW(L"OPENGL32.DLL"); + + if (!hOGL) + return FALSE; + + glChoosePixelFormat = GetProcAddress(hOGL, "wglChoosePixelFormat"); + glDescribePixelFormat = GetProcAddress(hOGL, "wglDescribePixelFormat"); + glGetPixelFormat = GetProcAddress(hOGL, "wglGetPixelFormat"); + glSetPixelFormat = GetProcAddress(hOGL, "wglSetPixelFormat"); + glSwapBuffers = GetProcAddress(hOGL, "wglSwapBuffers"); + + if (!glChoosePixelFormat || !glDescribePixelFormat || !glGetPixelFormat || + !glSetPixelFormat || !glSwapBuffers) + { + FreeLibrary(hOGL); + ERR("Failed to load required wgl* functions from opengl32\n"); + return FALSE; + } + + return TRUE; +} + +INT CDECL RosDrv_ChoosePixelFormat(NTDRV_PDEVICE *physDev, + CONST PIXELFORMATDESCRIPTOR *ppfd) +{ + if (!glChoosePixelFormat) + if (!InitOGL()) + return 0; + + return glChoosePixelFormat(physDev->hUserDC, ppfd); +} + +INT CDECL RosDrv_GetPixelFormat(NTDRV_PDEVICE *physDev) +{ + if (!glGetPixelFormat) + if (!InitOGL()) + return 0; + + return glGetPixelFormat(physDev->hUserDC); +} + +INT CDECL RosDrv_DescribePixelFormat(NTDRV_PDEVICE *physDev, + INT iPixelFormat, + UINT nBytes, + PIXELFORMATDESCRIPTOR *ppfd) +{ + if (!glDescribePixelFormat) + if (!InitOGL()) + return 0; + + return glDescribePixelFormat(physDev->hUserDC, iPixelFormat, nBytes, ppfd); +} + +BOOL CDECL RosDrv_SetPixelFormat(NTDRV_PDEVICE *physDev, + INT iPixelFormat, + CONST PIXELFORMATDESCRIPTOR *ppfd) +{ + if (!glSetPixelFormat) + if (!InitOGL()) + return 0; + + return glSetPixelFormat(physDev->hUserDC, iPixelFormat, ppfd); +} + + +BOOL CDECL RosDrv_SwapBuffers(NTDRV_PDEVICE *physDev) +{ + if (!glSwapBuffers) + if (!InitOGL()) + return 0; + + return glSwapBuffers(physDev->hUserDC); +} + +/* EOF */
Propchange: branches/arwinss/reactos/dll/win32/winent.drv/ogldrv.c ------------------------------------------------------------------------------ svn:eol-style = native
Modified: branches/arwinss/reactos/dll/win32/winent.drv/winent.rbuild URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent... ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/winent.rbuild [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winent.drv/winent.rbuild [iso-8859-1] Fri Nov 6 15:52:27 2009 @@ -12,6 +12,7 @@ <file>userdrv.c</file> <file>mouse.c</file> <file>wnd.c</file> + <file>ogldrv.c</file>
<file>winent.rc</file>