Skip to content

Instantly share code, notes, and snippets.

(in-package :cl-user)
;; -- RUNNING INSTRUCTIONS --
;; (ql:quickload '(:sdl2 :cl-opengl))
;; (load "glconsingdemo.lisp")
;; (basic-test)
(require :sdl2)
(require :cl-opengl)
@realark
realark / image-builder.lisp
Created November 20, 2019 21:44
close and re-open foreign libraries on lisp images
(let ((%loaded-libraries% (list)))
(defun %pre-image-save ()
(loop :for library :in (cffi:list-foreign-libraries :loaded-only t) :do
(format T "close foreign lib: ~A~%" library)
(push (cffi:foreign-library-name library) %loaded-libraries%)
(cffi:close-foreign-library library)))
(defun %post-image-load ()
(loop :while %loaded-libraries% :do
(let ((library-name (pop %loaded-libraries%)))
@realark
realark / instance-render.lisp
Created November 11, 2019 22:34
opengl instanced rendering with common lisp
;;;; Proof-of-concept for opengl instance rendering using cl-opengl
(eval-when (:compile-toplevel :load-toplevel)
(ql:quickload '(:cl-opengl :sdl2 :cl-soil :glkit)))
(defpackage :ark.gl
(:use :cl))
(in-package :ark.gl)
(require :sdl2)
(require :cl-opengl)
@realark
realark / ctriangle.cpp
Last active April 24, 2024 05:10
opengl hello triangle on c++ and common lisp
#include <iostream>
#include <string>
#include <GL/glew.h>
#include <GL/glu.h>
#include <SDL2/SDL.h>
// compile and run:
// rm csdlopengl ; gcc -o csdlopengl ctraingle.cpp -lSDL2 -lGLEW -lstdc++ -lGL && ./csdlopengl