Only check QGLFormat::samples when sampleBuffers is enabled. Fixes #196.

This commit is contained in:
Leonardo Zide 2018-02-24 18:22:53 -08:00
parent 51bbdb9b97
commit 232ece5e6b
2 changed files with 3 additions and 3 deletions

View file

@ -576,7 +576,7 @@ lcFramebuffer lcContext::CreateFramebuffer(int Width, int Height, bool Depth, bo
if (gSupportsFramebufferObjectARB)
{
int Samples = (Multisample && gSupportsTexImage2DMultisample) ? QGLFormat::defaultFormat().samples() : 1;
int Samples = (Multisample && gSupportsTexImage2DMultisample && QGLFormat::defaultFormat().sampleBuffers()) ? QGLFormat::defaultFormat().samples() : 1;
glGenFramebuffers(1, &Framebuffer.mObject);
glBindFramebuffer(GL_FRAMEBUFFER, Framebuffer.mObject);
@ -697,7 +697,7 @@ void lcContext::BindFramebuffer(GLuint FramebufferObject)
std::pair<lcFramebuffer, lcFramebuffer> lcContext::CreateRenderFramebuffer(int Width, int Height)
{
if (gSupportsFramebufferObjectARB && QGLFormat::defaultFormat().samples() > 1)
if (gSupportsFramebufferObjectARB && QGLFormat::defaultFormat().sampleBuffers() && QGLFormat::defaultFormat().samples() > 1)
return std::make_pair(CreateFramebuffer(Width, Height, true, true), CreateFramebuffer(Width, Height, false, false));
else
return std::make_pair(CreateFramebuffer(Width, Height, true, false), lcFramebuffer());

View file

@ -638,7 +638,7 @@ bool View::BeginRenderToImage(int Width, int Height)
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &MaxTexture);
MaxTexture = qMin(MaxTexture, 2048);
MaxTexture /= QGLFormat::defaultFormat().samples();
MaxTexture /= QGLFormat::defaultFormat().sampleBuffers() ? QGLFormat::defaultFormat().samples() : 1;
int TileWidth = qMin(Width, MaxTexture);
int TileHeight = qMin(Height, MaxTexture);