In principle, we're going to get a more flexible and powerful interface to opengl in the next month or so. It would be nice if we got better mouse support along with that.
One rather obvious issue is that it would be nice to get support for more than two buttons (including the mouse wheel, or maybe even wheels for a multi-wheeled mouse). Since this ties into J's event handling system, I'm not sure how if it could be done from user space. Another issue is that mouse coordinates are in what opengl documentation calls "window coordinates", and very little is done in opengl using window coordinates. Much more useful would be a way of manipulating using object coordinates or eye coordinates or something of that nature. The problem is that in some cases converting from window coordinates to object space coordinates can be difficult. Here's an idea for making that happen (based on what I've seen done in other software): (1) Make the mouse pointer invisible (and maybe grab its window coordinates at the start of this -- the application can convert these to approximate object space coordinates). (2) Position the mouse pointer in the center of the opengl rendering area. (3) Every time a mouse event is generated, the mouse's deltaX and deltaY are obtained and the mouse is repositioned in the center of the opengl rendering area. These deltaX and deltaY numbers (and perhaps deltaZ from the mouse wheel) would then be used to manipulate a "mouse object" which the application program would render inside the opengl window. Note that the application might have to give up control of the mouse under some circumstances (for example, under windows a person can use various key combinations to switch to another task). So I guess there would have to be a "give up the mouse" event of some sort and a "ok, you can have it back" event. Probably most of this can be managed from user space. Things I don't know about: [1] How to know when another application has gained control of the mouse. (Even if I never see anything happening there, maybe the mouse needs to be made invisible again, and repositioned in the center of the opengl isigraph control when I get control back). [2] How to make the mouse invisible in the first place. [3] How to set the mouse position in the center of the isigraph control (or, perhaps, in the center of the parent form, or the center of the screen). Popping the mouse in and out of this mode is another issue, but it's easy to think of solutions for them (hit a key or a mouse button to toggle, maybe). Call this a wishlist item. Or maybe a request for documentation? Thanks, -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
