;; for 2d overlays etc..
(bind-func postrender:XTMRENDERCB
(let ((uvmat:float* (alloc 16))
(pcopy (alloc 16)))
(lambda (frame shader m v p data)
;; in postrender we are responible for drawing the render_fbo!!
;; i.e. the actual scene!
(xtm_draw_tex xtm_render_quad_shader (colour_tex (xtm_render_fbo)) m v p)
;; let's draw a picture in picture while we are at it!
(mcopy p 4 4 pcopy)
;; add picture in picture
;; first scale and translate the PIP to a size and location on screen
(scale_matrix pcopy 0.4 0.3 0.5) ;; flip the image (and possibly resize?)
(translate_matrix pcopy -0.5 -0.6 0.0) ;; move the image somewhere?
;; second uvmap translate/scale to zoom into peppino (i.e. zoom into fbo)
(fill_identity_matrix uvmat)
(scale_matrix uvmat 0.2 0.2 1.0)
(translate_matrix uvmat .4 .45 0.0)
;; next setup blending for transparent draw
(glEnable GL_BLEND) ;; add for blending
(glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA)
;; finally draw the render_fbo again with a 0.7 alpha
(xtm_draw_tex xtm_render_quad_shader (colour_tex (xtm_render_fbo)) uvmat #f 0.7 m v pcopy)
;; Finally use nano vg to draw some white text with a black background
;; as well as a border
(vector_gfx frame shader m v p data)
(glDisable GL_BLEND)
(glEnable GL_DEPTH_TEST)
void)))