]> gitweb.factorcode.org Git - factor.git/commitdiff
opengl.capabilities: Apply @jonenst's suggestions for gl-version failures with mesa...
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 8 Jun 2014 04:22:29 +0000 (21:22 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 8 Jun 2014 04:48:20 +0000 (21:48 -0700)
basis/opengl/capabilities/capabilities.factor
basis/ui/gadgets/worlds/worlds.factor

index b1b173177481ee89b95139e85beeb58a40ace176..1cc35c3a391a3ff0ebac869f40f1fe3296cdc297 100644 (file)
@@ -29,18 +29,18 @@ IN: opengl.capabilities
 : version-before? ( version1 version2 -- ? )
     [ version-seq ] bi@ before=? ;
 
-: (gl-version) ( -- version vendor )
+: (gl-version) ( -- string1 string2 )
     GL_VERSION glGetString " " split1 ;
-: gl-version ( -- version )
-    (gl-version) drop ;
-: gl-vendor-version ( -- version )
-    (gl-version) nip ;
-: gl-vendor ( -- name )
-    GL_VENDOR glGetString ;
+: gl-version ( -- string ) (gl-version) drop ;
+: gl-vendor-version ( -- string ) (gl-version) nip ;
+: gl-vendor ( -- string ) GL_VENDOR glGetString ;
+
 : has-gl-version? ( version -- ? )
-    gl-version version-before? ;
+    gl-version [ version-before? ] [ drop f ] if* ;
+
 : (make-gl-version-error) ( required-version -- )
-    "Required OpenGL version " % % " not supported (" % gl-version % " available)" % ;
+    "Required OpenGL version " % % " not supported (" % gl-version "(null)" or % " available)" % ;
+
 : require-gl-version ( version -- )
     [ has-gl-version? ]
     [ (make-gl-version-error) ]
@@ -48,15 +48,13 @@ IN: opengl.capabilities
 
 : (glsl-version) ( -- version vendor )
     GL_SHADING_LANGUAGE_VERSION glGetString " " split1 ;
-: glsl-version ( -- version )
-    (glsl-version) drop ;
-: glsl-vendor-version ( -- version )
-    (glsl-version) nip ;
-: has-glsl-version? ( version -- ? )
-    glsl-version version-before? ;
+: glsl-version ( -- string ) (glsl-version) drop ;
+: glsl-vendor-version ( -- string ) (glsl-version) nip ;
+: has-glsl-version? ( version -- ? ) glsl-version version-before? ;
+
 : require-glsl-version ( version -- )
     [ has-glsl-version? ]
-    [ "Required GLSL version " % % " not supported (" % glsl-version % " available)" % ]
+    [ "Required GLSL version " % % " not supported (" % glsl-version "(null)" or % " available)" % ]
     (require-gl) ;
 
 : has-gl-version-or-extensions? ( version extensions -- ? )
index 7e064ee76b30095a04b7f374a31c02deeea08a9c..63c89c94948620ad733416a502d270265a401835 100644 (file)
@@ -1,11 +1,11 @@
 ! Copyright (C) 2005, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays assocs cache colors combinators
+USING: accessors assocs cache colors combinators
 combinators.short-circuit concurrency.promises continuations
-destructors fry io kernel literals math math.rectangles
-math.vectors models namespaces opengl opengl.textures sequences
-strings ui.backend ui.gadgets ui.gadgets.tracks ui.gestures
-ui.pixel-formats ui.render ;
+destructors fry kernel literals math models namespaces opengl
+opengl.capabilities opengl.textures sequences strings ui.backend
+ui.gadgets ui.gadgets.tracks ui.gestures ui.pixel-formats
+ui.render ;
 IN: ui.gadgets.worlds
 
 SYMBOLS:
@@ -187,6 +187,7 @@ GENERIC: draw-world* ( world -- )
 
 M: world draw-world*
     check-extensions
+    "1.0" require-gl-version
     {
         [ init-gl ]
         [ draw-gadget ]