diff options
author | David Thompson <dthompson2@worcester.edu> | 2014-05-22 21:20:13 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2014-05-22 21:39:25 -0400 |
commit | 2b656ad8fcafc1ebaaa7fe154f015e85b9dbd941 (patch) | |
tree | 0c4cd01e19896403b2645927431bd1aa7e59ea3d /2d | |
parent | cc5051e85c6491f54438ee62573953107c916fff (diff) |
Rename, unexport, and memoize shader-program-attribute-location.
* 2d/shader.scm (shader-program-attribute-location): Rename.
(attribute-location): Memoize.
Diffstat (limited to '2d')
-rw-r--r-- | 2d/shader.scm | 12 |
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 |