Implemented proper video mode depth detection on Linux
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1045 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
b2c751d0b2
commit
3b1abf635e
3 changed files with 22 additions and 10 deletions
|
@ -63,15 +63,24 @@ void VideoModeSupport::GetSupportedVideoModes(std::vector<VideoMode>& Modes)
|
|||
XRRScreenSize* Sizes = XRRConfigSizes(Config, &NbSizes);
|
||||
if (Sizes && (NbSizes > 0))
|
||||
{
|
||||
// Add them to the video modes array
|
||||
for (int i = 0; i < NbSizes; ++i)
|
||||
// Get the list of supported depths
|
||||
int NbDepths = 0;
|
||||
int* Depths = XListDepths(Disp, Screen, &NbDepths);
|
||||
if (Depths && (NbDepths > 0))
|
||||
{
|
||||
// Convert to sfVideoMode
|
||||
VideoMode Mode(Sizes[i].width, Sizes[i].height, 32);
|
||||
|
||||
// Add it only if it is not already in the array
|
||||
if (std::find(Modes.begin(), Modes.end(), Mode) == Modes.end())
|
||||
Modes.push_back(Mode);
|
||||
// Combine depths and sizes to fill the array of supported modes
|
||||
for (int i = 0; i < NbDepths; ++i)
|
||||
{
|
||||
for (int j = 0; j < NbSizes; ++j)
|
||||
{
|
||||
// Convert to sfVideoMode
|
||||
VideoMode Mode(Sizes[j].width, Sizes[j].height, Depths[i]);
|
||||
|
||||
// Add it only if it is not already in the array
|
||||
if (std::find(Modes.begin(), Modes.end(), Mode) == Modes.end())
|
||||
Modes.push_back(Mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +129,7 @@ VideoMode VideoModeSupport::GetDesktopVideoMode()
|
|||
int NbSizes;
|
||||
XRRScreenSize* Sizes = XRRConfigSizes(Config, &NbSizes);
|
||||
if (Sizes && (NbSizes > 0))
|
||||
DesktopMode = VideoMode(Sizes[CurrentMode].width, Sizes[CurrentMode].height, 32);
|
||||
DesktopMode = VideoMode(Sizes[CurrentMode].width, Sizes[CurrentMode].height, DefaultDepth(Disp, Screen));
|
||||
|
||||
// Free the configuration instance
|
||||
XRRFreeScreenConfigInfo(Config);
|
||||
|
|
|
@ -659,6 +659,8 @@ bool WindowImplX11::CreateContext(const VideoMode& Mode, XVisualInfo& ChosenVisu
|
|||
glXGetConfig(ourDisplay, &Visuals[i], GLX_SAMPLE_BUFFERS_ARB, &MultiSampling);
|
||||
glXGetConfig(ourDisplay, &Visuals[i], GLX_SAMPLES_ARB, &Samples);
|
||||
|
||||
std::cout << "Red = " << Red << " Green = " << Green << " Blue = " << Blue << std::endl;
|
||||
|
||||
// First check the mandatory parameters
|
||||
if ((RGBA == 0) || (DoubleBuffer == 0))
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue