opengl.capabilities: Apply @jonenst's suggestions for gl-version failures with mesa opengl.

db4
Doug Coleman 2014-06-07 21:22:29 -07:00
parent d10443186c
commit d614084550
2 changed files with 20 additions and 21 deletions

View File

@ -29,18 +29,18 @@ IN: opengl.capabilities
: version-before? ( version1 version2 -- ? ) : version-before? ( version1 version2 -- ? )
[ version-seq ] bi@ before=? ; [ version-seq ] bi@ before=? ;
: (gl-version) ( -- version vendor ) : (gl-version) ( -- string1 string2 )
GL_VERSION glGetString " " split1 ; GL_VERSION glGetString " " split1 ;
: gl-version ( -- version ) : gl-version ( -- string ) (gl-version) drop ;
(gl-version) drop ; : gl-vendor-version ( -- string ) (gl-version) nip ;
: gl-vendor-version ( -- version ) : gl-vendor ( -- string ) GL_VENDOR glGetString ;
(gl-version) nip ;
: gl-vendor ( -- name )
GL_VENDOR glGetString ;
: has-gl-version? ( version -- ? ) : has-gl-version? ( version -- ? )
gl-version version-before? ; gl-version [ version-before? ] [ drop f ] if* ;
: (make-gl-version-error) ( required-version -- ) : (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 -- ) : require-gl-version ( version -- )
[ has-gl-version? ] [ has-gl-version? ]
[ (make-gl-version-error) ] [ (make-gl-version-error) ]
@ -48,15 +48,13 @@ IN: opengl.capabilities
: (glsl-version) ( -- version vendor ) : (glsl-version) ( -- version vendor )
GL_SHADING_LANGUAGE_VERSION glGetString " " split1 ; GL_SHADING_LANGUAGE_VERSION glGetString " " split1 ;
: glsl-version ( -- version ) : glsl-version ( -- string ) (glsl-version) drop ;
(glsl-version) drop ; : glsl-vendor-version ( -- string ) (glsl-version) nip ;
: glsl-vendor-version ( -- version ) : has-glsl-version? ( version -- ? ) glsl-version version-before? ;
(glsl-version) nip ;
: has-glsl-version? ( version -- ? )
glsl-version version-before? ;
: require-glsl-version ( version -- ) : require-glsl-version ( version -- )
[ has-glsl-version? ] [ has-glsl-version? ]
[ "Required GLSL version " % % " not supported (" % glsl-version % " available)" % ] [ "Required GLSL version " % % " not supported (" % glsl-version "(null)" or % " available)" % ]
(require-gl) ; (require-gl) ;
: has-gl-version-or-extensions? ( version extensions -- ? ) : has-gl-version-or-extensions? ( version extensions -- ? )

View File

@ -1,11 +1,11 @@
! Copyright (C) 2005, 2009 Slava Pestov. ! Copyright (C) 2005, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! 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 combinators.short-circuit concurrency.promises continuations
destructors fry io kernel literals math math.rectangles destructors fry kernel literals math models namespaces opengl
math.vectors models namespaces opengl opengl.textures sequences opengl.capabilities opengl.textures sequences strings ui.backend
strings ui.backend ui.gadgets ui.gadgets.tracks ui.gestures ui.gadgets ui.gadgets.tracks ui.gestures ui.pixel-formats
ui.pixel-formats ui.render ; ui.render ;
IN: ui.gadgets.worlds IN: ui.gadgets.worlds
SYMBOLS: SYMBOLS:
@ -187,6 +187,7 @@ GENERIC: draw-world* ( world -- )
M: world draw-world* M: world draw-world*
check-extensions check-extensions
"1.0" require-gl-version
{ {
[ init-gl ] [ init-gl ]
[ draw-gadget ] [ draw-gadget ]