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
This commit is contained in:
pouillot 2012-10-06 18:27:36 +00:00
parent 4381c22b1f
commit 0bf68d2681
3 changed files with 44 additions and 42 deletions

View file

@ -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--;

View file

@ -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,

View file

@ -15,13 +15,14 @@
<!DOCTYPE params SYSTEM "../tgf/params.dtd">
<params name="Screen" version="1.15">
<params name="Screen" version="1.16">
<section name="Validated Screen Properties">
<attnum name="window width" val="1024"/>
<attnum name="window height" val="600"/>
<attnum name="bpp" val="32"/>
<attstr name="full-screen" in="yes,no" val="no"/>
<attstr name="stereo-vision" in="yes,no" val="no"/>
<attstr name="alpha channel" in="yes,no" val="yes"/>
<attnum name="gamma" val="1"/>
<attstr name="video mode detect" in="auto,manual" val="auto"/>