;; get texture-width
;; for TEXTURE_RECTANGLE only!
(bind-func gl_tex_width_rect
(lambda (tex)
(glDisable GL_TEXTURE_2D)
(glEnable GL_TEXTURE_RECTANGLE_ARB)
(glBindTexture GL_TEXTURE_RECTANGLE_ARB tex)
(let ((v:|1,i32|* (salloc)))
(glGetTexLevelParameteriv GL_TEXTURE_RECTANGLE_ARB 0 GL_TEXTURE_WIDTH (cast v))
(glDisable GL_TEXTURE_RECTANGLE_ARB)
(glBindTexture GL_TEXTURE_RECTANGLE_ARB 0)
(aref v 0))))