Skip to content

Instantly share code, notes, and snippets.

View sgithens's full-sized avatar

Steven Githens sgithens

View GitHub Profile
@sgithens
sgithens / gl-shader-setup.lisp
Created January 9, 2025 02:28
Passing lisp strings in to c functions
(defvar vertexSource "attribute vec4 position;
varying vec3 color;
void main()
{
gl_Position = vec4(position.xyz, 1.0);
color = gl_Position.xyz + vec3(0.5);
}")
(gl:shader-source vertex-shader vertexSource)
@sgithens
sgithens / build.sh
Created January 4, 2025 02:45 — forked from devappd/build.sh
Minimal OpenGL Emscripten example
mkdir -p bin
emcc -o bin/main.html main.cpp -s USE_SDL=2 -s FULL_ES2=1 -s SINGLE_FILE=1
emcc -o bin/main-asyncify.html main.cpp -s USE_SDL=2 -s FULL_ES2=1 -s ASYNCIFY=1 -s SINGLE_FILE=1
@sgithens
sgithens / make.sh
Created January 2, 2025 01:15
checking out building wasm ecl
#!/bin/bash
function build () {
# Build host ECL
git clone https://gitlab.com/embeddable-common-lisp/ecl.git
pushd ecl
./configure ABI=32 CFLAGS="-m32 -g -O2 -DECL_C_COMPATIBLE_VARIADIC_DISPATCH" LDFLAGS="-m32 -g -O2" \
--prefix=`pwd`/ecl-emscripten-host --disable-threads
make -j16 && make install
rm -rf build/
@sgithens
sgithens / gl-functions.txt
Created January 1, 2025 00:35
Current gl usage in boxer
(%gl:uniform-block-binding glyph-program (gl:get-uniform-block-index glyph-program "Matrices") 0)
(gl::gl-array-pointer arr))
(gl::gl-array-pointer arr))
(gl:active-texture :texture0)
(gl:alloc-gl-array :float (length vertices))))
(gl:attach-shader canvas-program (create-shader vertex-shader :vertex-shader))
(gl:bind-buffer :array-buffer canvas-buffer)
(gl:bind-framebuffer :framebuffer (graphics-canvas-framebuffer togo))
(gl:bind-texture :texture-2d texture-id)
(gl:bind-vertex-array canvas-vao)
@sgithens
sgithens / repaint-pass-2.lisp.diff
Created December 21, 2024 19:54
Focus on Current Box prototype
sgithens@Stevens-MBP boxer-sunrise % gd src/redisplay/repaint-pass-2.lisp
diff --git a/src/redisplay/repaint-pass-2.lisp b/src/redisplay/repaint-pass-2.lisp
index a7d7f0b..f6cca70 100644
--- a/src/redisplay/repaint-pass-2.lisp
+++ b/src/redisplay/repaint-pass-2.lisp
@@ -198,11 +198,26 @@
hei)
(draw-boxtop self boxtop actual-obj 0 0 wid hei))))))
(t ;; have to draw any background BEFORE inferiors
+ (when (eq (point-screen-box) self)
@sgithens
sgithens / notes.txt
Created November 23, 2024 05:45
2024-02 Boxer ECL/WASM Notes
Notes from building emscripten
apt-get install build-essentials libgmp-dev gcc-multilib m4
emsdk install 3.1.11
emsdk activate 3.1.11
ecl stable version is 3.1.41
latest is 3.1.52
source ~/code/emsdk/emsdk_env.sh
@sgithens
sgithens / draft.lisp
Created October 10, 2024 14:47
repaint rotate demo draft
(defvar *xxx-rot* 0) ;pi)
(defvar *yyy-rot* 0) ;25)
(defvar *zzz-rot* 0) ;pi)
(defvar *xxx-index* 0)
(defvar *yyy-index* 0)
(defvar *zzz-index* -1900)
(defvar *box-depth-mult* 5)
@sgithens
sgithens / phoenix.js
Created June 30, 2024 20:09
phoenix.js config
// Preferences
Phoenix.set({
daemon: false,
openAtLogin: true,
});
// Globals
const HIDDEN_DOCK_MARGIN = 3;
const INCREMENT = 0.05;
const CONTROL_SHIFT = ['control', 'shift'];
@sgithens
sgithens / 2023-10-03-boxer.sbcl.diff
Created October 4, 2023 01:54
Hacking to get all of current Boxer source to load/compile in to SBCL with asdf and fail on an actual unit test
diff --git a/boxer-sunrise-test.asd b/boxer-sunrise-test.asd
index 212c92a..9466ba6 100644
--- a/boxer-sunrise-test.asd
+++ b/boxer-sunrise-test.asd
@@ -21,7 +21,7 @@
(:test-file "alternate-names-tests")
;; (:test-file "chunker-tests")
(:test-file "vrtdef-tests")
- (:test-file "loader-tests")
+ ; (:test-file "loader-tests")
@sgithens
sgithens / graphics-command.lisp
Created September 18, 2023 19:53
Boxer Historical Graphics Commands
;;;;
;;;; Boxer
;;;; Copyright 1985-2022 Andrea A. diSessa and the Estate of Edward H. Lay
;;;;
;;;; Portions of this code may be copyright 1982-1985 Massachusetts Institute of Technology. Those ;;;; portions may be
;;;; used for any purpose, including commercial ones, providing that notice of MIT copyright is ;;;; retained.
;;;;
;;;; Licensed under the 3-Clause BSD license. You may not use this file except in compliance with ;;;; this license.
;;;;
;;;; https://opensource.org/licenses/BSD-3-Clause