From 4e737a99fa730e444809319c6b47c0c638dff210 Mon Sep 17 00:00:00 2001 From: Dreamy Cecil <21009796+DreamyCecil@users.noreply.github.com> Date: Sun, 11 Feb 2024 22:39:42 +0300 Subject: [PATCH] Implement OpenGL rendering using SDL if it's preferred. --- Sources/Engine/Graphics/GfxLibrary.cpp | 66 +++++++---- Sources/Engine/Graphics/GfxLibrary.h | 8 +- Sources/Engine/Graphics/Gfx_OpenGL.cpp | 150 ++++++++++++++++++++++--- Sources/Engine/Graphics/OpenGL.h | 6 +- Sources/Engine/Graphics/ViewPort.cpp | 14 +++ Sources/Engine/Graphics/gl_functions.h | 7 +- 6 files changed, 207 insertions(+), 44 deletions(-) diff --git a/Sources/Engine/Graphics/GfxLibrary.cpp b/Sources/Engine/Graphics/GfxLibrary.cpp index aa74f6f89..9496c3d55 100644 --- a/Sources/Engine/Graphics/GfxLibrary.cpp +++ b/Sources/Engine/Graphics/GfxLibrary.cpp @@ -1050,7 +1050,7 @@ CGfxLibrary::CGfxLibrary(void) // no driver loaded gl_pInterface = NULL; // [Cecil] gl_hiDriver = NONE; - go_hglRC = NONE; + go_hglRC = NULL; gl_ctDriverChanges = 0; // DX8 not loaded either @@ -1643,12 +1643,18 @@ void CGfxLibrary::UnlockDrawPort( CDrawPort *pdpToUnlock) /* Create a new window canvas. */ void CGfxLibrary::CreateWindowCanvas(OS::Window hWnd, CViewPort **ppvpNew, CDrawPort **ppdpNew) { - RECT rectWindow; // rectangle for the client area of the window + // Get dimensions from the window + int pixWidth, pixHeight; - // get the dimensions from the window - GetClientRect( (HWND)hWnd, &rectWindow); - PIX pixWidth = rectWindow.right - rectWindow.left; - PIX pixHeight = rectWindow.bottom - rectWindow.top; +#if !SE1_PREFER_SDL + RECT rectWindow; + GetClientRect(hWnd, &rectWindow); + pixWidth = int(rectWindow.right - rectWindow.left); + pixHeight = int(rectWindow.bottom - rectWindow.top); + +#else + SDL_GL_GetDrawableSize(hWnd, &pixWidth, &pixHeight); +#endif *ppvpNew = NULL; *ppdpNew = NULL; @@ -1671,6 +1677,8 @@ void CGfxLibrary::DestroyWindowCanvas(CViewPort *pvpOld) { ///////////////////////////////////////////////////////////////////// // Work canvas functions +#if !SE1_PREFER_SDL + #define WorkCanvasCLASS "WorkCanvas Window" static BOOL _bClassRegistered = FALSE; @@ -1726,7 +1734,7 @@ void CGfxLibrary::DestroyWorkCanvas(CDrawPort *pdpOld) ::DestroyWindow(hwnd); } - +#endif // !SE1_PREFER_SDL // optimize memory used by cached shadow maps @@ -1872,12 +1880,22 @@ void CGfxLibrary::SwapBuffers(CViewPort *pvp) if( gl_ulFlags & GLF_VSYNC) { if( gl_iSwapInterval != gap_iSwapInterval) { gl_iSwapInterval = gap_iSwapInterval; - pwglSwapIntervalEXT( gl_iSwapInterval); + + #if !SE1_PREFER_SDL + pwglSwapIntervalEXT( gl_iSwapInterval); + #else + SDL_GL_SetSwapInterval(gl_iSwapInterval); + #endif } } + // swap buffers - CTempDC tdc(pvp->vp_hWnd); - pwglSwapBuffers(tdc.hdc); + #if !SE1_PREFER_SDL + CTempDC tdc(pvp->vp_hWnd); + pwglSwapBuffers(tdc.hdc); + #else + SDL_GL_SwapWindow(pvp->vp_hWnd); + #endif // force finishing of all rendering operations (if required) if( ogl_iFinish==3) gfxFinish(); @@ -1986,6 +2004,8 @@ void CGfxLibrary::SwapBuffers(CViewPort *pvp) if( gfx_bClearScreen) pvp->vp_Raster.ra_MainDrawPort.Fill( C_BLACK|CT_OPAQUE); //pvp->vp_Raster.ra_MainDrawPort.FillZBuffer(ZBUF_BACK); + // [Cecil] SDL: Don't bother with gamma adjustment +#if !SE1_PREFER_SDL // adjust gamma table if supported ... if( gl_ulFlags & GLF_ADJUSTABLEGAMMA) { // ... and required @@ -1995,24 +2015,24 @@ void CGfxLibrary::SwapBuffers(CViewPort *pvp) CTempDC tdc(pvp->vp_hWnd); SetDeviceGammaRamp( tdc.hdc, &_auwGammaTable[0]); } -#ifdef SE1_D3D + #ifdef SE1_D3D else if (GetCurrentAPI() == GAT_D3D) { gl_pd3dDevice->SetGammaRamp( D3DSGR_NO_CALIBRATION, (D3DGAMMARAMP*)&_auwGammaTable[0]); } -#endif // SE1_D3D + #endif // SE1_D3D } + return; } - // if not supported - else { - // just reset settings to default - gfx_fBrightness = 0; - gfx_fContrast = 1; - gfx_fGamma = 1; - gfx_fBiasR = 1; - gfx_fBiasG = 1; - gfx_fBiasB = 1; - gfx_iLevels = 256; - } +#endif // !SE1_PREFER_SDL + + // just reset settings to default + gfx_fBrightness = 0; + gfx_fContrast = 1; + gfx_fGamma = 1; + gfx_fBiasR = 1; + gfx_fBiasG = 1; + gfx_fBiasB = 1; + gfx_iLevels = 256; } diff --git a/Sources/Engine/Graphics/GfxLibrary.h b/Sources/Engine/Graphics/GfxLibrary.h index 6f2eb66f6..334005928 100644 --- a/Sources/Engine/Graphics/GfxLibrary.h +++ b/Sources/Engine/Graphics/GfxLibrary.h @@ -150,7 +150,11 @@ class ENGINE_API CGfxLibrary DWORD gl_dwVertexShader; // OpenGL info +#if !SE1_PREFER_SDL HGLRC go_hglRC; // rendering context +#else + SDL_GLContext go_hglRC; // [Cecil] SDL +#endif CTString go_strExtensions; // reported extensions CTString go_strWinExtensions; CTString go_strSupportedExtensions; // supported extensions @@ -195,8 +199,8 @@ class ENGINE_API CGfxLibrary void EndDriver_OGL(void); void TestExtension_OGL( ULONG ulFlag, const char *strName); // if exist, add OpenGL extension to flag and list void AddExtension_OGL( ULONG ulFlag, const char *strName); // unconditionally add OpenGL extension to flag and list - BOOL CreateContext_OGL( HDC hdc); - BOOL SetupPixelFormat_OGL( HDC hdc, BOOL bReport=FALSE); + BOOL CreateContext_OGL(OS::DvcContext hdc); + BOOL SetupPixelFormat_OGL(OS::DvcContext hdc, BOOL bReport=FALSE); void InitContext_OGL(void); BOOL SetCurrentViewport_OGL( CViewPort *pvp); void UploadPattern_OGL( ULONG ulPatternEven); diff --git a/Sources/Engine/Graphics/Gfx_OpenGL.cpp b/Sources/Engine/Graphics/Gfx_OpenGL.cpp index 1dc4377d8..2ca25b23d 100644 --- a/Sources/Engine/Graphics/Gfx_OpenGL.cpp +++ b/Sources/Engine/Graphics/Gfx_OpenGL.cpp @@ -95,10 +95,13 @@ GLint (__stdcall *pwglGetSwapIntervalEXT)(void) = NULL; void (__stdcall *pglActiveTextureARB)(GLenum texunit) = NULL; void (__stdcall *pglClientActiveTextureARB)(GLenum texunit) = NULL; +#if !SE1_PREFER_SDL // t-buffer support char *(__stdcall *pwglGetExtensionsStringARB)(HDC hdc); BOOL (__stdcall *pwglChoosePixelFormatARB)(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); BOOL (__stdcall *pwglGetPixelFormatAttribivARB)(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues); +#endif + void (__stdcall *pglTBufferMask3DFX)(GLuint mask); // NV occlusion query @@ -175,6 +178,12 @@ static void OGL_SetFunctionPointers_t(HINSTANCE hiOGL) p##name = (output (__stdcall *)inputs)&name; \ if( required && p##name == NULL) FailFunction_t(strName); +#elif SE1_PREFER_SDL + #define DLLFUNCTION(dll, output, name, inputs, params, required) \ + strName = #name; \ + p##name = (output (__stdcall*)inputs)SDL_GL_GetProcAddress(strName); \ + if( required && p##name == NULL) FailFunction_t(strName); + #else #define DLLFUNCTION(dll, output, name, inputs, params, required) \ strName = #name; \ @@ -195,8 +204,7 @@ static void OGL_ClearFunctionPointers(void) #undef DLLFUNCTION } - - +#if !SE1_PREFER_SDL #define BACKOFF pwglMakeCurrent( NULL, NULL); \ pwglDeleteContext( hglrc); \ @@ -335,14 +343,59 @@ static INDEX ChoosePixelFormatTB( HDC hdc, const PIXELFORMATDESCRIPTOR *ppfd, return iPixelFormat; } +#else + +// [Cecil] SDL: Check if there's been some sort of an error +static BOOL CheckErrorSDL(BOOL bSuccess, const char *strDescription) { + // Successful result + if (bSuccess) return FALSE; + + // No SDL error + const char *strError = SDL_GetError(); + if (strError == NULL) return FALSE; + + // Report error + WarningMessage("%s: %s", strDescription, strError); + return TRUE; +}; + +#endif // !SE1_PREFER_SDL // prepares pixel format for OpenGL context -BOOL CGfxLibrary::SetupPixelFormat_OGL( HDC hdc, BOOL bReport/*=FALSE*/) +BOOL CGfxLibrary::SetupPixelFormat_OGL(OS::DvcContext hdc, BOOL bReport/*=FALSE*/) { + const DisplayDepth dd = gl_dmCurrentDisplayMode.dm_ddDepth; + + // clamp depth/stencil values + extern INDEX gap_iDepthBits; + extern INDEX gap_iStencilBits; + + // [Cecil] SDL: 16 should be the lowest +#if !SE1_PREFER_SDL + if (gap_iDepthBits < 12) { + gap_iDepthBits = 0; + } else +#endif + if (gap_iDepthBits < 22) { + gap_iDepthBits = 16; + } else if (gap_iDepthBits < 28) { + gap_iDepthBits = 24; + } else { + gap_iDepthBits = 32; + } + + if (gap_iStencilBits < 3) { + gap_iStencilBits = 0; + } else if (gap_iStencilBits < 7) { + gap_iStencilBits = 4; + } else { + gap_iStencilBits = 8; + } + +#if !SE1_PREFER_SDL int iPixelFormat = 0; const PIX pixResWidth = gl_dmCurrentDisplayMode.dm_pixSizeI; const PIX pixResHeight = gl_dmCurrentDisplayMode.dm_pixSizeJ; - const DisplayDepth dd = gl_dmCurrentDisplayMode.dm_ddDepth; PIXELFORMATDESCRIPTOR pfd; memset( &pfd, 0, sizeof(pfd)); @@ -351,17 +404,6 @@ BOOL CGfxLibrary::SetupPixelFormat_OGL( HDC hdc, BOOL bReport/*=FALSE*/) pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER; pfd.iPixelType = PFD_TYPE_RGBA; - // clamp depth/stencil values - extern INDEX gap_iDepthBits; - extern INDEX gap_iStencilBits; - if( gap_iDepthBits <12) gap_iDepthBits = 0; - else if( gap_iDepthBits <22) gap_iDepthBits = 16; - else if( gap_iDepthBits <28) gap_iDepthBits = 24; - else gap_iDepthBits = 32; - if( gap_iStencilBits<3) gap_iStencilBits = 0; - else if( gap_iStencilBits<7) gap_iStencilBits = 4; - else gap_iStencilBits = 8; - // set color/depth buffer values pfd.cColorBits = (dd!=DD_16BIT) ? 32 : 16; pfd.cDepthBits = gap_iDepthBits; @@ -451,6 +493,20 @@ BOOL CGfxLibrary::SetupPixelFormat_OGL( HDC hdc, BOOL bReport/*=FALSE*/) // all done CPrintF( "\n"); + +#else + // [Cecil] SDL: Set OpenGL attributes + const BOOL b32bit = (dd != DD_16BIT); + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, b32bit ? 8 : 5); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, b32bit ? 8 : 6); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, b32bit ? 8 : 5); + + SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0); + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, gap_iDepthBits); + SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, gap_iStencilBits); +#endif // !SE1_PREFER_SDL + return TRUE; } @@ -490,9 +546,11 @@ void CGfxLibrary::TestExtension_OGL( ULONG ulFlag, const char *strName) // creates OpenGL drawing context -BOOL CGfxLibrary::CreateContext_OGL(HDC hdc) +BOOL CGfxLibrary::CreateContext_OGL(OS::DvcContext hdc) { if( !SetupPixelFormat_OGL( hdc, TRUE)) return FALSE; + +#if !SE1_PREFER_SDL go_hglRC = pwglCreateContext(hdc); if( go_hglRC==NULL) { WIN_CHECKERROR(0, "CreateContext"); @@ -504,6 +562,28 @@ BOOL CGfxLibrary::CreateContext_OGL(HDC hdc) //WIN_CHECKERROR(0, "MakeCurrent after CreateContext"); return FALSE; } + +#else + // [Cecil] SDL: Create and set new OpenGL context + go_hglRC = SDL_GL_CreateContext(hdc); + if (CheckErrorSDL(go_hglRC != NULL, "CreateContext")) return FALSE; + + BOOL bMakeCurrent = (SDL_GL_MakeCurrent(hdc, go_hglRC) != -1); + if (CheckErrorSDL(bMakeCurrent, "MakeCurrent after CreateContext")) return FALSE; + + // Try to keep depth bits + int iDepth = 0; + + if (SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &iDepth) != -1) { + gl_iCurrentDepth = iDepth; + } else { + gl_iCurrentDepth = 16; + } + + // Prepare functions + OGL_SetFunctionPointers_t(gl_hiDriver); +#endif + return TRUE; } @@ -586,12 +666,15 @@ void CGfxLibrary::InitContext_OGL(void) // check for WGL extensions, too go_strWinExtensions = ""; + +#if !SE1_PREFER_SDL pwglGetExtensionsStringARB = (char* (__stdcall*)(HDC))pwglGetProcAddress("wglGetExtensionsStringARB"); if( pwglGetExtensionsStringARB != NULL) { AddExtension_OGL( NONE, "WGL_ARB_extensions_string"); // register CTempDC tdc(gl_pvpActive->vp_hWnd); go_strWinExtensions = (char*)pwglGetExtensionsStringARB(tdc.hdc); } +#endif // multitexture is supported only thru GL_EXT_texture_env_combine extension gl_ctTextureUnits = 1; @@ -692,6 +775,7 @@ void CGfxLibrary::InitContext_OGL(void) } #endif +#if !SE1_PREFER_SDL // if T-buffer is supported if( _TBCapability) { // add extension and disable t-buffer usage by default @@ -699,6 +783,7 @@ void CGfxLibrary::InitContext_OGL(void) pglDisable( GL_MULTISAMPLE_3DFX); OGL_CHECKERROR; } +#endif // test for clamp to edge TestExtension_OGL( GLF_EXT_EDGECLAMP, "GL_EXT_texture_edge_clamp"); @@ -806,6 +891,8 @@ void CGfxLibrary::InitContext_OGL(void) BOOL CGfxLibrary::InitDriver_OGL( BOOL b3Dfx/*=FALSE*/) { ASSERT( gl_hiDriver==NONE); + +#if !SE1_PREFER_SDL UINT iOldErrorMode = SetErrorMode( SEM_NOOPENFILEERRORBOX|SEM_FAILCRITICALERRORS); #ifdef SE1_3DFX @@ -872,6 +959,13 @@ BOOL CGfxLibrary::InitDriver_OGL( BOOL b3Dfx/*=FALSE*/) // functions from GDI, which in turn call either OPENGL32.DLL, _or_ the client driver, // as appropriate. } + +#else + // [Cecil] SDL: Try loading OpenGL + BOOL bLoaded = (SDL_GL_LoadLibrary(NULL) != -1); + if (CheckErrorSDL(bLoaded, "Error starting OpenGL")) return FALSE; +#endif + // done return TRUE; } @@ -896,6 +990,7 @@ void CGfxLibrary::EndDriver_OGL(void) _ptdFlat->Unbind(); // shut the driver down +#if !SE1_PREFER_SDL if( go_hglRC!=NULL) { if( pwglMakeCurrent!=NULL) { BOOL bRes = pwglMakeCurrent(NULL, NULL); @@ -906,6 +1001,17 @@ void CGfxLibrary::EndDriver_OGL(void) WIN_CHECKERROR( bRes, "DeleteContext"); go_hglRC = NULL; } + +#else + // [Cecil] SDL: Reset and delete OpenGL context + SDL_GL_MakeCurrent(NULL, NULL); + + if (go_hglRC != NULL) { + SDL_GL_DeleteContext(go_hglRC); + go_hglRC = NULL; + } +#endif + OGL_ClearFunctionPointers(); } @@ -926,6 +1032,12 @@ BOOL CGfxLibrary::SetCurrentViewport_OGL(CViewPort *pvp) if( !CreateContext_OGL(tdc.hdc)) return FALSE; gl_pvpActive = pvp; // remember as current viewport (must do that BEFORE InitContext) InitContext_OGL(); + + // [Cecil] SDL: Assume that hardware acceleration is always available + #if SE1_PREFER_SDL + gl_ulFlags |= GLF_HASACCELERATION; // [Cecil] FIXME: Determine using SDL + #endif + pvp->vp_ctDisplayChanges = gl_ctDriverChanges; return TRUE; } @@ -936,12 +1048,17 @@ BOOL CGfxLibrary::SetCurrentViewport_OGL(CViewPort *pvp) // reopen window pvp->CloseCanvas(); pvp->OpenCanvas(); + + #if !SE1_PREFER_SDL // set it CTempDC tdc(pvp->vp_hWnd); if( !SetupPixelFormat_OGL(tdc.hdc)) return FALSE; + #endif + pvp->vp_ctDisplayChanges = gl_ctDriverChanges; } +#if !SE1_PREFER_SDL if( gl_pvpActive!=NULL) { // fail, if only one window is allowed (3dfx driver), already initialized and trying to set non-primary viewport const BOOL bOneWindow = (gl_gaAPI[GAT_OGL].ga_adaAdapter[gl_iCurrentAdapter].da_ulFlags & DAF_ONEWINDOW); @@ -955,6 +1072,7 @@ BOOL CGfxLibrary::SetCurrentViewport_OGL(CViewPort *pvp) CTempDC tdc(pvp->vp_hWnd); // fail, if cannot set context to this window if( !pwglMakeCurrent( tdc.hdc, go_hglRC)) return FALSE; +#endif // remember as current window gl_pvpActive = pvp; diff --git a/Sources/Engine/Graphics/OpenGL.h b/Sources/Engine/Graphics/OpenGL.h index e4c7d1920..26a78b462 100644 --- a/Sources/Engine/Graphics/OpenGL.h +++ b/Sources/Engine/Graphics/OpenGL.h @@ -51,19 +51,21 @@ extern GLint (__stdcall *pwglGetSwapIntervalEXT)(void); extern void (__stdcall *pglActiveTextureARB)(GLenum texunit); extern void (__stdcall *pglClientActiveTextureARB)(GLenum texunit); -#if SE1_WIN /* !!! FIXME: Move to abstraction layer. --rcg. */ +#if !SE1_PREFER_SDL /* !!! FIXME: Move to abstraction layer. --rcg. */ // t-buffer support extern char *(__stdcall *pwglGetExtensionsStringARB)(HDC hdc); extern BOOL (__stdcall *pwglChoosePixelFormatARB)(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); extern BOOL (__stdcall *pwglGetPixelFormatAttribivARB)(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues); #endif + extern void (__stdcall *pglTBufferMask3DFX)(GLuint mask); // GL_NV_vertex_array_range & GL_NV_fence -#if SE1_WIN /* !!! FIXME: Move to abstraction layer. --rcg. */ +#if !SE1_PREFER_SDL /* !!! FIXME: Move to abstraction layer. --rcg. */ extern void *(__stdcall *pwglAllocateMemoryNV)(GLint size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); extern void (__stdcall *pwglFreeMemoryNV)(void *pointer); #endif + extern void (__stdcall *pglVertexArrayRangeNV)(GLsizei length, void *pointer); extern void (__stdcall *pglFlushVertexArrayRangeNV)(void); diff --git a/Sources/Engine/Graphics/ViewPort.cpp b/Sources/Engine/Graphics/ViewPort.cpp index 858dad5a6..01d900ec7 100644 --- a/Sources/Engine/Graphics/ViewPort.cpp +++ b/Sources/Engine/Graphics/ViewPort.cpp @@ -126,6 +126,7 @@ LRESULT CALLBACK CViewPortCLASS_WindowProc( // open overlaid window for rendering context void CViewPort::OpenCanvas(void) { +#if !SE1_PREFER_SDL // do nothing if not feasable if( vp_hWnd!=NULL || vp_hWndParent==NULL) return; @@ -193,6 +194,11 @@ void CViewPort::OpenCanvas(void) // set as rendering target if (_pGfx->GetCurrentAPI() == GAT_D3D && vp_pSwapChain != NULL) SetAsRenderTarget_D3D(this); #endif // SE1_D3D + +#else + // [Cecil] SDL: No need to open a new window, reuse the parent + vp_hWnd = vp_hWndParent; +#endif } @@ -206,11 +212,16 @@ void CViewPort::CloseCanvas( BOOL bRelease/*=FALSE*/) if (vp_pSurfDepth != NULL) D3DRELEASE(vp_pSurfDepth, TRUE); } #endif // SE1_D3D + + // [Cecil] SDL: No new window has been created +#if !SE1_PREFER_SDL // destroy window if( vp_hWnd!=NULL && IsWindow(vp_hWnd)) { BOOL bRes = DestroyWindow(vp_hWnd); ASSERT(bRes); } +#endif + // mark vp_hWnd = NULL; #ifdef SE1_D3D @@ -223,6 +234,8 @@ void CViewPort::CloseCanvas( BOOL bRelease/*=FALSE*/) // Change size of this viewport, it's raster and all it's drawports void CViewPort::Resize(void) { + // [Cecil] SDL: The parent window is already resized +#if !SE1_PREFER_SDL PIX pixNewWidth, pixNewHeight; RECT rectWindow; @@ -250,6 +263,7 @@ void CViewPort::Resize(void) SetAsRenderTarget_D3D(this); } #endif // SE1_D3D +#endif // !SE1_PREFER_SDL } diff --git a/Sources/Engine/Graphics/gl_functions.h b/Sources/Engine/Graphics/gl_functions.h index 8b040d022..446576f2d 100644 --- a/Sources/Engine/Graphics/gl_functions.h +++ b/Sources/Engine/Graphics/gl_functions.h @@ -994,6 +994,7 @@ DLLFUNCTION( OGL, void , glCopyTexSubImage3D,( GLenum target, GLint level, /* !!! FIXME: This needs to move to a GL context abstraction layer. */ #if SE1_WIN + // gdi functions DLLFUNCTION( OGL, BOOL , wglCopyContext,(HGLRC, HGLRC, UINT),0,0); DLLFUNCTION( OGL, HGLRC, wglCreateContext,(HDC),4,1); @@ -1007,9 +1008,13 @@ DLLFUNCTION( OGL, BOOL , wglShareLists,(HGLRC, HGLRC),0,0); DLLFUNCTION( OGL, BOOL , wglUseFontBitmapsA,(HDC, DWORD, DWORD, DWORD),0,0); DLLFUNCTION( OGL, BOOL , wglUseFontBitmapsW,(HDC, DWORD, DWORD, DWORD),0,0); +#endif // SE1_WIN + +#if !SE1_PREFER_SDL + DLLFUNCTION( OGL, BOOL, wglSwapBuffers, (HDC), 4,1); DLLFUNCTION( OGL, BOOL, wglSetPixelFormat, (HDC, int, CONST PIXELFORMATDESCRIPTOR*),12,1); DLLFUNCTION( OGL, int, wglChoosePixelFormat, (HDC, CONST PIXELFORMATDESCRIPTOR*),8,1); DLLFUNCTION( OGL, int, wglDescribePixelFormat, (HDC, int, UINT, LPPIXELFORMATDESCRIPTOR),16,1); -#endif +#endif // !SE1_PREFER_SDL