You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Goal: Run the code in "cepl/docs/001 - Into the code.md" and perform some of the operations outlined in Baggers YouTube video "0 - CEPL - Lispy OpenGL".
Setup: I made a project using the directions in the README called "graphics", and changed the code to resolve some definition errors like those pointed out in #344 .
(eval-when (:compile-toplevel :load-toplevel :execute) (ql:quickload "graphics"))
(in-package #:graphics)
(defparameter *array* nil)
(defparameter *stream* nil)
(defparameter *running* nil)
;; Lisp data for triangle vertices
(defparameter *triangle-data*
(list (list (rtg-math:v! 0.5 -0.36 0) (rtg-math:v! 0 1 0 0))
(list (rtg-math:v! 0 0.5 0) (rtg-math:v! 1 0 0 0))
(list (rtg-math:v! -0.5 -0.36 0) (rtg-math:v! 0 0 1 0))))
;; A struct that works on gpu and cpu
(defstruct-g pos-col
(position :vec3 :accessor pos)
(color :vec4 :accessor col))
;; A GPU vertex shader using a Lisp syntax (see Varjo)
(defun-g vert ((vert pos-col))
(values (rtg-math:v! (pos vert) 1.0)
(col vert)))
;; A GPU fragment shader
(defun-g frag ((color :vec4))
color)
;; Composing those gpu functions into a pipeline
(defpipeline-g prog-1 ()
(vert pos-col)
(frag :vec4))
;; Here is what we do each frame:
(defun step-demo ()
(step-host) ;; Advance the host environment frame
(livesupport:update-repl-link) ;; Keep the REPL responsive while running
(clear) ;; Clear the drawing buffer
(map-g #'prog-1 *stream*) ;; Render data from GPU datastream
(swap)) ;; Display newly rendered buffer
(defun run-loop ()
(setf *running* t
;; Create a gpu array from our Lisp vertex data
*array* (make-gpu-array *triangle-data* :element-type 'pos-col)
;; Create a GPU datastream
*stream* (make-buffer-stream *array*))
;; continue rendering frames until *running* is set to nil
(loop :while (and *running*
(not (shutting-down-p))) :do
(livesupport:continuable (step-demo))))
(defun stop-loop ()
(setf *running* nil))
(run-loop)
Steps to reproduce error:
Open file and slime in Emacs
In the slime repl, run the following (ql:quickload :cepl.sdl2) then (cepl:repl)
Compile each top level form in the file (Using slime-compile-defun, C-c C-c)
Expected result: To have a multicolored triangle appear in the sdl2 window Actual result: The following error arises. Heap exhausted (no more space for allocation). 931987456 bytes available, 15089770976 requested.
Other methods:
There are other methods to run the code with varying results.
Other method 1: Performing the following yields the expected multicolored triangle.
Open file and slime in Emacs
In the slime repl, run the following (ql:quickload :cepl.sdl2) then (cepl:repl)
Copy and paste the code into the slime repl.
However, this does not allow me to update the triangle using pull-g and push-g as when I hit enter into the repl, an Emacs message pops up in the minibuffer saying REPL is busy.
Other method 2: First insert (cepl:repl) after (in-package #:graphics) then use slime-compile-and-load on the file results in the expected multicolored triangle. However, running (cepl:pull-g *array*) in the file and using slime-compile-defun gives the error with-gpu-array-as-*: buffer mapped to null pointer Have you defintely got an opengl context? #.(SB-SYS:INT-SAP #X00000000)
and running (cepl:pull-g *array*) in the slime repl gives the following error The variable *ARRAY* is unbound.
Other method 3:
Very similar to method 2, but use slime-eval-buffer instead of slime-compile-and-load. First insert (cepl:repl) after (in-package #:graphics) then use slime-eval-buffer on the file results in the expected multicolored triangle. However, running (cepl:pull-g *array*) in the file and using slime-compile-defun gives the error with-gpu-array-as-*: buffer mapped to null pointer Have you defintely got an opengl context? #.(SB-SYS:INT-SAP #X00000000)
and running (cepl:pull-g *array*) in the slime repl gives the following error The variable *ARRAY* is unbound.
Conclusion:
So I am unable to continue on with the next part of the video / video series.
Please let me know if I need to put more information or something is wrong stylistically. I would do anything to get this to work.
The text was updated successfully, but these errors were encountered:
Goal: Run the code in "cepl/docs/001 - Into the code.md" and perform some of the operations outlined in Baggers YouTube video "0 - CEPL - Lispy OpenGL".
Setup: I made a project using the directions in the README called "graphics", and changed the code to resolve some definition errors like those pointed out in #344 .
Steps to reproduce error:
(ql:quickload :cepl.sdl2)
then(cepl:repl)
Expected result: To have a multicolored triangle appear in the sdl2 window
Actual result: The following error arises.
Heap exhausted (no more space for allocation). 931987456 bytes available, 15089770976 requested.
Other methods:
There are other methods to run the code with varying results.
Other method 1: Performing the following yields the expected multicolored triangle.
(ql:quickload :cepl.sdl2)
then(cepl:repl)
However, this does not allow me to update the triangle using pull-g and push-g as when I hit enter into the repl, an Emacs message pops up in the minibuffer saying
REPL is busy
.Other method 2: First insert
(cepl:repl)
after(in-package #:graphics)
then useslime-compile-and-load
on the file results in the expected multicolored triangle. However, running(cepl:pull-g *array*)
in the file and using slime-compile-defun gives the errorwith-gpu-array-as-*: buffer mapped to null pointer Have you defintely got an opengl context? #.(SB-SYS:INT-SAP #X00000000)
and running
(cepl:pull-g *array*)
in the slime repl gives the following errorThe variable *ARRAY* is unbound.
Other method 3:
Very similar to method 2, but use
slime-eval-buffer
instead ofslime-compile-and-load
. First insert(cepl:repl)
after(in-package #:graphics)
then useslime-eval-buffer
on the file results in the expected multicolored triangle. However, running(cepl:pull-g *array*)
in the file and using slime-compile-defun gives the errorwith-gpu-array-as-*: buffer mapped to null pointer Have you defintely got an opengl context? #.(SB-SYS:INT-SAP #X00000000)
and running
(cepl:pull-g *array*)
in the slime repl gives the following errorThe variable *ARRAY* is unbound.
Conclusion:
So I am unable to continue on with the next part of the video / video series.
Please let me know if I need to put more information or something is wrong stylistically. I would do anything to get this to work.
The text was updated successfully, but these errors were encountered: