From 9d021bb0817d3a1603519d36bc885f31e736d491 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 4 Aug 2015 12:23:55 -0700 Subject: [PATCH] opengl: Temporary (?) fix for the ui. Issue #1379. 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 | 14 +++++++++++--- basis/ui/gadgets/worlds/worlds.factor | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/basis/opengl/opengl.factor b/basis/opengl/opengl.factor index 55c2b766cd..26a3410677 100644 --- a/basis/opengl/opengl.factor +++ b/basis/opengl/opengl.factor @@ -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 diff --git a/basis/ui/gadgets/worlds/worlds.factor b/basis/ui/gadgets/worlds/worlds.factor index 51e95ac4cc..f4b494fa3f 100644 --- a/basis/ui/gadgets/worlds/worlds.factor +++ b/basis/ui/gadgets/worlds/worlds.factor @@ -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 ;