diff options
author | David Thompson <dthompson2@worcester.edu> | 2015-03-11 19:56:14 -0400 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2015-03-11 22:27:09 -0400 |
commit | 09fd03e14729ea929ecc3428ccfe091fa8c8deba (patch) | |
tree | 4ee06e4695ef9d0b216d3e24386de2184847c97e | |
parent | dc9b75efadbf7580a99bc660118eb260d4c7c30c (diff) |
render: context: Add GL parameter type.
* sly/render/context.scm (<gl-parameter>): New record type.
(%make-gl-parameter, make-gl-parameter, gl-parameter?,
gl-parameter-default, gl-parameter-bind, gl-parameter-ref,
%gl-parameter-set!, gl-parameter-set!, gl-parameter-reset!): New
procedures.
Fixup gl-parameter
-rw-r--r-- | sly/render/context.scm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sly/render/context.scm b/sly/render/context.scm index 0e96e26..aec04b0 100644 --- a/sly/render/context.scm +++ b/sly/render/context.scm @@ -43,6 +43,24 @@ render-context-shader set-render-context-shader! render-context-mesh set-render-context-mesh!)) +(define-record-type <gl-parameter> + (%make-gl-parameter default bind value) + gl-parameter? + (default gl-parameter-default) + (bind gl-parameter-bind) + (value gl-parameter-ref %gl-parameter-set!)) + +(define (make-gl-parameter default bind) + (%make-gl-parameter default bind default)) + +(define* (gl-parameter-set! parameter value #:optional force?) + (unless (and (not force?) (equal? (gl-parameter-ref parameter) value)) + (%gl-parameter-set! parameter value) + ((gl-parameter-bind parameter) value))) + +(define (gl-parameter-reset! parameter) + (gl-parameter-set! parameter (gl-parameter-default parameter) #t)) + (define-record-type <render-context> (%make-render-context blend-mode depth-test? texture shader mesh transform-stack) |