From e40e2eea0a9ae5a32df1dbe1978d5bc9b56e061a Mon Sep 17 00:00:00 2001 From: roentgen Date: Mar 23 2016 14:54:23 +0000 Subject: Merge pull request #10 from opentoonz/fix-check_framebuffer_status glCheckFramebufferStatusEXTが無い環境で起動直後に落ちる問題を修正 --- diff --git a/toonz/sources/toonz/sceneviewer.cpp b/toonz/sources/toonz/sceneviewer.cpp index f6021f8..29467a9 100644 --- a/toonz/sources/toonz/sceneviewer.cpp +++ b/toonz/sources/toonz/sceneviewer.cpp @@ -1014,21 +1014,25 @@ void SceneViewer::drawBackground() glClear(GL_COLOR_BUFFER_BIT); if (glGetError() == GL_INVALID_FRAMEBUFFER_OPERATION) { /* 起動時一回目になぜか GL_FRAMEBUFFER_COMPLETE なのに invalid operation が出る */ - printf("GL_INVALID_FRAMEBUFFER_OPERATION: framebuffer:%d\n", + GLenum status = 0; #if WIN32 - reinterpret_cast( - wglGetProcAddress("glCheckFramebufferStatusEXT"))(GL_FRAMEBUFFER)); + PROC proc = wglGetProcAddress("glCheckFramebufferStatusEXT"); + if (proc != nullptr) + status = reinterpret_cast(proc)(GL_FRAMEBUFFER); #else - glCheckFramebufferStatus(GL_FRAMEBUFFER)); + status = glCheckFramebufferStatus(GL_FRAMEBUFFER); #endif + printf("GL_INVALID_FRAMEBUFFER_OPERATION: framebuffer:%d\n", status); } } bool check_framebuffer_status() { #if WIN32 - GLenum s = reinterpret_cast( - wglGetProcAddress("glCheckFramebufferStatusEXT"))(GL_FRAMEBUFFER); + PROC proc = wglGetProcAddress("glCheckFramebufferStatusEXT"); + if (proc == nullptr) + return true; + GLenum s = reinterpret_cast(proc)(GL_FRAMEBUFFER); #else GLenum s = glCheckFramebufferStatus(GL_FRAMEBUFFER); #endif