postrender:XTMRENDERCB   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/examples/external/xtmrender5.xtm

Implementation

;; 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)))


Back to Index

Similar Entries

  • post:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/slideshow.xtm
  • post:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/kinect_vg.xtm
  • post:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/gstvideo_multi.xtm
  • post:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/qr-code.xtm
  • prerender:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender3.xtm
  • prerender:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender2.xtm
  • prerender:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender5.xtm
  • prerender:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender4.xtm
  • prerender:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender6.xtm
  • render:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender3.xtm
  • render:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender2.xtm
  • render:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender1.xtm
  • render:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender5.xtm
  • render:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender4.xtm
  • render:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender6.xtm
  • trans:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/contrib/fluids_2d.xtm
  • trans:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender4.xtm
  • vector_gfx:XTMRENDERCB    xtlang    /digego/extempore/tree/v0.8.9/examples/external/xtmrender5.xtm