OpenGL: Fix crash on start with Mesa drivers

glFramebufferTexture() is only available from OGL 3.2, it is also not part of the ARB_framebuffer_object extension.
I don't know if there is a better way to check for mesa drivers or if using the 2D version will have issues with f2f16a256, but so far I had no problems
This commit is contained in:
Inês Almeida 2017-04-17 22:31:56 +02:00
parent c6e8a004a1
commit 16e929e6ff
1 changed files with 6 additions and 0 deletions

View File

@ -146,6 +146,12 @@ bool GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, int slo
#if defined(__APPLE__) && defined(WITH_GL_PROFILE_COMPAT)
/* Mac workaround, remove after we switch to core profile */
glFramebufferTextureEXT(GL_FRAMEBUFFER, attachment, GPU_texture_opengl_bindcode(tex), 0);
#elif defined(WITH_GL_PROFILE_COMPAT)
/* Workaround for Mesa compatibility profile, remove after we switch to core profile */
if(!GLEW_VERSION_3_2) /* glFramebufferTexture was introduced in 3.2. It is *not* available in the ARB FBO extension */
glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, GPU_texture_target(tex), GPU_texture_opengl_bindcode(tex), 0);
else
glFramebufferTexture(GL_FRAMEBUFFER, attachment, GPU_texture_opengl_bindcode(tex), 0); /* normal core call, same as below */
#else
glFramebufferTexture(GL_FRAMEBUFFER, attachment, GPU_texture_opengl_bindcode(tex), 0);
#endif