1 /* gltrackball, Copyright (c) 2002 Jamie Zawinski <jwz@jwz.org>
2 * GL-flavored wrapper for trackball.c
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation. No representations are made about the suitability of this
9 * software for any purpose. It is provided "as is" without express or
13 #ifndef __GLTRACKBALL_H__
14 #define __GLTRACKBALL_H__
16 typedef struct trackball_state trackball_state;
18 /* Returns a trackball_state object, which encapsulates the stuff necessary
19 to make dragging the mouse on the window of a GL program do the right thing.
21 extern trackball_state *gltrackball_init (void);
23 /* Begin tracking the mouse: Call this when the mouse button goes down.
24 x and y are the mouse position relative to the window.
25 w and h are the size of the window.
27 extern void gltrackball_start (trackball_state *, int x, int y, int w, int h);
29 /* Track the mouse: Call this each time the mouse moves with the button down.
30 x and y are the new mouse position relative to the window.
31 w and h are the size of the window.
33 extern void gltrackball_track (trackball_state *, int x, int y, int w, int h);
35 /* Execute the rotations current encapsulated in the trackball_state:
36 this does something analagous to glRotatef().
38 extern void gltrackball_rotate (trackball_state *);
40 #endif /* __GLTRACKBALL_H__ */