Workaround for apparent (Mesa ?) GL bug with display lists that bind a texture

release
slava 2006-07-25 20:30:50 +00:00
parent 7712d84327
commit f7b1fae96c
1 changed files with 10 additions and 8 deletions

View File

@ -118,16 +118,18 @@ C: sprite ( loc dim dim2 -- )
: gl-translate ( { x y } -- ) first2 0.0 glTranslated ; : gl-translate ( { x y } -- ) first2 0.0 glTranslated ;
: draw-sprite ( sprite -- )
dup sprite-loc gl-translate
GL_TEXTURE_2D over sprite-texture glBindTexture
init-texture
dup sprite-dim2 gl-fill-rect
dup sprite-dim { 1 0 } v*
swap sprite-loc v- gl-translate
GL_TEXTURE_2D 0 glBindTexture ;
: make-sprite-dlist ( sprite -- id ) : make-sprite-dlist ( sprite -- id )
GL_MODELVIEW [ GL_MODELVIEW [
GL_COMPILE [ GL_COMPILE [ draw-sprite ] make-dlist
dup sprite-loc gl-translate
GL_TEXTURE_2D over sprite-texture glBindTexture
init-texture
dup sprite-dim2 gl-fill-rect
dup sprite-dim { 1 0 0 } v*
swap sprite-loc v- gl-translate
] make-dlist
] do-matrix ; ] do-matrix ;
: init-sprite ( texture sprite -- ) : init-sprite ( texture sprite -- )