2 * Mesa 3-D graphics library
4 * Copyright (C) 1995-2006 Brian Paul
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 * Library for glut using mesa fbdev driver
24 * Written by Sean D'Epagnier (c) 2006
31 void (*DisplayFunc
)(void) = NULL
;
32 void (*ReshapeFunc
)(int width
, int height
) = NULL
;
33 void (*KeyboardFunc
)(unsigned char key
, int x
, int y
) = NULL
;
34 void (*KeyboardUpFunc
)(unsigned char key
, int x
, int y
) = NULL
;
35 void (*MouseFunc
)(int key
, int state
, int x
, int y
) = NULL
;
36 void (*MotionFunc
)(int x
, int y
) = NULL
;
37 void (*PassiveMotionFunc
)(int x
, int y
) = NULL
;
38 void (*VisibilityFunc
)(int state
) = NULL
;
39 void (*SpecialFunc
)(int key
, int x
, int y
) = NULL
;
40 void (*SpecialUpFunc
)(int key
, int x
, int y
) = NULL
;
41 void (*IdleFunc
)(void) = NULL
;
42 void (*MenuStatusFunc
)(int state
, int x
, int y
) = NULL
;
43 void (*MenuStateFunc
)(int state
) = NULL
;
45 void glutDisplayFunc(void (*func
)(void))
50 void glutOverlayDisplayFunc(void (*func
)(void))
54 void glutWindowStatusFunc(void (*func
)(int state
))
58 void glutReshapeFunc(void (*func
)(int width
, int height
))
63 void glutKeyboardFunc(void (*func
)(unsigned char key
, int x
, int y
))
68 void glutKeyboardUpFunc(void (*func
)(unsigned char key
, int x
, int y
))
70 KeyboardUpFunc
= func
;
73 void glutMouseFunc(void (*func
)(int button
, int state
, int x
, int y
))
79 void glutMotionFunc(void (*func
)(int x
, int y
))
85 void glutPassiveMotionFunc(void (*func
)(int x
, int y
))
88 PassiveMotionFunc
= func
;
91 void glutJoystickFunc(void (*func
)(unsigned int buttonMask
,
92 int x
, int y
, int z
), int pollInterval
)
96 void glutVisibilityFunc(void (*func
)(int state
))
98 VisibilityFunc
= func
;
101 void glutEntryFunc(void (*func
)(int state
))
105 void glutSpecialFunc(void (*func
)(int key
, int x
, int y
))
110 void glutSpecialUpFunc(void (*func
)(int key
, int x
, int y
))
112 SpecialUpFunc
= func
;
115 void glutSpaceballMotionFunc(void (*func
)(int x
, int y
, int z
))
119 void glutSpaceballRotateFunc(void (*func
)(int x
, int y
, int z
))
123 void glutSpaceballButtonFunc(void (*func
)(int button
, int state
))
127 void glutButtonBoxFunc(void (*func
)(int button
, int state
))
131 void glutDialsFunc(void (*func
)(int dial
, int value
))
135 void glutTabletMotionFunc(void (*func
)(int x
, int y
))
139 void glutTabletButtonFunc(void (*func
)(int button
, int state
,
144 void glutMenuStatusFunc(void (*func
)(int status
, int x
, int y
))
146 MenuStatusFunc
= func
;
149 void glutMenuStateFunc(void (*func
)(int status
))
151 MenuStateFunc
= func
;
154 void glutIdleFunc(void (*func
)(void))
159 void glutTimerFunc(unsigned int msecs
,
160 void (*func
)(int value
), int value
)
162 struct GlutTimer
**head
= &GlutTimers
, *timer
= malloc(sizeof *timer
);
163 timer
->time
= glutGet(GLUT_ELAPSED_TIME
) + msecs
;
165 timer
->value
= value
;
167 while(*head
&& (*head
)->time
< timer
->time
)
168 head
= &(*head
)->next
;