# this file contains routines to do import and proper handling # of arbitrary size images as textures. # jpg -> bitmap # bitmap -> texture / aspect # -> square drawing to preserve aspect ratio # debug # load-opengl load-jpeg load-png # utility : texture/wh texture:aspect texture # get aspect ratio, set texture over * swap ; # ( size aspect ) multiply size with aspect and swap to get w h : texrect texture/wh rectangle ; "( height texture -- )\tDraw a textured rectangle, respecting aspect ratio." doc # same, but temporary hack since bitmaps are 'upside down' (opengl VS rest of the world) : texrect- texture/wh -1. * rectangle ; # 320 240 display 1024 320 - 0 movewindow 2d ip variable! t # : d 1. t @ texrect- ; ' d is drawer # run interactive