-
Notifications
You must be signed in to change notification settings - Fork 86
textures
The textures
directory contains PNG files to be converted into OpenGL textures. The textures are automatically padded to powers of two to satisfy GPU requirements. Some GPUs will not display textures larger than 1024x1024, so images should be smaller or equal to this in size. The texture converter will process RGBA/RGB/Grayscale PNGs into RGBA/RGB/Alpha textures, respectively. Smaller alpha textures have the least rendering overhead.
Textures are accessible as <png name>.img
in the application. For example, the texture corresponding to the image file splash.png
can be referenced as splash.img
in the code.
The texture <png name>.img
parameters are actually lists,
(w h texturedata x1 y1 x2 y2)
where w,h are the dimensions to render in pixels, and (x1,y1)-(x2,y2) are the relative coordinates into the texture map. (x1,y1) will be (0,0) for an automatically generated texture. The texture map dimensions are powers of two, so the relative coordinates are not necessarily relative to the dimensions of the source image. The following can be used to access portions of a texture, for example to implement a sprite atlas:
(define (subtexture texture x y w h)
(let* ((w0 (car texture))
(h0 (cadr texture))
(xr2 (list-ref texture 5))
(yr2 (list-ref texture 6))
(subxr1 (/ (* x xr2) w0))
(subyr1 (/ (* y yr2) h0))
(subxr2 (/ (* (+ x w) xr2) w0))
(subyr2 (/ (* (+ y h) yr2) h0)))
(list w h (caddr texture) subxr1 subyr1 subxr2 subyr2)))
(define sprites (list
(subtexture atlas.img 97 17 95 78)
(subtexture atlas.img 193 17 95 78)
(subtexture atlas.img 289 17 95 78)
(subtexture atlas.img 385 17 95 78)
))
-
- accelerometer
- alist
- audio
- audioaux
- base64
- btle-scan
- camera
- cdb
- cgi
- config
- csv
- curl
- digest
- dmtx
- download
- eventloop
- fcgi
- fft
- generalized-arrays
- gps
- graph
- gyro
- hidapi
- hpdf
- html
- httpsclient
- hybridapp
- json
- lmdb
- ln_core
- ln_glcore
- ln_glgui
- ln_store
- localization
- localization_gui
- localnotification
- magnetometer
- mdns
- mqtt
- mqtt-store
- multitouch
- oauth
- orientation
- p256ecdsa
- png
- portaudio
- pregexp
- pressure
- prime
- pushnotification
- redcap
- rsa
- rtaudio
- rupi
- rotation
- sanestring
- scheduler
- serial
- sets
- settings
- simplexnoise
- sqlite
- ssax
- syntax-case
- timestamp
- ttf
- uiform
- url
- uuid
- vibrate
- videoplayer
- watchdog
- website
- xml
- zip