WebGL plumbing

This commit is contained in:
David Botton 2022-08-08 22:14:11 -04:00
parent a9f7a875f5
commit 47804e2b7b
4 changed files with 45 additions and 1 deletions

View file

@ -24,6 +24,7 @@
(:file "clog-element-common")
(:file "clog-style")
(:file "clog-canvas")
(:file "clog-webgl")
(:file "clog-form")
(:file "clog-multimedia")
(:file "clog-window")

View file

@ -61,7 +61,6 @@
(format nil "clog['~A']=clog['~A'].getContext('2d')"
web-id
(html-id obj)))
(make-instance 'clog-context2d
:connection-id (connection-id obj)
:html-id web-id)))

37
source/clog-webgl.lisp Normal file
View file

@ -0,0 +1,37 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; CLOG - The Common Lisp Omnificent GUI ;;;;
;;;; (c) 2020-2021 David Botton ;;;;
;;;; License BSD 3 Clause ;;;;
;;;; ;;;;
;;;; clog-webgl.lisp ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(cl:in-package :clog)
;; Use clog-canvas to create the html element and then use clog-webgl
;; to obtain the WebGL2 context
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Implementation - clog-webgl
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defclass clog-webgl (clog-obj)())
;;;;;;;;;;;;;;;;;;
;; create-webgl ;;
;;;;;;;;;;;;;;;;;;
(defgeneric create-webgl (clog-canvas)
(:documentation "Create a new CLOG-WebGL from a CLOG-Canvas"))
(defmethod create-webgl ((obj clog-canvas))
(let ((web-id (clog-connection:generate-id)))
(clog-connection:execute (connection-id obj)
(format nil "clog['~A']=clog['~A'].getContext('webgl2')"
web-id
(html-id obj)))
(make-instance 'clog-context2d
:connection-id (connection-id obj)
:html-id web-id)))

View file

@ -44,6 +44,7 @@ embedded in a native template application.)"
(@clog-style-block section)
(@clog-form section)
(@clog-canvas section)
(@clog-webgl section)
(@clog-multimedia section)
(@clog-auth section)
(@clog-gui section)
@ -125,6 +126,7 @@ embedded in a native template application.)"
"CLOG-Obj - Internals for Extensions and Plugins"
(html-id generic-function)
(script-id generic-function)
(execute generic-function)
(query generic-function)
(js-execute generic-function)
@ -768,6 +770,11 @@ embedded in a native template application.)"
(canvas-save generic-function)
(canvas-restore generic-function))
(defsection @clog-webgl (:title "CLOG WebGL Objects")
"CLOG-WebGL - Class for CLOG WebGL objects"
(clog-webgl class)
(create-webgl generic-function))
(defsection @clog-multimedia (:title "CLOG Multimedia Objects")
"CLOG-Multimedia - Base Class for CLOG multimedia objects"
(clog-multimedia class)