(bind-func update
(lambda (tex:Texture*)
(glActiveTexture GL_TEXTURE0)
(glBindTexture GL_TEXTURE_2D (id tex))
(glTexImage2D GL_TEXTURE_2D 0
(if (= (type tex) GL_BGRA) GL_RGBA (type tex)) ;; this is internal type
(width tex)
(height tex)
0
(type tex) ;; this is external type (i.e. conversion from external to internal required)
GL_UNSIGNED_BYTE
(data tex))
(glBindTexture GL_TEXTURE_2D 0)
(gl_print_error "couldn't update texture")
void))