diff options
Diffstat (limited to '2d')
-rw-r--r-- | 2d/font.scm | 12 | ||||
-rw-r--r-- | 2d/shader.scm | 5 | ||||
-rw-r--r-- | 2d/sprite.scm | 12 |
3 files changed, 15 insertions, 14 deletions
diff --git a/2d/font.scm b/2d/font.scm index 0917e66..3f4674f 100644 --- a/2d/font.scm +++ b/2d/font.scm @@ -59,13 +59,11 @@ (define (enable-fonts) (SDL:ttf-init) (set! font-shader - (make-shader-program - (load-vertex-shader - (string-append %pkgdatadir - "/shaders/font-vertex.glsl")) - (load-fragment-shader - (string-append %pkgdatadir - "/shaders/font-fragment.glsl"))))) + (load-shader-program + (string-append %pkgdatadir + "/shaders/font-vertex.glsl") + (string-append %pkgdatadir + "/shaders/font-fragment.glsl")))) (define-record-type <font> (make-font ttf point-size) diff --git a/2d/shader.scm b/2d/shader.scm index d8b165e..0be977f 100644 --- a/2d/shader.scm +++ b/2d/shader.scm @@ -42,6 +42,7 @@ shader-type shader-id make-shader-program + load-shader-program shader-program-id shader-program? shader-program-linked? @@ -217,6 +218,10 @@ VERTEX-SHADER and FRAGMENT-SHADER." shaders) shader-program)) +(define (load-shader-program vertex-shader-file-name fragment-shader-file-name) + (make-shader-program (load-vertex-shader vertex-shader-file-name) + (load-fragment-shader fragment-shader-file-name))) + (define current-shader-program (make-parameter #f)) (define-syntax-rule (with-shader-program shader-program body ...) diff --git a/2d/sprite.scm b/2d/sprite.scm index c3dc4f1..39bc746 100644 --- a/2d/sprite.scm +++ b/2d/sprite.scm @@ -68,13 +68,11 @@ (define (enable-sprites) (set! sprite-shader - (make-shader-program - (load-vertex-shader - (string-append %pkgdatadir - "/shaders/sprite-vertex.glsl")) - (load-fragment-shader - (string-append %pkgdatadir - "/shaders/sprite-fragment.glsl"))))) + (load-shader-program + (string-append %pkgdatadir + "/shaders/sprite-vertex.glsl") + (string-append %pkgdatadir + "/shaders/sprite-fragment.glsl")))) ;; The <sprite> type represents a drawable object (texture, ;; texture-region, animation, etc.) with a given position, scale, |