cell: checkpoint: more work in emit_function_call()
[mesa.git] / src / glut / fbdev / ext.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.5
4 * Copyright (C) 1995-2006 Brian Paul
5 *
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.
10 *
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.
15 *
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.
19 */
20
21 /*
22 * Library for glut using mesa fbdev driver
23 *
24 * Written by Sean D'Epagnier (c) 2006
25 */
26
27 #include <stdio.h>
28
29 #include <GL/gl.h>
30 #include <GL/glut.h>
31
32 #include "internal.h"
33
34 void glutReportErrors(void)
35 {
36 GLenum error;
37
38 while ((error = glGetError()) != GL_NO_ERROR)
39 sprintf(exiterror, "GL error: %s", gluErrorString(error));
40 }
41
42 static struct {
43 const char *name;
44 const GLUTproc address;
45 } glut_functions[] = {
46 { "glutInit", (const GLUTproc) glutInit },
47 { "glutInitDisplayMode", (const GLUTproc) glutInitDisplayMode },
48 { "glutInitWindowPosition", (const GLUTproc) glutInitWindowPosition },
49 { "glutInitWindowSize", (const GLUTproc) glutInitWindowSize },
50 { "glutMainLoop", (const GLUTproc) glutMainLoop },
51 { "glutCreateWindow", (const GLUTproc) glutCreateWindow },
52 { "glutCreateSubWindow", (const GLUTproc) glutCreateSubWindow },
53 { "glutDestroyWindow", (const GLUTproc) glutDestroyWindow },
54 { "glutPostRedisplay", (const GLUTproc) glutPostRedisplay },
55 { "glutSwapBuffers", (const GLUTproc) glutSwapBuffers },
56 { "glutGetWindow", (const GLUTproc) glutGetWindow },
57 { "glutSetWindow", (const GLUTproc) glutSetWindow },
58 { "glutSetWindowTitle", (const GLUTproc) glutSetWindowTitle },
59 { "glutSetIconTitle", (const GLUTproc) glutSetIconTitle },
60 { "glutPositionWindow", (const GLUTproc) glutPositionWindow },
61 { "glutReshapeWindow", (const GLUTproc) glutReshapeWindow },
62 { "glutPopWindow", (const GLUTproc) glutPopWindow },
63 { "glutPushWindow", (const GLUTproc) glutPushWindow },
64 { "glutIconifyWindow", (const GLUTproc) glutIconifyWindow },
65 { "glutShowWindow", (const GLUTproc) glutShowWindow },
66 { "glutHideWindow", (const GLUTproc) glutHideWindow },
67 { "glutFullScreen", (const GLUTproc) glutFullScreen },
68 { "glutSetCursor", (const GLUTproc) glutSetCursor },
69 { "glutWarpPointer", (const GLUTproc) glutWarpPointer },
70 { "glutEstablishOverlay", (const GLUTproc) glutEstablishOverlay },
71 { "glutRemoveOverlay", (const GLUTproc) glutRemoveOverlay },
72 { "glutUseLayer", (const GLUTproc) glutUseLayer },
73 { "glutPostOverlayRedisplay", (const GLUTproc) glutPostOverlayRedisplay },
74 { "glutShowOverlay", (const GLUTproc) glutShowOverlay },
75 { "glutHideOverlay", (const GLUTproc) glutHideOverlay },
76 { "glutCreateMenu", (const GLUTproc) glutCreateMenu },
77 { "glutDestroyMenu", (const GLUTproc) glutDestroyMenu },
78 { "glutGetMenu", (const GLUTproc) glutGetMenu },
79 { "glutSetMenu", (const GLUTproc) glutSetMenu },
80 { "glutAddMenuEntry", (const GLUTproc) glutAddMenuEntry },
81 { "glutAddSubMenu", (const GLUTproc) glutAddSubMenu },
82 { "glutChangeToMenuEntry", (const GLUTproc) glutChangeToMenuEntry },
83 { "glutChangeToSubMenu", (const GLUTproc) glutChangeToSubMenu },
84 { "glutRemoveMenuItem", (const GLUTproc) glutRemoveMenuItem },
85 { "glutAttachMenu", (const GLUTproc) glutAttachMenu },
86 { "glutDetachMenu", (const GLUTproc) glutDetachMenu },
87 { "glutDisplayFunc", (const GLUTproc) glutDisplayFunc },
88 { "glutReshapeFunc", (const GLUTproc) glutReshapeFunc },
89 { "glutKeyboardFunc", (const GLUTproc) glutKeyboardFunc },
90 { "glutMouseFunc", (const GLUTproc) glutMouseFunc },
91 { "glutMotionFunc", (const GLUTproc) glutMotionFunc },
92 { "glutPassiveMotionFunc", (const GLUTproc) glutPassiveMotionFunc },
93 { "glutEntryFunc", (const GLUTproc) glutEntryFunc },
94 { "glutVisibilityFunc", (const GLUTproc) glutVisibilityFunc },
95 { "glutIdleFunc", (const GLUTproc) glutIdleFunc },
96 { "glutTimerFunc", (const GLUTproc) glutTimerFunc },
97 { "glutMenuStateFunc", (const GLUTproc) glutMenuStateFunc },
98 { "glutSpecialFunc", (const GLUTproc) glutSpecialFunc },
99 { "glutSpaceballRotateFunc", (const GLUTproc) glutSpaceballRotateFunc },
100 { "glutButtonBoxFunc", (const GLUTproc) glutButtonBoxFunc },
101 { "glutDialsFunc", (const GLUTproc) glutDialsFunc },
102 { "glutTabletMotionFunc", (const GLUTproc) glutTabletMotionFunc },
103 { "glutTabletButtonFunc", (const GLUTproc) glutTabletButtonFunc },
104 { "glutMenuStatusFunc", (const GLUTproc) glutMenuStatusFunc },
105 { "glutOverlayDisplayFunc", (const GLUTproc) glutOverlayDisplayFunc },
106 { "glutSetColor", (const GLUTproc) glutSetColor },
107 { "glutGetColor", (const GLUTproc) glutGetColor },
108 { "glutCopyColormap", (const GLUTproc) glutCopyColormap },
109 { "glutGet", (const GLUTproc) glutGet },
110 { "glutDeviceGet", (const GLUTproc) glutDeviceGet },
111 { "glutExtensionSupported", (const GLUTproc) glutExtensionSupported },
112 { "glutGetModifiers", (const GLUTproc) glutGetModifiers },
113 { "glutLayerGet", (const GLUTproc) glutLayerGet },
114 { "glutGetProcAddress", (const GLUTproc) glutGetProcAddress },
115 { "glutBitmapCharacter", (const GLUTproc) glutBitmapCharacter },
116 { "glutBitmapWidth", (const GLUTproc) glutBitmapWidth },
117 { "glutStrokeCharacter", (const GLUTproc) glutStrokeCharacter },
118 { "glutStrokeWidth", (const GLUTproc) glutStrokeWidth },
119 { "glutBitmapLength", (const GLUTproc) glutBitmapLength },
120 { "glutStrokeLength", (const GLUTproc) glutStrokeLength },
121 { "glutWireSphere", (const GLUTproc) glutWireSphere },
122 { "glutSolidSphere", (const GLUTproc) glutSolidSphere },
123 { "glutWireCone", (const GLUTproc) glutWireCone },
124 { "glutSolidCone", (const GLUTproc) glutSolidCone },
125 { "glutWireCube", (const GLUTproc) glutWireCube },
126 { "glutSolidCube", (const GLUTproc) glutSolidCube },
127 { "glutWireTorus", (const GLUTproc) glutWireTorus },
128 { "glutSolidTorus", (const GLUTproc) glutSolidTorus },
129 { "glutWireDodecahedron", (const GLUTproc) glutWireDodecahedron },
130 { "glutSolidDodecahedron", (const GLUTproc) glutSolidDodecahedron },
131 { "glutWireTeapot", (const GLUTproc) glutWireTeapot },
132 { "glutSolidTeapot", (const GLUTproc) glutSolidTeapot },
133 { "glutWireOctahedron", (const GLUTproc) glutWireOctahedron },
134 { "glutSolidOctahedron", (const GLUTproc) glutSolidOctahedron },
135 { "glutWireTetrahedron", (const GLUTproc) glutWireTetrahedron },
136 { "glutSolidTetrahedron", (const GLUTproc) glutSolidTetrahedron },
137 { "glutWireIcosahedron", (const GLUTproc) glutWireIcosahedron },
138 { "glutSolidIcosahedron", (const GLUTproc) glutSolidIcosahedron },
139 { "glutReportErrors", (const GLUTproc) glutReportErrors },
140 { NULL, NULL }
141 };
142
143 GLUTproc glutGetProcAddress(const char *procName)
144 {
145 /* Try GLUT functions first */
146 int i;
147 for (i = 0; glut_functions[i].name; i++) {
148 if (strcmp(glut_functions[i].name, procName) == 0)
149 return glut_functions[i].address;
150 }
151
152 /* Try core GL functions */
153 return (GLUTproc) glFBDevGetProcAddress(procName);
154 }