Hi
the attached patch does two things: 1) it adds glu:build-2d-mipmaps 2) as suggested earlier this month, more mouse-buttons are now recognized (:wheel-up, :wheel-down and :button4 to :button7)
i'd be happy to see it applied
cupe
{ hunk ./glu/glu.lisp 95 -;;; TODO: gluBuild{1,2,3}DMipmaps; gluBuildP1,2,3}DMipmapLevels +;;; TODO: gluBuild{1,3}DMipmaps; gluBuildP1,3}DMipmapLevels + + +(defcfun ("gluBuild2DMipmaps" %GluBuild2DMipmaps) :void + (target %gl:enum) + (internalformat %gl:int) + (width %gl:sizei) + (height %gl:sizei) + (format %gl:enum) + (type %gl:enum) + (data :pointer)) + + +(defun build-2d-mipmaps (target internal-format width height format type data) + (let ((internal-size (gl::internal-format->int internal-format))) + (if (pointerp data) + (%gluBuild2dMipmaps target internal-size width height format type data) + (cl-opengl::with-pixel-array (array type data) + (%gluBuild2dMipmaps target internal-size width height format type array))))) hunk ./glu/package.lisp 43 + #:build-2d-mipmaps hunk ./glut/callbacks.lisp 183 - :right-button) + :right-button + :wheel-up + :wheel-down + :button4 + :button5 + :button6 + :button7) }
I can't speak for the 2D texture section of your patch but none of the new enums in callbacks work for me.
hunk ./glut/callbacks.lisp 183
- :right-button)
- :right-button
- :wheel-up
- :wheel-down
- :button4
- :button5
- :button6
- :button7)
}
I tested with code like:
(defmethod glut:mouse ((w gl-window) button state x y) (declare (ignore x y)) (format t "~&Button value is ~a ~%Pressed value is ~a~%" button state)) (defmethod glut:mouse-wheel ((w gl-window) button pressed x y) (declare (ignore x y)) (format t "~&Button value is ~a ~%Pressed value is ~a~%" button pressed))
I can't speak for the 2D texture section of your patch but none of the new enums in callbacks work for me.
(defmethod glut:mouse ((w gl-window) button state x y) (declare (ignore x y)) (format t "~&Button value is ~a ~%Pressed value is ~a~%" button state))
after pasting your glut:mouse into my project, i get:
Button value is WHEEL-DOWN Pressed value is DOWN Button value is WHEEL-DOWN Pressed value is UP
when moving the wheel downward. and:
Button value is BUTTON6 Pressed value is DOWN
when pressing down one of the weird buttons on my mouse. as it should be.
i use opengl 2.1.1 on linux with freeglut 2.4.0. the new enums are not to be found in my freeglut_std.h along with the other ones, which makes it kind of odd that they work for me. sdl uses buttons 4 and 5 as wheel-up/down, too, which is why i tried this in the first place. they seem not to be "officially" supported on windows either as there is a patch for a windows port of glut to make it mousewheel-aware at all at http://www.realmtech.net/opengl/glut.php , providing the very same enums.
i found several references on the net indicating the widespread use of 4 and 5 for the wheel and think it is safe to just add the enums to the bindings. those with an older version of glut seem to not have wheel functionality anyway and won't be hurt by this.
i use opengl 2.1.1 on linux with freeglut 2.4.0. the new enums are not to be found in my freeglut_std.h along with the other ones, which makes it kind of odd that they work for me. sdl uses buttons 4 and 5 as wheel-up/down, too, which is why i tried this in the first place. they seem not to be "officially" supported on windows either as there is a patch for a windows port of glut to make it mousewheel-aware at all at http://www.realmtech.net/opengl/glut.php , providing the very same enums.
This is interesting. Are you sure your system is configured to use freeglut? I ask only because the windows glut you link to is definitely not freeglut. My freeglut-2.4.0 provides a libglut-3.8.0.so lib file. Second are you using cl-opengl-thomas? I queried my mice with xinput and the wheel is mapped to buttons 4 and 5 however my system only provides the enums in the freeglut headers
charlie mac
Are you sure your system is configured to use freeglut?
yes, i am definitely using the libglut-3.8.0.so of freeglut-2.4.0 (at least that is what lsof tells me).
Second are you using cl-opengl-thomas?
yep, like everybody else, i guess. actually i didn't test the patch against the main branch. maybe i should have said so in my initial post :)
I queried my mice with xinput and the wheel is mapped to buttons 4 and 5 however my system only provides the enums in the freeglut headers
is your graphics card an ati card by any chance? maybe the proprietary nvidia driver i use is handling the mouse events in a different way than other drivers and freeglut just passes along what it gets? i don't know anything about the relationships of the graphics card driver and the glu(t) and opengl libraries, so this is just a guess. but from what i've seen of the linux ati driver so far it wouldn't suprise me if it dropped all but the first three of the mouse buttons.
Yes I do have an ATI card but GLUT uses X for mouse handling so it shouldn't matter. I've since taken a brief look at the freeglut code and it looks like they have quick-hackish ways of detecting mouse features. Either that or freeglut can't handle my slightly bleeding edge Xorg-server. Anyway, I think I've hit the ceiling with glut with what I want to do in my app and should probably bite the bullet and retry cells+togl or cells+gtk. If only cl-clx worked with cl-opengl. sigh.
On 10/02/2008, Charlie McMackin charliemac+cl-opengl@gmail.com wrote:
(defmethod glut:mouse ((w gl-window) button state x y) (declare (ignore x y)) (format t "~&Button value is ~a ~%Pressed value is ~a~%" button state)) (defmethod glut:mouse-wheel ((w gl-window) button pressed x y) (declare (ignore x y)) (format t "~&Button value is ~a ~%Pressed value is ~a~%" button pressed))
I looked at freeglut's source and it seems that whenever the mouse-wheel callback is deactivated, mouse is called instead. And the 'button' argument (and the state/pressed argument as well, IIRC) differs in each case. So if you want to get those new enums, use glut:mouse only, not glut-mouse-wheel.
Johann Korndoerfer cupe-clopengl@erleuchtet.org writes:
the attached patch does two things:
I think the patch is missing some bits so I had to apply the changes manually.
- it adds glu:build-2d-mipmaps
- as suggested earlier this month, more mouse-buttons are now
recognized (:wheel-up, :wheel-down and :button4 to :button7)
Applied, thanks.
cl-opengl-devel@common-lisp.net