;; create fbo depth buffer
(bind-func fbo_create_depth_buffer
(lambda (width height)
(let ((id:i32* (salloc))
(tex:i32* (salloc)))
(glGenRenderbuffers 1 id)
(glBindRenderbuffer GL_RENDERBUFFER (pref id 0))
(glRenderbufferStorage GL_RENDERBUFFER GL_DEPTH_COMPONENT32 width height)
;; (glRenderbufferStorage GL_RENDERBUFFER GL_DEPTH_COMPONENT24 width height)
(glFramebufferRenderbuffer GL_FRAMEBUFFER GL_DEPTH_ATTACHMENT GL_RENDERBUFFER (pref id 0))