[cl-opengl-devel] Find out the current matrix-mode?

Jakob Reschke jakob at resfarm.de
Mon Jun 29 18:13:18 UTC 2009


Hello everybody,

I dug a little into CFFI now to solve my selection problem and I got
it to work with %gl:selection-buffer. (thread "Is this project
alive?")

However now I am facing another problem: how do I find out the current
matrix mode (I want to save it for later return)? gl:get-integer and
cl-opengl-bindings::get-integer-v don't seem to return usable values:

CL-USER> (mapcar (lambda (mode)
		   (matrix-mode mode)
		   (list mode (get-integer :matrix-mode)))
		 '(:modelview :texture :projection))
((:MODELVIEW 0) (:TEXTURE 0) (:PROJECTION 0))
CL-USER> (mapcar (lambda (mode)
		   (matrix-mode mode)
		   (list mode (get-integer :matrix-mode)))
		 '(:modelview :texture :projection))
((:MODELVIEW 0) (:TEXTURE 0) (:PROJECTION 0))
CL-USER> (with-foreign-object (mm :int)
	   (mapcar (lambda (mode)
		     (matrix-mode mode)
		     (load-identity)
		     (cl-opengl-bindings::get-integer-v #xBA0 mm) ; #xBA0 is
:matrix-mode according to constants.lisp
		     (list mode (mem-ref mm :int)))
		   '(:modelview :texture :projection)))
((:MODELVIEW 690846) (:TEXTURE 690846) (:PROJECTION 690846))
CL-USER> (with-foreign-object (mm :int)
	   (mapcar (lambda (mode)
		     (matrix-mode mode)
		     (load-identity)
		     (cl-opengl-bindings::get-integer-v #xBA0 mm)
		     (list mode (mem-ref mm :int)))
		   '(:modelview :texture :projection)))
((:MODELVIEW 281840) (:TEXTURE 281840) (:PROJECTION 281840))
CL-USER> (with-foreign-object (mm :int)
	   (mapcar (lambda (mode)
		     (matrix-mode mode)
		     (load-identity)
		     (cl-opengl-bindings::get-integer-v #xBA0 mm)
		     (list mode (mem-aref mm :int)))     ; now with mem-aref instead
of mem-ref
		   '(:modelview :texture :projection)))
((:MODELVIEW 675676) (:TEXTURE 675676) (:PROJECTION 675676))
CL-USER> (with-foreign-object (mm :int)
	   (mapcar (lambda (mode)
		     (matrix-mode mode)
		     (load-identity)
		     (cl-opengl-bindings::get-integer-v #xBA0 mm)
		     (list mode (mem-aref mm :int)))
		   '(:modelview :texture :projection)))
((:MODELVIEW 671420) (:TEXTURE 671420) (:PROJECTION 671420))
CL-USER>

Obviously there it is not the matrix mode which is returned, what am I
doing wrong?

Thank you in advance,
best regards
Jakob

-- 
I would like E-Mails beeing encrypted with OpenPGP. You can find my
public key here: http://jayk.resfarm.de/key.txt




More information about the cl-opengl-devel mailing list