]> gitweb.factorcode.org Git - factor.git/commitdiff
opengl: log all mac os errors where framebuffer is undefined.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 30 Mar 2016 22:28:39 +0000 (15:28 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 30 Mar 2016 22:28:39 +0000 (15:28 -0700)
basis/opengl/opengl.factor
basis/ui/gadgets/worlds/worlds.factor

index 2fb27d03684c4886fb3757a5c8d0b954d058b655..53887994d4735b8c2ff6d49fe1318e239b5a0649 100644 (file)
@@ -5,7 +5,7 @@
 USING: alien alien.c-types alien.data assocs colors
 combinators.smart continuations fry init io kernel locals macros
 math math.parser namespaces opengl.gl sequences
-sequences.generalizations specialized-arrays words ;
+sequences.generalizations specialized-arrays system words ;
 FROM: alien.c-types => float ;
 SPECIALIZED-ARRAY: float
 SPECIALIZED-ARRAY: uint
@@ -40,20 +40,32 @@ TUPLE: gl-error-tuple function code string ;
 : gl-error-code ( -- code/f )
     glGetError dup 0 = [ drop f ] when ; inline
 
+: throw-gl-error? ( -- ? )
+    os macosx? [
+        ! This is kind of terrible, but we are having
+        ! problems on Mac OS X 10.11 where the
+        ! default framebuffer seems to be initialized
+        ! asynchronously or something, so we should
+        ! just log these for now in (gl-error).
+        GL_FRAMEBUFFER glCheckFramebufferStatus
+        GL_FRAMEBUFFER_UNDEFINED = not
+    ] [ t ] if ;
+
 : (gl-error) ( function -- )
-    gl-error-code [ <gl-error> throw ] [ drop ] if* ;
+    gl-error-code [
+        throw-gl-error? [
+            <gl-error> throw
+        ] [
+            [
+                [ number>string ] [ error>string ] bi ": " glue
+                "OpenGL error: " prepend print flush drop
+            ] with-global
+        ] if
+    ] [ drop ] if* ;
 
 : gl-error ( -- )
     f (gl-error) ; inline
 
-: gl-error-nonfatal ( -- )
-    gl-error-code [
-        [
-            [ number>string ] [ error>string ] bi ": " glue
-            "OpenGL error: " prepend print flush
-        ] with-global
-    ] when* ;
-
 : do-enabled ( what quot -- )
     over glEnable dip glDisable ; inline
 
index 6eab0951fff5b665291404dc0ea124106fae9705..908adb0e23b279ba777032e2b9a6f6cbea966d72 100644 (file)
@@ -97,7 +97,7 @@ TUPLE: world-attributes
 
 : with-gl-context ( world quot -- )
     '[ set-gl-context @ ]
-    [ handle>> flush-gl-context gl-error-nonfatal ] bi ; inline
+    [ handle>> flush-gl-context gl-error ] bi ; inline
 
 ERROR: no-world-found ;