;; texture from existing data (no copy)
(bind-func Texture
(lambda (width:i32 height:i32 comp:i32 data:i8*)
(let ((tex (cond ((= comp 1)
(Texture:[Texture*,i32]* GL_DEPTH_COMPONENT))
((= comp 3)
(Texture:[Texture*,i32]* GL_RGB))
(else
(Texture:[Texture*,i32]* GL_RGBA)))))
(tset! tex 2 width)
(tset! tex 3 height)
(tset! tex 4 (cast data i8*))
(update tex)
tex)))