;; get texture height
;; for TEXTURE_2D only!
(bind-func gl_tex_height
(lambda (tex)
(glDisable GL_TEXTURE_RECTANGLE_ARB)
(glEnable GL_TEXTURE_2D)
(glBindTexture GL_TEXTURE_2D tex)
(let ((v:|1,i32|* (salloc)))
(glGetTexLevelParameteriv GL_TEXTURE_RECTANGLE_ARB 0 GL_TEXTURE_HEIGHT (cast v))
(glDisable GL_TEXTURE_2D)
(glBindTexture GL_TEXTURE_2D 0)
(aref v 0))))