From 16e929e6ff1007d057d183b56bb7fc2d1f8aae53 Mon Sep 17 00:00:00 2001 From: Ines Almeida Date: Mon, 17 Apr 2017 22:31:56 +0200 Subject: [PATCH] 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 --- source/blender/gpu/intern/gpu_framebuffer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c index fc6eb6baf51..9e34304190d 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.c +++ b/source/blender/gpu/intern/gpu_framebuffer.c @@ -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