Don't use GL_ARB_texture_non_power_of_two on ATI hardware to fix bug reported by Andy Turner and Caesar Hu

db4
Slava Pestov 2009-04-10 06:18:29 -05:00
parent 2b26da1ad2
commit 713ab02337
3 changed files with 18 additions and 10 deletions

View File

@ -32,6 +32,8 @@ IN: opengl.capabilities
(gl-version) drop ; (gl-version) drop ;
: gl-vendor-version ( -- version ) : gl-vendor-version ( -- version )
(gl-version) nip ; (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? ;
: (make-gl-version-error) ( required-version -- ) : (make-gl-version-error) ( required-version -- )

View File

@ -1,13 +1,23 @@
! Copyright (C) 2009 Slava Pestov. ! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs cache colors.constants destructors fry kernel USING: accessors assocs cache colors.constants destructors fry kernel
opengl opengl.gl combinators images images.tesselation grouping opengl opengl.gl opengl.capabilities combinators images
specialized-arrays.float sequences math math.vectors images.tesselation grouping specialized-arrays.float sequences math
math.matrices generalizations fry arrays namespaces ; math.vectors math.matrices generalizations fry arrays namespaces
system ;
IN: opengl.textures IN: opengl.textures
SYMBOL: non-power-of-2-textures? SYMBOL: non-power-of-2-textures?
: check-extensions ( -- )
#! ATI frglx driver doesn't implement GL_ARB_texture_non_power_of_two properly.
#! See thread 'Linux font display problem' April 2009 on Factor-talk
gl-vendor "ATI Technologies Inc." = not os macosx? or [
"2.0" { "GL_ARB_texture_non_power_of_two" }
has-gl-version-or-extensions?
non-power-of-2-textures? set
] when ;
: gen-texture ( -- id ) [ glGenTextures ] (gen-gl-object) ; : gen-texture ( -- id ) [ glGenTextures ] (gen-gl-object) ;
: delete-texture ( id -- ) [ glDeleteTextures ] (delete-gl-object) ; : delete-texture ( id -- ) [ glDeleteTextures ] (delete-gl-object) ;

View File

@ -1,9 +1,9 @@
! 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 continuations kernel math models USING: accessors arrays assocs continuations kernel math models
namespaces opengl opengl.capabilities opengl.textures sequences io namespaces opengl opengl.textures sequences io combinators
combinators combinators.short-circuit fry math.vectors math.rectangles combinators.short-circuit fry math.vectors math.rectangles cache
cache ui.gadgets ui.gestures ui.render ui.backend ui.gadgets.tracks ui.gadgets ui.gestures ui.render ui.backend ui.gadgets.tracks
ui.commands ; ui.commands ;
IN: ui.gadgets.worlds IN: ui.gadgets.worlds
@ -77,10 +77,6 @@ SYMBOL: flush-layout-cache-hook
flush-layout-cache-hook [ [ ] ] initialize flush-layout-cache-hook [ [ ] ] initialize
: check-extensions ( -- )
"2.0" { "GL_ARB_texture_non_power_of_two" } has-gl-version-or-extensions?
non-power-of-2-textures? set ;
: (draw-world) ( world -- ) : (draw-world) ( world -- )
dup handle>> [ dup handle>> [
check-extensions check-extensions