X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fscreen%2FRenderTexture.cpp;h=ad594117edfefbe1049ab4a41aea54e0da8b9933;hb=bbd61977f14c30ce93a2bcf5a3551708d36a29c8;hp=aaee155ab50548382fd696a15567abacb6124875;hpb=eb06a90109f9a69a7cf0d2af87714b8147acc024;p=simgear.git diff --git a/simgear/screen/RenderTexture.cpp b/simgear/screen/RenderTexture.cpp index aaee155a..ad594117 100644 --- a/simgear/screen/RenderTexture.cpp +++ b/simgear/screen/RenderTexture.cpp @@ -39,7 +39,6 @@ * Implementation of class RenderTexture. A multi-format render to * texture wrapper. */ -#pragma warning(disable:4786) /* * Changelog: @@ -76,12 +75,16 @@ using namespace std; //#define _DEBUG //#endif -#ifdef _DEBUG -#define dbg_printf printf +#if defined (_DEBUG) const char * get_attr_name( int val, int * pdef ); +#define dbg_printf printf #else +#if defined (__GNUC__) +#define dbg_printf(format,args...) ((void)0) +#else // defined (__GNUC__) #define dbg_printf -#endif +#endif // defined (__GNUC__) +#endif // defined (_DEBUG) // CHOP/NOT CHOP SOME CODE TO GET SOMETHING WORKING! #define ADD_QUERY_BUFFER @@ -212,7 +215,7 @@ RenderTexture::RenderTexture(const char *strMode) #endif dbg_printf("RenderTexture::RenderTexture(%s) END instantiation. pf=%d pb=%d\n", - strMode, _pixelFormatAttribs.size(), _pbufferAttribs.size() ); + strMode, (int)_pixelFormatAttribs.size(), (int)_pbufferAttribs.size() ); } @@ -333,11 +336,7 @@ void PrintExtensionError( const char* strMsg, ... ) char strBuffer[512]; va_list args; va_start(args, strMsg); -#if defined _WIN32 && !defined __CYGWIN__ - _vsnprintf( strBuffer, 512, strMsg, args ); -#else vsnprintf( strBuffer, 512, strMsg, args ); -#endif va_end(args); SG_LOG(SG_GL, SG_ALERT, strMsg); @@ -673,7 +672,7 @@ bool RenderTexture::Initialize(int width, int height, GLXFBConfig *fbConfigs; int nConfigs; #ifdef _DEBUG - dbg_printf("Using %d pixelFormatAttribs array\n", _pixelFormatAttribs.size()); + dbg_printf("Using %d pixelFormatAttribs array\n", (int)_pixelFormatAttribs.size()); size_t max = _pixelFormatAttribs.size() / 2; int dat = 0; size_t n; @@ -751,7 +750,7 @@ bool RenderTexture::Initialize(int width, int height, &pbufAttrib[0] ); //NULL); if (_hPBuffer) { - dbg_printf("RenderTexture::Initialize: %d: glXCreateGLXPbufferPtr() got buffer [%p]\n", (i + 1), _hPBuffer); + dbg_printf("RenderTexture::Initialize: %d: glXCreateGLXPbufferPtr() got buffer [%p]\n", (i + 1), (void*)_hPBuffer); _hGLContext = glXCreateContextWithConfigPtr(_pDisplay, fbConfigs[i], GLX_RGBA_TYPE, @@ -844,7 +843,7 @@ bool RenderTexture::Initialize(int width, int height, #endif // #ifdef ADD_GET_DRAWABLE dbg_printf( "RenderTexture::Initialize: doing glXMakeCurrent(_pDisplay(%p), _hPBuffer(%p), _hGLContext(%p))\n", - _pDisplay, _hPBuffer, _hGLContext ); + _pDisplay, (void*)_hPBuffer, _hGLContext ); if (False == glXMakeCurrent(_pDisplay, _hPBuffer, _hGLContext)) { dbg_printf( "glXMakeCurrent(_pDisplay, _hPBuffer, _hGLContext) FAILED. return false\n" ); @@ -1049,11 +1048,7 @@ bool RenderTexture::Reset(const char *strMode, ...) va_list args; char strBuffer[256]; va_start(args,strMode); -#if defined _WIN32 && !defined __CYGWIN__ - _vsnprintf( strBuffer, 256, strMode, args ); -#else vsnprintf( strBuffer, 256, strMode, args ); -#endif va_end(args); _ParseModeString(strBuffer, _pixelFormatAttribs, _pbufferAttribs); @@ -1435,7 +1430,7 @@ void RenderTexture::_ParseModeString(const char *modeString, vector &pfAttribs, vector &pbAttribs) { - dbg_printf("RenderTexture::_ParseModeString(%s). BGN vf=%d vp=%d\n", modeString, pfAttribs.size(), pbAttribs.size() ); + dbg_printf("RenderTexture::_ParseModeString(%s). BGN vf=%d vp=%d\n", modeString, (int)pfAttribs.size(), (int)pbAttribs.size() ); if (!modeString || strcmp(modeString, "") == 0) return; @@ -2206,7 +2201,7 @@ void RenderTexture::_ParseModeString(const char *modeString, #endif dbg_printf( "RenderTexture Error 2: Render to Texture not supported in Linux or MacOS\n"); } - dbg_printf("RenderTexture::_ParseModeString(%s). END vf=%d vp=%d\n", modeString, pfAttribs.size(), pbAttribs.size() ); + dbg_printf("RenderTexture::_ParseModeString(%s). END vf=%d vp=%d\n", modeString, (int)pfAttribs.size(), (int)pbAttribs.size() ); } @@ -2780,7 +2775,6 @@ bool RenderTexture::_ReleaseBoundBuffers() * @fn RenderTexture::_MakeCurrent() * @brief Makes the RenderTexture's context current */ -static GLXContext last_hGLContext = 0; bool RenderTexture::_MakeCurrent() { #ifdef _WIN32 @@ -2799,17 +2793,18 @@ bool RenderTexture::_MakeCurrent() return false; } #else +static GLXContext last_hGLContext = 0; if (false == glXMakeCurrent(_pDisplay, _hPBuffer, _hGLContext)) { dbg_printf( "_MakeCurrent: glXMakeCurrent FAILED! returning false\n"); return false; } -#endif if ( last_hGLContext != _hGLContext ) { last_hGLContext = _hGLContext; dbg_printf( "_MakeCurrent: glXMakeCurrent set to [%p] SUCCESS! returning true\n", _hGLContext ); } +#endif return true; } @@ -3036,7 +3031,7 @@ bool RenderTexture::Reset(int iWidth, int iHeight) return true; } -#ifdef _DEBUG +#if defined( _DEBUG ) && !defined( _WIN32 ) && !defined( __MACH__ ) /* just some DEBUG ONLY code, to show the 'attributes' */ typedef struct tagPXATTS {