Fix bitrot in {push,pop}{,-client}-attrib and implement with-pushed-* macros
Sun Jul 6 13:37:38 PDT 2008 Luis Oliveira <loliveira@common-lisp.net>
* Fix bitrot in {push,pop}{,-client}-attrib and implement with-pushed-* macros
Warning: CRC errors found. These are probably harmless but should be repaired.
See 'darcs gzcrcs --help' for more information.
diff -rN -u old-cl-opengl/gl/package.lisp new-cl-opengl/gl/package.lisp
--- old-cl-opengl/gl/package.lisp 2014-07-29 13:53:35.000000000 -0700
+++ new-cl-opengl/gl/package.lisp 2014-07-29 13:53:35.000000000 -0700
@@ -307,8 +307,10 @@
;; 6.1.15 Saving and Restoring State
#:push-attrib
#:push-client-attrib
+ #:with-pushed-attrib
#:pop-attrib
#:pop-client-attrib
+ #:with-pushed-client-attrib
;; Extensions
#:is-renderbuffer-ext
#:bind-renderbuffer-ext
diff -rN -u old-cl-opengl/gl/state.lisp new-cl-opengl/gl/state.lisp
--- old-cl-opengl/gl/state.lisp 2014-07-29 13:53:35.000000000 -0700
+++ new-cl-opengl/gl/state.lisp 2014-07-29 13:53:35.000000000 -0700
@@ -455,8 +455,8 @@
(let ((max-shaders (get-program program :attached-shaders)))
(with-foreign-object (shaders '%gl:uint max-shaders)
(%gl:get-attached-shaders program max-shaders (null-pointer) shaders)
- (loop for i below max-shaders
- collecting (mem-aref shaders '%gl:uint i)))))
+ (loop for i below max-shaders
+ collecting (mem-aref shaders '%gl:uint i)))))
(defun get-shader-info-log (shader)
"Returns as a string the entire info log for SHADER"
@@ -489,19 +489,35 @@
;; external
(defun push-attrib (&rest attributes)
(declare (dynamic-extent attributes))
- (%gl:push-attrib (make-bitfield 'server-attributes attributes)))
+ (%gl:push-attrib (make-bitfield '%gl:enum attributes)))
(define-compiler-macro push-attrib (&whole form &rest attributes)
(if (every #'keywordp attributes)
- `(%gl:push-attrib ,(make-bitfield 'server-attributes attributes))
+ `(%gl:push-attrib ,(make-bitfield '%gl:enum attributes))
form))
+(import-export %gl:pop-attrib)
+
+(defmacro with-pushed-attrib ((&rest attributes) &body body)
+ `(progn
+ (push-attrib ,@attributes)
+ (multiple-value-prog1 (progn ,@body)
+ (pop-attrib))))
+
;; external
(defun push-client-attrib (&rest attributes)
(declare (dynamic-extent attributes))
- (%gl:push-client-attrib (make-bitfield 'client-attributes attributes)))
+ (%gl:push-client-attrib (make-bitfield '%gl:enum attributes)))
(define-compiler-macro push-client-attrib (&whole form &rest attributes)
(if (every #'keywordp attributes)
- `(%gl:push-client-attrib ,(make-bitfield 'client-attributes attributes))
+ `(%gl:push-client-attrib ,(make-bitfield '%gl:enum attributes))
form))
+
+(import-export %gl:pop-client-attrib)
+
+(defmacro with-pushed-client-attrib ((&rest attributes) &body body)
+ `(progn
+ (push-client-attrib ,@attributes)
+ (multiple-value-prog1 (progn ,@body)
+ (pop-client-attrib))))