Fixed crash when MSAA is not available. Fixes #573.

This commit is contained in:
Leonardo Zide
2020-12-28 09:42:13 -08:00
parent 4e6cbca31c
commit 7ef1d7b733
2 changed files with 31 additions and 31 deletions
+1 -1
View File
@@ -718,7 +718,7 @@ void lcContext::BindFramebuffer(GLuint FramebufferObject)
std::pair<lcFramebuffer, lcFramebuffer> lcContext::CreateRenderFramebuffer(int Width, int Height)
{
#ifdef LC_USE_QOPENGLWIDGET
if (gSupportsFramebufferObject && QSurfaceFormat::defaultFormat().samples() > 1)
if (gSupportsFramebufferObject && gSupportsTexImage2DMultisample && QSurfaceFormat::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());
+30 -30
View File
@@ -125,36 +125,6 @@ PFNGLBLENDFUNCSEPARATEPROC lcBlendFuncSeparate;
#endif
static bool lcIsGLExtensionSupported(const GLubyte* Extensions, const char* Name)
{
const GLubyte* Start;
GLubyte* Where;
GLubyte* Terminator;
Where = (GLubyte*)strchr(Name, ' ');
if (Where || *Name == '\0')
return false;
if (!Extensions)
return false;
for (Start = Extensions; ;)
{
Where = (GLubyte*)strstr((const char*)Start, Name);
if (!Where)
break;
Terminator = Where + strlen(Name);
if (Where == Start || *(Where - 1) == ' ')
if (*Terminator == ' ' || *Terminator == '\0')
return true;
Start = Terminator;
}
return false;
}
#if !defined(QT_NO_DEBUG) && defined(GL_ARB_debug_output)
static void APIENTRY lcGLDebugCallback(GLenum Source, GLenum Type, GLuint Id, GLenum Severity, GLsizei Length, const GLchar* Message, GLvoid* UserParam)
@@ -217,6 +187,36 @@ void lcInitializeGLExtensions(const QOpenGLContext* Context)
#else
static bool lcIsGLExtensionSupported(const GLubyte* Extensions, const char* Name)
{
const GLubyte* Start;
GLubyte* Where;
GLubyte* Terminator;
Where = (GLubyte*)strchr(Name, ' ');
if (Where || *Name == '\0')
return false;
if (!Extensions)
return false;
for (Start = Extensions; ;)
{
Where = (GLubyte*)strstr((const char*)Start, Name);
if (!Where)
break;
Terminator = Where + strlen(Name);
if (Where == Start || *(Where - 1) == ' ')
if (*Terminator == ' ' || *Terminator == '\0')
return true;
Start = Terminator;
}
return false;
}
void lcInitializeGLExtensions(const QGLContext* Context)
{
const GLubyte* Extensions = glGetString(GL_EXTENSIONS);