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
29 #include <GL/glfbdev.h>
31 #define MULTIHEAD /* enable multihead hacks,
32 it allows the program to continue drawing
33 without reading input when a second fbdev
34 has keyboard focus it can cause
35 screen corruption that requires C-l to fix */
40 /* this causes these symbols to not be exported */
41 #pragma GCC visibility push(hidden)
44 /* --------- fbdev ------------ */
47 extern int VisibleSwitch
;
49 extern int VisiblePoll
;
50 extern int Swapping
, VTSwitch
;
52 void TestVisible(void);
53 int ParseFBModes(int, int, int, int, int, int);
54 void SetVideoMode(void);
55 void CreateBuffer(void);
56 void CreateVisual(void);
58 extern int FrameBufferFD
;
59 extern unsigned char *FrameBuffer
;
60 extern unsigned char *BackBuffer
;
61 extern int DisplayMode
;
63 extern char exiterror
[256];
65 extern struct fb_fix_screeninfo FixedInfo
;
66 extern struct fb_var_screeninfo VarInfo
;
68 extern GLFBDevContextPtr Context
;
69 extern GLFBDevBufferPtr Buffer
;
70 extern GLFBDevVisualPtr Visual
;
72 /* --- colormap --- */
73 #define REVERSECMAPSIZELOG 3
74 #define REVERSECMAPSIZE (1<<REVERSECMAPSIZELOG)
76 extern unsigned short RedColorMap
[256],
79 extern unsigned char ReverseColorMap
[REVERSECMAPSIZE
]
83 void LoadColorMap(void);
84 void RestoreColorMap(void);
87 extern int MouseX
, MouseY
;
88 extern int CurrentCursor
;
89 extern int MouseVisible
;
90 extern int LastMouseTime
;
91 extern int NumMouseButtons
;
93 void InitializeCursor(void);
94 void EraseCursor(void);
95 void DrawCursor(void);
96 void SwapCursor(void);
112 extern struct GlutMenu
*Menus
;
114 extern int ActiveMenu
;
115 extern int CurrentMenu
;
117 void InitializeMenus(void);
118 void FreeMenus(void);
119 void DrawMenus(void);
121 int TryMenu(int, int);
123 void CloseMenu(void);
126 extern int AccumSize
, DepthSize
, StencilSize
, NumSamples
;
127 extern struct timeval StartTime
;
128 extern int KeyboardModifiers
;
135 extern int CurrentVT
;
136 extern int ConsoleFD
;
138 extern double MouseSpeed
;
140 extern int KeyRepeatMode
;
142 void InitializeVT(int);
143 void RestoreVT(void);
144 void CloseMouse(void);
145 void InitializeMouse(void);
147 void ReceiveInput(void);
149 /* --- callback --- */
150 extern void (*DisplayFunc
)(void);
151 extern void (*ReshapeFunc
)(int width
, int height
);
152 extern void (*KeyboardFunc
)(unsigned char key
, int x
, int y
);
153 extern void (*KeyboardUpFunc
)(unsigned char key
, int x
, int y
);
154 extern void (*MouseFunc
)(int key
, int state
, int x
, int y
);
155 extern void (*MotionFunc
)(int x
, int y
);
156 extern void (*PassiveMotionFunc
)(int x
, int y
);
157 extern void (*VisibilityFunc
)(int state
);
158 extern void (*SpecialFunc
)(int key
, int x
, int y
);
159 extern void (*SpecialUpFunc
)(int key
, int x
, int y
);
160 extern void (*IdleFunc
)(void);
161 extern void (*MenuStatusFunc
)(int state
, int x
, int y
);
162 extern void (*MenuStateFunc
)(int state
);
169 struct GlutTimer
*next
;
172 extern struct GlutTimer
*GlutTimers
;
174 /* ------- Game Mode -------- */
177 #pragma GCC visibility pop