mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Applied the anti-aliasing modifications to the Linux implementation
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1317 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
f2a1ba3cda
commit
da44e3d8e5
@ -188,8 +188,6 @@ void ContextGLX::CreateContext(ContextGLX* shared, unsigned int bitsPerPixel, co
|
||||
// Find the best visual
|
||||
int bestScore = 0xFFFF;
|
||||
XVisualInfo* bestVisual = NULL;
|
||||
while (!bestVisual)
|
||||
{
|
||||
for (int i = 0; i < nbVisuals; ++i)
|
||||
{
|
||||
// Get the current visual attributes
|
||||
@ -221,27 +219,12 @@ void ContextGLX::CreateContext(ContextGLX* shared, unsigned int bitsPerPixel, co
|
||||
}
|
||||
}
|
||||
|
||||
// If no visual has been found, try a lower level of antialiasing
|
||||
// Make sure that we have found a visual
|
||||
if (!bestVisual)
|
||||
{
|
||||
if (mySettings.AntialiasingLevel > 2)
|
||||
{
|
||||
std::cerr << "Failed to find a pixel format supporting "
|
||||
<< mySettings.AntialiasingLevel << " antialiasing levels ; trying with 2 levels" << std::endl;
|
||||
mySettings.AntialiasingLevel = 2;
|
||||
}
|
||||
else if (mySettings.AntialiasingLevel > 0)
|
||||
{
|
||||
std::cerr << "Failed to find a pixel format supporting antialiasing ; antialiasing will be disabled" << std::endl;
|
||||
mySettings.AntialiasingLevel = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Failed to find a suitable pixel format for the window -- cannot create OpenGL context" << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get the context to share display lists with
|
||||
GLXContext toShare = shared ? shared->myContext : NULL;
|
||||
@ -296,11 +279,14 @@ void ContextGLX::CreateContext(ContextGLX* shared, unsigned int bitsPerPixel, co
|
||||
}
|
||||
|
||||
// Update the creation settings from the chosen format
|
||||
int depth, stencil;
|
||||
int depth, stencil, multiSampling, samples;
|
||||
glXGetConfig(myDisplay, bestVisual, GLX_DEPTH_SIZE, &depth);
|
||||
glXGetConfig(myDisplay, bestVisual, GLX_STENCIL_SIZE, &stencil);
|
||||
glXGetConfig(myDisplay, bestVisual, GLX_SAMPLE_BUFFERS_ARB, &multiSampling);
|
||||
glXGetConfig(myDisplay, bestVisual, GLX_SAMPLES_ARB, &samples);
|
||||
mySettings.DepthBits = static_cast<unsigned int>(depth);
|
||||
mySettings.StencilBits = static_cast<unsigned int>(stencil);
|
||||
mySettings.AntialiasingLevel = multiSampling ? samples : 0;
|
||||
|
||||
// Change the target window's colormap so that it matches the context's one
|
||||
::Window root = RootWindow(myDisplay, DefaultScreen(myDisplay));
|
||||
|
Loading…
Reference in New Issue
Block a user