From 0bf68d268144aa8d257e5e733cb32b686bb903eb Mon Sep 17 00:00:00 2001 From: pouillot Date: Sat, 6 Oct 2012 18:27:36 +0000 Subject: [PATCH] Fixes #719 Disabled (not removed) stereo-vision by default (makes anti-aliasing capabilities detection very often fail under Windows) git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@4981 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 890111b02c2ce4505fcec301b8c78f39da7f161f Former-commit-id: af0962f741a662ae4216179533966febf92f736e --- src/libs/tgfclient/glfeatures.cpp | 81 ++++++++++++++++--------------- src/libs/tgfclient/guiscreen.cpp | 2 +- src/libs/tgfclient/screen.xml | 3 +- 3 files changed, 44 insertions(+), 42 deletions(-) diff --git a/src/libs/tgfclient/glfeatures.cpp b/src/libs/tgfclient/glfeatures.cpp index d0c46c4a4..4a83d3641 100644 --- a/src/libs/tgfclient/glfeatures.cpp +++ b/src/libs/tgfclient/glfeatures.cpp @@ -218,55 +218,56 @@ bool GfglFeatures::detectBestSupport(int& nWidth, int& nHeight, int& nDepth, while (!pWinSurface && nStereoVision >= 0) { + GfLogTrace("Trying with%s stereo vision\n", nStereoVision ? "" : "out"); if (nStereoVision) SDL_GL_SetAttribute(SDL_GL_STEREO, GL_TRUE); else SDL_GL_SetAttribute(SDL_GL_STEREO, GL_FALSE); - // Anti-aliasing : detect the max supported number of samples - // (assumed to be <= 32). - int nMaxMultiSamples = 32; // Hard coded max value for the moment. - while (!pWinSurface && nMaxMultiSamples > 1) - { - // Set the anti-aliasing attributes and setup the video mode. - GfLogTrace("Trying %dx anti-aliasing\n", nMaxMultiSamples); - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, nMaxMultiSamples); - pWinSurface = SDL_SetVideoMode(nWidth, nHeight, nCurrDepth, bfVideoMode); - - // Now check if we have a video mode, and if it actually features - // what we specified. - int nActualSampleBuffers = 0; - int nActualMultiSamples = 0; - if (pWinSurface) { - SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &nActualSampleBuffers); - SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &nActualMultiSamples); + // Anti-aliasing : detect the max supported number of samples + // (assumed to be <= 32). + int nMaxMultiSamples = 32; // Hard coded max value for the moment. + while (!pWinSurface && nMaxMultiSamples > 1) + { + // Set the anti-aliasing attributes and setup the video mode. + GfLogTrace("Trying %dx anti-aliasing\n", nMaxMultiSamples); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, nMaxMultiSamples); + pWinSurface = SDL_SetVideoMode(nWidth, nHeight, nCurrDepth, bfVideoMode); + + // Now check if we have a video mode, and if it actually features + // what we specified. + int nActualSampleBuffers = 0; + int nActualMultiSamples = 0; + if (pWinSurface) { + SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &nActualSampleBuffers); + SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &nActualMultiSamples); + } + //GfLogDebug("nMaxMultiSamples=%d : nActualSampleBuffers=%d, nActualMultiSamples=%d\n", + // nMaxMultiSamples, nActualSampleBuffers, nActualMultiSamples); + + // If not, try a lower number of samples. + if (nActualSampleBuffers == 0 || nActualMultiSamples != nMaxMultiSamples) + pWinSurface = 0; + if (!pWinSurface) + { + GfLogTrace("%d+%d bit %dx anti-aliased double-buffer not supported\n", + 3*nCurrDepth/4, nCurrDepth/4, nMaxMultiSamples); + nMaxMultiSamples /= 2; + } } -// GfLogDebug("nMaxMultiSamples=%d : nActualSampleBuffers=%d, nActualMultiSamples=%d\n", -// nMaxMultiSamples, nActualSampleBuffers, nActualMultiSamples); - - // If not, try a lower number of samples. - if (nActualSampleBuffers == 0 || nActualMultiSamples != nMaxMultiSamples) - pWinSurface = 0; + + // Failed : try without anti-aliasing. if (!pWinSurface) { - GfLogTrace("%d+%d bit %dx anti-aliased double-buffer not supported\n", - 3*nCurrDepth/4, nCurrDepth/4, nMaxMultiSamples); - nMaxMultiSamples /= 2; + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0); + pWinSurface = SDL_SetVideoMode(nWidth, nHeight, nCurrDepth, bfVideoMode); + if (!pWinSurface) + GfLogTrace("%d+%d bit double-buffer not supported\n", + 3*nCurrDepth/4, nCurrDepth/4); } - } - - // Failed : try without anti-aliasing. - if (!pWinSurface) - { - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0); - SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0); - pWinSurface = SDL_SetVideoMode(nWidth, nHeight, nCurrDepth, bfVideoMode); - if (!pWinSurface) - GfLogTrace("%d+%d bit double-buffer not supported\n", - 3*nCurrDepth/4, nCurrDepth/4); - } - + // Failed : try without StereoVision if (!pWinSurface) nStereoVision--; diff --git a/src/libs/tgfclient/guiscreen.cpp b/src/libs/tgfclient/guiscreen.cpp index bd2435b8d..162efe411 100644 --- a/src/libs/tgfclient/guiscreen.cpp +++ b/src/libs/tgfclient/guiscreen.cpp @@ -441,7 +441,7 @@ bool GfScrInit(int nWinWidth, int nWinHeight, int nFullScreen) == GFSCR_VAL_YES; bool bStereo = std::string(GfParmGetStr(hparmScreen, pszScrPropSec, GFSCR_ATT_STEREOVISION, - GFSCR_VAL_YES)) + GFSCR_VAL_NO)) == GFSCR_VAL_YES; bool bTryBestVInitMode = std::string(GfParmGetStr(hparmScreen, pszScrPropSec, GFSCR_ATT_VINIT, diff --git a/src/libs/tgfclient/screen.xml b/src/libs/tgfclient/screen.xml index 186576320..285ec86bb 100644 --- a/src/libs/tgfclient/screen.xml +++ b/src/libs/tgfclient/screen.xml @@ -15,13 +15,14 @@ - +
+