Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>glScissor won't do what you want. Here is part of some code I wrote a while ago. It draws a rectangle with a grating texture and uses the stencil buffer to only have a disk visible.</p> <p>Here is the link I used back then: <a href="http://www.swiftless.com/tutorials/opengl/basic_reflection.html" rel="nofollow">http://www.swiftless.com/tutorials/opengl/basic_reflection.html</a></p> <pre><code>(let ((cnt 0d0)) (defmethod display ((w window)) ;; the complex number z represents amplitude and direction ;; of the grating constant ;; r and psi addresses different points in the back focal plane ;; r=0 will result in z=w0. the system is aligned to illuminate ;; the center of the back focal plane for z=w0. (let* ((w0 (* 540d0 (exp (complex 0d0 (/ pi 4d0))))) (r 260d0) (psi 270d0) (w (* r (exp (complex 0d0 (* psi (/ pi 180d0)))))) (z (+ w w0))) (clear-stencil 0) (clear :color-buffer-bit :stencil-buffer-bit) (load-identity) ;; http://www.swiftless.com/tutorials/ ;; opengl/basic_reflection.html ;; use stencil buffer to cut a disk out of the grating (color-mask :false :false :false :false) (depth-mask :false) (enable :stencil-test) (stencil-func :always 1 #xffffff) (stencil-op :replace :replace :replace) (draw-disk 100d0 (* .5d0 1920) (* .5d0 1080)) ;; center on camera 549,365 ;; 400 pixels on lcos = 276 pixels on camera (with binning 2) (color-mask :true :true :true :true) (depth-mask :false) (stencil-func :equal 1 #xffffff) (stencil-op :keep :keep :keep) ;; draw the grating (disable :depth-test) (with-pushed-matrix (translate (* .5 1920) (* .5 1080) 0) (rotate (* (phase z) 180d0 (/ pi)) 0 0 1) (translate (* -.5 1920) (* -.5 1080) 0) (draw *bild*)) (disable :stencil-test) (enable :depth-test) (fill-grating *grating* (abs z)) (format t "~a~%" cnt) (if (&lt; cnt 360d0) (incf cnt 30d0) (setf cnt 0d0)) (update *bild*) (swap-buffers) (sleep (/ 1d0)) ;; 1 frame per second (post-redisplay)))) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload