summaryrefslogtreecommitdiff
path: root/2d/shader.scm
diff options
context:
space:
mode:
Diffstat (limited to '2d/shader.scm')
-rw-r--r--2d/shader.scm12
1 files changed, 7 insertions, 5 deletions
diff --git a/2d/shader.scm b/2d/shader.scm
index 1ed18bd..4fffcb3 100644
--- a/2d/shader.scm
+++ b/2d/shader.scm
@@ -46,7 +46,6 @@
shader-program-id
shader-program?
shader-program-linked?
- shader-program-attribute-location
with-shader-program
%uniform-setters
register-uniform-setter!
@@ -233,10 +232,6 @@ VERTEX-SHADER and FRAGMENT-SHADER."
(glUseProgram 0)
return-value))))
-(define (shader-program-attribute-location program name)
- "Get the location of the attribute NAME within the shader PROGRAM."
- (glGetAttribLocation (shader-program-id program) name))
-
(define-record-type <uniform-setter>
(make-uniform-setter predicate proc)
uniform-setter?
@@ -291,6 +286,13 @@ location."
(glGetUniformLocation (shader-program-id shader-program)
(symbol->string name)))))
+(define attribute-location
+ (memoize
+ (lambda (shader-program name)
+ "Retrieve the location for the uniform NAME within SHADER-PROGRAM."
+ (glGetAttribLocation (shader-program-id shader-program)
+ (symbol->string name)))))
+
(define (uniform-set! shader-program name value)
"Use the appropriate setter procedure to translate VALUE into OpenGL
compatible data and assign it to the location of the uniform NAME