Created
April 20, 2018 03:27
-
-
Save psilord/cd713561d06ec5e609b5141fd1b756b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun doit () | |
;; This goes in INITIALIZE-COMPONENT | |
(let ((vao (gl:gen-vertex-array)) | |
(vbo (gl:gen-buffer)) | |
(buffer (static-vectors:make-static-vector | |
1 :element-type '(integer 0 255) | |
:initial-element 0))) | |
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Bind the VAO | |
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(gl:bind-vertex-array vao) | |
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; bind buffer in terms of this vao | |
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(gl:bind-buffer :array-buffer vbo) | |
;; position/uv data -> GPU | |
(%gl:buffer-data :array-buffer (* (length buffer) 1) ;; 1 sizeof :byte | |
(static-vectors:static-vector-pointer buffer) | |
:static-draw) | |
;; Free the memory, don't need it anymore. | |
(static-vectors:free-static-vector buffer) | |
;; No need to do gl:enable-vertex-attrib-array or | |
;;gl:vertex-attrib-pointer since we're not defining any attributes. | |
;; This goes in RENDER-COMPONENT | |
;; Now draw it | |
;; setup opengl, and a frame, and clear it | |
(gl:bind-vertex-array vao) | |
;; bind shaders, materials properties, etc, etc. | |
(gl:draw-arrays :points 0 1))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment