diff options
author | Jason Wilkins <Jason.A.Wilkins@gmail.com> | 2014-10-08 00:46:19 +0400 |
---|---|---|
committer | Jason Wilkins <Jason.A.Wilkins@gmail.com> | 2014-10-08 00:47:32 +0400 |
commit | 8d084e8c8f48dd2f07d4a3fbd4a941a7bcc0dcfb (patch) | |
tree | 5bf15f4f74f3e5a307cfa3f734b2cd086dca69bd /source/blender/gpu/intern/gpu_draw.c | |
parent | a8705e99ee8ec9de2f25c3bac1e9895c2f98c224 (diff) |
Ghost Context Refactor
https://developer.blender.org/D643
Separates graphics context creation from window code in Ghost so that they can vary separately.
Diffstat (limited to 'source/blender/gpu/intern/gpu_draw.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_draw.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 7295f0259c5..a4435a7d276 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -38,7 +38,7 @@ #include <string.h> -#include "GL/glew.h" +#include "GPU_glew.h" #include "BLI_blenlib.h" #include "BLI_linklist.h" @@ -1878,6 +1878,37 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[4][ return count; } +static void gpu_multisample(bool enable) +{ + if (GLEW_VERSION_1_3 || GLEW_ARB_multisample) { +#ifdef __linux__ + /* changing multisample enablement from the default (enabled) causes problems on some + * systems (NVIDIA/Linux) when the pixel format doesn't have a multisample buffer */ + bool toggle_ok = true; + + if (GPU_type_matches(GPU_DEVICE_NVIDIA, GPU_OS_UNIX, GPU_DRIVER_ANY)) { + int samples = 0; + glGetIntegerv(GL_SAMPLES, &samples); + + if (samples == 0) + toggle_ok = false; + } + + if (toggle_ok) { + if (enable) + glEnable(GL_MULTISAMPLE); + else + glDisable(GL_MULTISAMPLE); + } +#else + if (enable) + glEnable(GL_MULTISAMPLE); + else + glDisable(GL_MULTISAMPLE); +#endif + } +} + /* Default OpenGL State */ void GPU_state_init(void) @@ -1950,9 +1981,7 @@ void GPU_state_init(void) glCullFace(GL_BACK); glDisable(GL_CULL_FACE); - /* calling this makes drawing very slow when AA is not set up in ghost - * on Linux/NVIDIA. */ - // glDisable(GL_MULTISAMPLE); + gpu_multisample(false); } #ifdef DEBUG |