]> gitweb.factorcode.org Git - factor.git/commitdiff
opengl: Temporary (?) fix for the ui. Issue #1379.
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 4 Aug 2015 19:23:55 +0000 (12:23 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Tue, 4 Aug 2015 19:28:59 +0000 (12:28 -0700)
Throwing gl errors is not helpful because the ui gets messed up anyway. Print the error and continue. Maybe we should add a section in the F3 error window for opengl errors instead of printing them in the global stdout.
- We could also use gl-error on every platform except for MacOSX 10.11
- We could fix the underlying gl drawing commands that cause this error.

basis/opengl/opengl.factor
basis/ui/gadgets/worlds/worlds.factor

index 55c2b766cde1d2abcbbbbdad4f56deb9de7b241a..26a3410677c3ca9e4554c98da0ed720c41ddcb64 100644 (file)
@@ -3,9 +3,9 @@
 ! Portions copyright (C) 2008 Joe Groff.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: alien alien.c-types alien.data assocs colors
-combinators.smart continuations fry init kernel locals macros
-math namespaces opengl.gl sequences sequences.generalizations
-specialized-arrays words ;
+combinators.smart continuations fry init io kernel locals macros
+math math.parser namespaces opengl.gl sequences
+sequences.generalizations specialized-arrays words ;
 FROM: alien.c-types => float ;
 SPECIALIZED-ARRAY: float
 SPECIALIZED-ARRAY: uint
@@ -46,6 +46,14 @@ TUPLE: gl-error-tuple function code string ;
 : 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 51e95ac4ccc465e30024c055b1345de5902b9197..f4b494fa3f0eb8271daff0eaa21538ac7a313585 100644 (file)
@@ -97,7 +97,7 @@ TUPLE: world-attributes
 
 : with-gl-context ( world quot -- )
     '[ set-gl-context @ ]
-    [ handle>> flush-gl-context gl-error ] bi ; inline
+    [ handle>> flush-gl-context gl-error-nonfatal ] bi ; inline
 
 ERROR: no-world-found ;