oopsie, forgot to delete the commented-out code

This commit is contained in:
~keith 2022-02-25 00:50:52 +00:00
parent b3b0690edd
commit 234987a4fa
Signed by: keith
GPG key ID: 5BEBEEAB2C73D520

View file

@ -61,57 +61,14 @@
+version+))
(sdl2:with-gl-context (gl-context win)
(sdl2:gl-make-current win gl-context)
(let (#|(framebuf (gl:gen-framebuffer))
(renderbuf (gl:gen-renderbuffer))
(render-texture (gl:gen-texture))
(win-width (nth-value 0 (sdl2:get-window-size win)))
(win-height (nth-value 1 (sdl2:get-window-size win)))|#
(prev-tick (sdl2:get-ticks))
(let ((prev-tick (sdl2:get-ticks))
(this-tick (sdl2:get-ticks))
(prev-profiling-tick (sdl2:get-performance-counter))
(profiling-scale (/ (sdl2:get-performance-frequency) 1000.0)))
,@(loop for system in *world-systems*
append `((,(second system))))
#|
;; set up framebuffer
(gl:bind-framebuffer :framebuffer framebuf)
(gl:bind-texture :texture-2d render-texture)
(gl:tex-image-2d :texture-2d 0 :rgba *view-width* *view-height* 0 :rgba :unsigned-byte (cffi:null-pointer))
(gl:tex-parameter :texture-2d :texture-wrap-s :clamp-to-edge)
(gl:tex-parameter :texture-2d :texture-wrap-t :clamp-to-edge)
(gl:tex-parameter :texture-2d :texture-min-filter :nearest)
(gl:tex-parameter :texture-2d :texture-mag-filter :nearest)
(gl:bind-texture :texture-2d 0)
(gl:framebuffer-texture-2d :framebuffer :color-attachment0 :texture-2d render-texture 0)
(gl:bind-renderbuffer :renderbuffer renderbuf)
(gl:renderbuffer-storage :renderbuffer :depth24-stencil8 *view-width* *view-height*)
(gl:bind-renderbuffer :renderbuffer 0)
(gl:framebuffer-renderbuffer :framebuffer :depth-stencil-attachment :renderbuffer renderbuf)
;; make sure it's valid
(let ((result (gl:check-framebuffer-status :framebuffer)))
(unless (gl::enum= result :framebuffer-complete)
(error "Failed to create framebuffer: ~S" result)))
(format t "texture-resident-p: ~S~%" (gl:texture-resident-p render-texture))
;; set up gl
(gl:matrix-mode :projection)
(gl:ortho 0 *view-width*
0 *view-height*
-1024 1024)
(gl:matrix-mode :modelview)
(gl:load-identity)
(gl:clear-color 0.0 0.0 0.0 1.0)
(gl:clear :color-buffer)
(gl:clear :depth-buffer)
|#
(sdl2:with-event-loop (:method :poll)
(:quit () t)
(:idle ()
@ -130,49 +87,5 @@
(format t ,(format nil "~S~A" (first system) "=~S ")
(/ (- (sdl2:get-performance-counter) prev-profiling-tick) profiling-scale))
))
#|
;; draw to render texture
(gl:bind-framebuffer :framebuffer framebuf)
(gl:viewport 0 0 *view-width* *view-height*)
(gl:clear :color-buffer)
(gl:enable :depth-test)
(let ((render-pass nil))
(loop for view-ptr in *world-views*
for view = (ensure-live (weak-pointer-value view-ptr))
when (and (o! view active-p) (o! view actor tree-active-p))
do (progn
(unless (eql (o! view render-pass) render-pass)
(setf render-pass (o! view render-pass))
(gl:clear :depth-buffer))
(o! view (render-view *world-drawables*)))))
(gl:flush)
(format t "draw=~S " (/ (- (sdl2:get-performance-counter) prev-profiling-tick) profiling-scale))
;; now draw to window
(gl:bind-framebuffer :framebuffer 0)
(gl:viewport 0 0 win-width win-height)
(gl:clear :color-buffer)
(gl:disable :depth-test)
(gl:enable :texture-2d)
(gl:bind-texture :texture-2d render-texture)
(gl:matrix-mode :modelview)
(gl:load-identity)
(gl:with-primitives :quads
(gl:color 1.0 1.0 1.0 1.0)
(gl:tex-coord 0.0 0.0)
(gl:vertex 0.0 0.0)
(gl:tex-coord 1.0 0.0)
(gl:vertex *view-width* 0.0)
(gl:tex-coord 1.0 1.0)
(gl:vertex *view-width* *view-height*)
(gl:tex-coord 0.0 1.0)
(gl:vertex 0.0 *view-height*))
(gl:disable :texture-2d)
(gl:flush)
(format t "blit=~S~%" (/ (- (sdl2:get-performance-counter) prev-profiling-tick) profiling-scale))
|#
(sdl2:gl-swap-window win)))
)))))