summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Cristau <jcristau@debian.org>2007-02-04 15:21:46 +0100
committerJulien Cristau <jcristau@debian.org>2007-02-04 15:21:46 +0100
commit0058815c8f16be33b15554f72bc5ecbc0f1aba3f (patch)
tree1e9a3d6647c6564ccef194b7b45270013a73f537
parent02048984b7962154956e9669d84ca062a576e4d9 (diff)
Re-add src/glut/mini/ which was deleted by mistake.
-rw-r--r--src/glut/mini/Makefile80
-rw-r--r--src/glut/mini/bitmap.c56
-rw-r--r--src/glut/mini/callback.c152
-rw-r--r--src/glut/mini/color.c46
-rw-r--r--src/glut/mini/globals.c61
-rw-r--r--src/glut/mini/init.c59
-rw-r--r--src/glut/mini/internal.h78
-rw-r--r--src/glut/mini/menu.c86
-rw-r--r--src/glut/mini/models.c598
-rw-r--r--src/glut/mini/overlay.c60
-rw-r--r--src/glut/mini/state.c70
-rw-r--r--src/glut/mini/teapot.c212
-rw-r--r--src/glut/mini/window.c273
13 files changed, 1831 insertions, 0 deletions
diff --git a/src/glut/mini/Makefile b/src/glut/mini/Makefile
new file mode 100644
index 00000000000..177bfe2d2bf
--- /dev/null
+++ b/src/glut/mini/Makefile
@@ -0,0 +1,80 @@
+# subset glut
+
+TOP = ../../..
+include $(TOP)/configs/current
+
+MARK = $(TOP)/src/glut/glx
+
+GLUT_MAJOR = 3
+GLUT_MINOR = 7
+GLUT_TINY = 1
+
+INCLUDES = -I$(TOP)/include -I$(MARK)
+
+CORE_SOURCES = \
+ bitmap.c \
+ callback.c \
+ color.c \
+ globals.c \
+ init.c \
+ menu.c \
+ models.c \
+ overlay.c \
+ state.c \
+ teapot.c \
+ window.c
+
+
+MARK_SOURCES = \
+ $(MARK)/glut_8x13.c \
+ $(MARK)/glut_9x15.c \
+ $(MARK)/glut_hel10.c \
+ $(MARK)/glut_hel12.c \
+ $(MARK)/glut_hel18.c \
+ $(MARK)/glut_tr10.c \
+ $(MARK)/glut_tr24.c
+
+SOURCES = $(CORE_SOURCES) $(MARK_SOURCES)
+
+OBJECTS = $(SOURCES:.c=.o)
+
+
+##### RULES #####
+
+.c.o:
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+.S.o:
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+
+##### TARGETS #####
+
+default: depend $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
+
+
+# Make the library
+$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
+ $(TOP)/bin/mklib -o $(GLUT_LIB) -linker '$(CC)' \
+ -major $(GLUT_MAJOR) -minor $(GLUT_MINOR) -patch $(GLUT_TINY) \
+ $(GLUT_LIB_DEPS) -install $(TOP)/$(LIB_DIR) \
+ $(MKLIB_OPTIONS) $(OBJECTS)
+
+
+# Run 'make -f Makefile.solo dep' to update the dependencies if you change
+# what's included by any source file.
+depend: $(SOURCES)
+ touch depend
+ $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) > /dev/null
+
+# Emacs tags
+tags:
+ etags `find . -name \*.[ch]` `find ../include`
+
+
+# Remove .o and backup files
+clean: depend
+ -rm -f depend
+ -rm -f *.o *~ *.o *~ *.so libglut.so.3.7
+
+include depend
diff --git a/src/glut/mini/bitmap.c b/src/glut/mini/bitmap.c
new file mode 100644
index 00000000000..55a031af0a5
--- /dev/null
+++ b/src/glut/mini/bitmap.c
@@ -0,0 +1,56 @@
+
+/* Copyright (c) Mark J. Kilgard, 1994. */
+
+/* This program is freely distributable without licensing fees
+ and is provided without guarantee or warrantee expressed or
+ implied. This program is -not- in the public domain. */
+
+#include "glutbitmap.h"
+
+void APIENTRY
+glutBitmapCharacter(GLUTbitmapFont font, int c)
+{
+ const BitmapCharRec *ch;
+ BitmapFontPtr fontinfo;
+ GLfloat swapbytes, lsbfirst, rowlength;
+ GLfloat skiprows, skippixels, alignment;
+
+#if defined(_WIN32)
+ fontinfo = (BitmapFontPtr) __glutFont(font);
+#else
+ fontinfo = (BitmapFontPtr) font;
+#endif
+
+ if (c < fontinfo->first ||
+ c >= fontinfo->first + fontinfo->num_chars)
+ return;
+ ch = fontinfo->ch[c - fontinfo->first];
+ if (ch) {
+ /* Save current modes. */
+/* glGetFloatv(GL_UNPACK_SWAP_BYTES, &swapbytes); */
+/* glGetFloatv(GL_UNPACK_LSB_FIRST, &lsbfirst); */
+/* glGetFloatv(GL_UNPACK_ROW_LENGTH, &rowlength); */
+/* glGetFloatv(GL_UNPACK_SKIP_ROWS, &skiprows); */
+/* glGetFloatv(GL_UNPACK_SKIP_PIXELS, &skippixels); */
+ glGetFloatv(GL_UNPACK_ALIGNMENT, &alignment);
+ /* Little endian machines (DEC Alpha for example) could
+ benefit from setting GL_UNPACK_LSB_FIRST to GL_TRUE
+ instead of GL_FALSE, but this would require changing the
+ generated bitmaps too. */
+/* glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); */
+/* glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE); */
+/* glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); */
+/* glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); */
+/* glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); */
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ glBitmap(ch->width, ch->height, ch->xorig, ch->yorig,
+ ch->advance, 0, ch->bitmap);
+ /* Restore saved modes. */
+/* glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes); */
+/* glPixelStorei(GL_UNPACK_LSB_FIRST, (int)lsbfirst); */
+/* glPixelStorei(GL_UNPACK_ROW_LENGTH, (int)rowlength); */
+/* glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows); */
+/* glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels); */
+ glPixelStorei(GL_UNPACK_ALIGNMENT, (int)alignment);
+ }
+}
diff --git a/src/glut/mini/callback.c b/src/glut/mini/callback.c
new file mode 100644
index 00000000000..d4e3101cc08
--- /dev/null
+++ b/src/glut/mini/callback.c
@@ -0,0 +1,152 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.4
+ * Copyright (C) 1995-1998 Brian Paul
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * DOS/DJGPP glut driver v1.0 for Mesa 4.0
+ *
+ * Copyright (C) 2002 - Borca Daniel
+ * Email : dborca@yahoo.com
+ * Web : http://www.geocities.com/dborca
+ */
+
+
+#include "GL/glut.h"
+#include "internal.h"
+
+
+void APIENTRY glutDisplayFunc (void (GLUTCALLBACK *func) (void))
+{
+ display_func = func;
+}
+
+
+void APIENTRY glutReshapeFunc (void (GLUTCALLBACK *func) (int width, int height))
+{
+ reshape_func = func;
+}
+
+
+void APIENTRY glutKeyboardFunc (void (GLUTCALLBACK *func) (unsigned char key, int x, int y))
+{
+ keyboard_func = func;
+}
+
+
+void APIENTRY glutMouseFunc (void (GLUTCALLBACK *func) (int button, int state, int x, int y))
+{
+ mouse_func = func;
+}
+
+
+void APIENTRY glutMotionFunc (void (GLUTCALLBACK *func) (int x, int y))
+{
+ motion_func = func;
+}
+
+
+void APIENTRY glutPassiveMotionFunc (void (GLUTCALLBACK *func) (int x, int y))
+{
+ passive_motion_func = func;
+}
+
+
+void APIENTRY glutEntryFunc (void (GLUTCALLBACK *func) (int state))
+{
+ entry_func = func;
+}
+
+
+void APIENTRY glutVisibilityFunc (void (GLUTCALLBACK *func) (int state))
+{
+ visibility_func = func;
+}
+
+
+void APIENTRY glutIdleFunc (void (GLUTCALLBACK *func) (void))
+{
+ idle_func = func;
+}
+
+
+void APIENTRY glutTimerFunc (unsigned int millis, void (GLUTCALLBACK *func) (int value), int value)
+{
+}
+
+
+void APIENTRY glutMenuStateFunc (void (GLUTCALLBACK *func) (int state))
+{
+ menu_state_func = func;
+}
+
+
+void APIENTRY glutSpecialFunc (void (GLUTCALLBACK *func) (int key, int x, int y))
+{
+ special_func = func;
+}
+
+
+void APIENTRY glutSpaceballMotionFunc (void (GLUTCALLBACK *func) (int x, int y, int z))
+{
+}
+
+
+void APIENTRY glutSpaceballRotateFunc (void (GLUTCALLBACK *func) (int x, int y, int z))
+{
+}
+
+
+void APIENTRY glutSpaceballButtonFunc (void (GLUTCALLBACK *func) (int button, int state))
+{
+}
+
+
+void APIENTRY glutButtonBoxFunc (void (GLUTCALLBACK *func) (int button, int state))
+{
+}
+
+
+void APIENTRY glutDialsFunc (void (GLUTCALLBACK *func) (int dial, int value))
+{
+}
+
+
+void APIENTRY glutTabletMotionFunc (void (GLUTCALLBACK *func) (int x, int y))
+{
+}
+
+
+void APIENTRY glutTabletButtonFunc (void (GLUTCALLBACK *func) (int button, int state, int x, int y))
+{
+}
+
+
+void APIENTRY glutMenuStatusFunc (void (GLUTCALLBACK *func) (int status, int x, int y))
+{
+}
+
+
+void APIENTRY glutOverlayDisplayFunc (void (GLUTCALLBACK *func) (void))
+{
+}
+
+
+void APIENTRY glutWindowStatusFunc (void (GLUTCALLBACK *func) (int state))
+{
+}
diff --git a/src/glut/mini/color.c b/src/glut/mini/color.c
new file mode 100644
index 00000000000..b53c5b669e7
--- /dev/null
+++ b/src/glut/mini/color.c
@@ -0,0 +1,46 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.4
+ * Copyright (C) 1995-1998 Brian Paul
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * DOS/DJGPP glut driver v1.0 for Mesa 4.0
+ *
+ * Copyright (C) 2002 - Borca Daniel
+ * Email : dborca@yahoo.com
+ * Web : http://www.geocities.com/dborca
+ */
+
+
+#include "GL/glut.h"
+
+
+void APIENTRY glutSetColor (int ndx, GLfloat red, GLfloat green, GLfloat blue)
+{
+}
+
+
+GLfloat APIENTRY glutGetColor (int ndx, int component)
+{
+ return 0.0;
+}
+
+
+void APIENTRY glutCopyColormap (int win)
+{
+}
diff --git a/src/glut/mini/globals.c b/src/glut/mini/globals.c
new file mode 100644
index 00000000000..76db53c6950
--- /dev/null
+++ b/src/glut/mini/globals.c
@@ -0,0 +1,61 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.4
+ * Copyright (C) 1995-1998 Brian Paul
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * DOS/DJGPP glut driver v1.0 for Mesa 4.0
+ *
+ * Copyright (C) 2002 - Borca Daniel
+ * Email : dborca@yahoo.com
+ * Web : http://www.geocities.com/dborca
+ */
+
+
+#include "GL/glut.h"
+#include "internal.h"
+
+GLenum g_display_mode = 0;
+GLuint g_width = DEFAULT_WIDTH;
+GLuint g_height = DEFAULT_HEIGHT;
+GLint g_mouse = GL_FALSE;
+GLboolean g_redisplay = GL_FALSE;
+GLint g_xpos = 0;
+GLint g_ypos = 0;
+
+void (GLUTCALLBACK *display_func) (void) = 0;
+void (GLUTCALLBACK *reshape_func) (int width, int height) = 0;
+void (GLUTCALLBACK *keyboard_func) (unsigned char key, int x, int y) = 0;
+void (GLUTCALLBACK *mouse_func) (int button, int state, int x, int y) = 0;
+void (GLUTCALLBACK *motion_func) (int x, int y) = 0;
+void (GLUTCALLBACK *passive_motion_func) (int x, int y) = 0;
+void (GLUTCALLBACK *entry_func) (int state) = 0;
+void (GLUTCALLBACK *visibility_func) (int state) = 0;
+void (GLUTCALLBACK *idle_func) (void) = 0;
+void (GLUTCALLBACK *menu_state_func) (int state) = 0;
+void (GLUTCALLBACK *special_func) (int key, int x, int y) = 0;
+void (GLUTCALLBACK *spaceball_motion_func) (int x, int y, int z) = 0;
+void (GLUTCALLBACK *spaceball_rotate_func) (int x, int y, int z) = 0;
+void (GLUTCALLBACK *spaceball_button_func) (int button, int state) = 0;
+void (GLUTCALLBACK *button_box_func) (int button, int state) = 0;
+void (GLUTCALLBACK *dials_func) (int dial, int value) = 0;
+void (GLUTCALLBACK *tablet_motion_func) (int x, int y) = 0;
+void (GLUTCALLBACK *tabled_button_func) (int button, int state, int x, int y) = 0;
+void (GLUTCALLBACK *menu_status_func) (int status, int x, int y) = 0;
+void (GLUTCALLBACK *overlay_display_func) (void) = 0;
+void (GLUTCALLBACK *window_status_func) (int state) = 0;
diff --git a/src/glut/mini/init.c b/src/glut/mini/init.c
new file mode 100644
index 00000000000..5588db9abaa
--- /dev/null
+++ b/src/glut/mini/init.c
@@ -0,0 +1,59 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.0
+ * Copyright (C) 1995-1998 Brian Paul
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * DOS/DJGPP glut driver v1.0 for Mesa 4.0
+ *
+ * Copyright (C) 2002 - Borca Daniel
+ * Email : dborca@yahoo.com
+ * Web : http://www.geocities.com/dborca
+ */
+
+
+#include "GL/glut.h"
+#include "internal.h"
+
+
+void APIENTRY glutInit (int *argcp, char **argv)
+{
+ glutGet(GLUT_ELAPSED_TIME);
+}
+
+
+void APIENTRY glutInitDisplayMode (unsigned int mode)
+{
+ g_display_mode = mode;
+}
+
+
+void APIENTRY glutInitWindowPosition (int x, int y)
+{
+ g_xpos = x;
+ g_ypos = y;
+}
+
+
+void APIENTRY glutInitWindowSize (int width, int height)
+{
+ g_width = width;
+ g_height = height;
+}
+
+
diff --git a/src/glut/mini/internal.h b/src/glut/mini/internal.h
new file mode 100644
index 00000000000..ccd12e54af1
--- /dev/null
+++ b/src/glut/mini/internal.h
@@ -0,0 +1,78 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.0
+ * Copyright (C) 1995-1998 Brian Paul
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * DOS/DJGPP glut driver v1.0 for Mesa 4.0
+ *
+ * Copyright (C) 2002 - Borca Daniel
+ * Email : dborca@yahoo.com
+ * Web : http://www.geocities.com/dborca
+ */
+
+
+#ifndef INTERNAL_H_included
+#define INTERNAL_H_included
+
+
+#include "GL/glut.h"
+/* #include "pc_hw/pc_hw.h" */
+
+
+#define MAX_WINDOWS 4
+
+#define DEFAULT_WIDTH 640
+#define DEFAULT_HEIGHT 480
+#define DEFAULT_BPP 16
+
+#define DEPTH_SIZE 16
+#define STENCIL_SIZE 8
+#define ACCUM_SIZE 16
+
+extern GLenum g_display_mode;
+extern GLuint g_width;
+extern GLuint g_height;
+extern GLint g_mouse;
+extern GLboolean g_redisplay;
+extern GLint g_xpos;
+extern GLint g_ypos;
+
+extern void (GLUTCALLBACK *display_func) (void);
+extern void (GLUTCALLBACK *reshape_func) (int width, int height);
+extern void (GLUTCALLBACK *keyboard_func) (unsigned char key, int x, int y);
+extern void (GLUTCALLBACK *mouse_func) (int button, int state, int x, int y);
+extern void (GLUTCALLBACK *motion_func) (int x, int y);
+extern void (GLUTCALLBACK *passive_motion_func) (int x, int y);
+extern void (GLUTCALLBACK *entry_func) (int state);
+extern void (GLUTCALLBACK *visibility_func) (int state);
+extern void (GLUTCALLBACK *idle_func) (void);
+extern void (GLUTCALLBACK *menu_state_func) (int state);
+extern void (GLUTCALLBACK *special_func) (int key, int x, int y);
+extern void (GLUTCALLBACK *spaceball_motion_func) (int x, int y, int z);
+extern void (GLUTCALLBACK *spaceball_rotate_func) (int x, int y, int z);
+extern void (GLUTCALLBACK *spaceball_button_func) (int button, int state);
+extern void (GLUTCALLBACK *button_box_func) (int button, int state);
+extern void (GLUTCALLBACK *dials_func) (int dial, int value);
+extern void (GLUTCALLBACK *tablet_motion_func) (int x, int y);
+extern void (GLUTCALLBACK *tabled_button_func) (int button, int state, int x, int y);
+extern void (GLUTCALLBACK *menu_status_func) (int status, int x, int y);
+extern void (GLUTCALLBACK *overlay_display_func) (void);
+extern void (GLUTCALLBACK *window_status_func) (int state);
+
+#endif
diff --git a/src/glut/mini/menu.c b/src/glut/mini/menu.c
new file mode 100644
index 00000000000..3c571647b1b
--- /dev/null
+++ b/src/glut/mini/menu.c
@@ -0,0 +1,86 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.4
+ * Copyright (C) 1995-1998 Brian Paul
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * DOS/DJGPP glut driver v1.0 for Mesa 4.0
+ *
+ * Copyright (C) 2002 - Borca Daniel
+ * Email : dborca@yahoo.com
+ * Web : http://www.geocities.com/dborca
+ */
+
+
+#include "GL/glut.h"
+
+
+int APIENTRY glutCreateMenu (void (GLUTCALLBACK *func) (int))
+{
+ return 0;
+}
+
+void APIENTRY glutDestroyMenu (int menu)
+{
+}
+
+
+int APIENTRY glutGetMenu (void)
+{
+ return 0;
+}
+
+
+void APIENTRY glutSetMenu (int menu)
+{
+}
+
+
+void APIENTRY glutAddMenuEntry (const char *label, int value)
+{
+}
+
+
+void APIENTRY glutAddSubMenu (const char *label, int submenu)
+{
+}
+
+
+void APIENTRY glutChangeToMenuEntry (int item, const char *label, int value)
+{
+}
+
+
+void APIENTRY glutChangeToSubMenu (int item, const char *label, int submenu)
+{
+}
+
+
+void APIENTRY glutRemoveMenuItem (int item)
+{
+}
+
+
+void APIENTRY glutAttachMenu (int button)
+{
+}
+
+
+void APIENTRY glutDetachMenu (int button)
+{
+}
diff --git a/src/glut/mini/models.c b/src/glut/mini/models.c
new file mode 100644
index 00000000000..3f955b88ff6
--- /dev/null
+++ b/src/glut/mini/models.c
@@ -0,0 +1,598 @@
+
+/* Copyright (c) Mark J. Kilgard, 1994, 1997. */
+
+/**
+(c) Copyright 1993, Silicon Graphics, Inc.
+
+ALL RIGHTS RESERVED
+
+Permission to use, copy, modify, and distribute this software
+for any purpose and without fee is hereby granted, provided
+that the above copyright notice appear in all copies and that
+both the copyright notice and this permission notice appear in
+supporting documentation, and that the name of Silicon
+Graphics, Inc. not be used in advertising or publicity
+pertaining to distribution of the software without specific,
+written prior permission.
+
+THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU
+"AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR
+OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO
+EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE
+ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER,
+INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE,
+SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR
+NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF THE POSSIBILITY
+OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
+US Government Users Restricted Rights
+
+Use, duplication, or disclosure by the Government is subject to
+restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
+(c)(1)(ii) of the Rights in Technical Data and Computer
+Software clause at DFARS 252.227-7013 and/or in similar or
+successor clauses in the FAR or the DOD or NASA FAR
+Supplement. Unpublished-- rights reserved under the copyright
+laws of the United States. Contractor/manufacturer is Silicon
+Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA
+94039-7311.
+
+OpenGL(TM) is a trademark of Silicon Graphics, Inc.
+*/
+
+#include <math.h>
+#include <GL/gl.h>
+#include <GL/glu.h>
+#include "GL/glut.h"
+
+/* Some <math.h> files do not define M_PI... */
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+static GLUquadricObj *quadObj;
+
+#define QUAD_OBJ_INIT() { if(!quadObj) initQuadObj(); }
+
+static void
+initQuadObj(void)
+{
+ quadObj = gluNewQuadric();
+/* if (!quadObj)
+ __glutFatalError("out of memory."); */
+}
+
+/* CENTRY */
+void APIENTRY
+glutWireSphere(GLdouble radius, GLint slices, GLint stacks)
+{
+ QUAD_OBJ_INIT();
+ gluQuadricDrawStyle(quadObj, GLU_LINE);
+ gluQuadricNormals(quadObj, GLU_SMOOTH);
+ /* If we ever changed/used the texture or orientation state
+ of quadObj, we'd need to change it to the defaults here
+ with gluQuadricTexture and/or gluQuadricOrientation. */
+ gluSphere(quadObj, radius, slices, stacks);
+}
+
+void APIENTRY
+glutSolidSphere(GLdouble radius, GLint slices, GLint stacks)
+{
+ QUAD_OBJ_INIT();
+ gluQuadricDrawStyle(quadObj, GLU_FILL);
+ gluQuadricNormals(quadObj, GLU_SMOOTH);
+ /* If we ever changed/used the texture or orientation state
+ of quadObj, we'd need to change it to the defaults here
+ with gluQuadricTexture and/or gluQuadricOrientation. */
+ gluSphere(quadObj, radius, slices, stacks);
+}
+
+void APIENTRY
+glutWireCone(GLdouble base, GLdouble height,
+ GLint slices, GLint stacks)
+{
+ QUAD_OBJ_INIT();
+ gluQuadricDrawStyle(quadObj, GLU_LINE);
+ gluQuadricNormals(quadObj, GLU_SMOOTH);
+ /* If we ever changed/used the texture or orientation state
+ of quadObj, we'd need to change it to the defaults here
+ with gluQuadricTexture and/or gluQuadricOrientation. */
+ gluCylinder(quadObj, base, 0.0, height, slices, stacks);
+}
+
+void APIENTRY
+glutSolidCone(GLdouble base, GLdouble height,
+ GLint slices, GLint stacks)
+{
+ QUAD_OBJ_INIT();
+ gluQuadricDrawStyle(quadObj, GLU_FILL);
+ gluQuadricNormals(quadObj, GLU_SMOOTH);
+ /* If we ever changed/used the texture or orientation state
+ of quadObj, we'd need to change it to the defaults here
+ with gluQuadricTexture and/or gluQuadricOrientation. */
+ gluCylinder(quadObj, base, 0.0, height, slices, stacks);
+}
+
+/* ENDCENTRY */
+
+static void
+drawBox(GLfloat size, GLenum type)
+{
+ static GLfloat n[6][3] =
+ {
+ {-1.0, 0.0, 0.0},
+ {0.0, 1.0, 0.0},
+ {1.0, 0.0, 0.0},
+ {0.0, -1.0, 0.0},
+ {0.0, 0.0, 1.0},
+ {0.0, 0.0, -1.0}
+ };
+ static GLint faces[6][4] =
+ {
+ {0, 1, 2, 3},
+ {3, 2, 6, 7},
+ {7, 6, 5, 4},
+ {4, 5, 1, 0},
+ {5, 6, 2, 1},
+ {7, 4, 0, 3}
+ };
+ GLfloat v[8][3];
+ GLint i;
+
+ v[0][0] = v[1][0] = v[2][0] = v[3][0] = -size / 2;
+ v[4][0] = v[5][0] = v[6][0] = v[7][0] = size / 2;
+ v[0][1] = v[1][1] = v[4][1] = v[5][1] = -size / 2;
+ v[2][1] = v[3][1] = v[6][1] = v[7][1] = size / 2;
+ v[0][2] = v[3][2] = v[4][2] = v[7][2] = -size / 2;
+ v[1][2] = v[2][2] = v[5][2] = v[6][2] = size / 2;
+
+ for (i = 5; i >= 0; i--) {
+ glBegin(type);
+ glNormal3fv(&n[i][0]);
+ glVertex3fv(&v[faces[i][0]][0]);
+ glVertex3fv(&v[faces[i][1]][0]);
+ glVertex3fv(&v[faces[i][2]][0]);
+ glVertex3fv(&v[faces[i][3]][0]);
+ glEnd();
+ }
+}
+
+/* CENTRY */
+void APIENTRY
+glutWireCube(GLdouble size)
+{
+ drawBox(size, GL_LINE_LOOP);
+}
+
+void APIENTRY
+glutSolidCube(GLdouble size)
+{
+ drawBox(size, GL_QUADS);
+}
+
+/* ENDCENTRY */
+
+static void
+doughnut(GLfloat r, GLfloat R, GLint nsides, GLint rings)
+{
+ int i, j;
+ GLfloat theta, phi, theta1;
+ GLfloat cosTheta, sinTheta;
+ GLfloat cosTheta1, sinTheta1;
+ GLfloat ringDelta, sideDelta;
+
+ ringDelta = 2.0 * M_PI / rings;
+ sideDelta = 2.0 * M_PI / nsides;
+
+ theta = 0.0;
+ cosTheta = 1.0;
+ sinTheta = 0.0;
+ for (i = rings - 1; i >= 0; i--) {
+ theta1 = theta + ringDelta;
+ cosTheta1 = cos(theta1);
+ sinTheta1 = sin(theta1);
+ glBegin(GL_QUAD_STRIP);
+ phi = 0.0;
+ for (j = nsides; j >= 0; j--) {
+ GLfloat cosPhi, sinPhi, dist;
+
+ phi += sideDelta;
+ cosPhi = cos(phi);
+ sinPhi = sin(phi);
+ dist = R + r * cosPhi;
+
+ glNormal3f(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi);
+ glVertex3f(cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi);
+ glNormal3f(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi);
+ glVertex3f(cosTheta * dist, -sinTheta * dist, r * sinPhi);
+ }
+ glEnd();
+ theta = theta1;
+ cosTheta = cosTheta1;
+ sinTheta = sinTheta1;
+ }
+}
+
+/* CENTRY */
+void APIENTRY
+glutWireTorus(GLdouble innerRadius, GLdouble outerRadius,
+ GLint nsides, GLint rings)
+{
+ glPushAttrib(GL_POLYGON_BIT);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ doughnut(innerRadius, outerRadius, nsides, rings);
+ glPopAttrib();
+}
+
+void APIENTRY
+glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius,
+ GLint nsides, GLint rings)
+{
+ doughnut(innerRadius, outerRadius, nsides, rings);
+}
+
+/* ENDCENTRY */
+
+static GLfloat dodec[20][3];
+
+static void
+initDodecahedron(void)
+{
+ GLfloat alpha, beta;
+
+ alpha = sqrt(2.0 / (3.0 + sqrt(5.0)));
+ beta = 1.0 + sqrt(6.0 / (3.0 + sqrt(5.0)) -
+ 2.0 + 2.0 * sqrt(2.0 / (3.0 + sqrt(5.0))));
+ /* *INDENT-OFF* */
+ dodec[0][0] = -alpha; dodec[0][1] = 0; dodec[0][2] = beta;
+ dodec[1][0] = alpha; dodec[1][1] = 0; dodec[1][2] = beta;
+ dodec[2][0] = -1; dodec[2][1] = -1; dodec[2][2] = -1;
+ dodec[3][0] = -1; dodec[3][1] = -1; dodec[3][2] = 1;
+ dodec[4][0] = -1; dodec[4][1] = 1; dodec[4][2] = -1;
+ dodec[5][0] = -1; dodec[5][1] = 1; dodec[5][2] = 1;
+ dodec[6][0] = 1; dodec[6][1] = -1; dodec[6][2] = -1;
+ dodec[7][0] = 1; dodec[7][1] = -1; dodec[7][2] = 1;
+ dodec[8][0] = 1; dodec[8][1] = 1; dodec[8][2] = -1;
+ dodec[9][0] = 1; dodec[9][1] = 1; dodec[9][2] = 1;
+ dodec[10][0] = beta; dodec[10][1] = alpha; dodec[10][2] = 0;
+ dodec[11][0] = beta; dodec[11][1] = -alpha; dodec[11][2] = 0;
+ dodec[12][0] = -beta; dodec[12][1] = alpha; dodec[12][2] = 0;
+ dodec[13][0] = -beta; dodec[13][1] = -alpha; dodec[13][2] = 0;
+ dodec[14][0] = -alpha; dodec[14][1] = 0; dodec[14][2] = -beta;
+ dodec[15][0] = alpha; dodec[15][1] = 0; dodec[15][2] = -beta;
+ dodec[16][0] = 0; dodec[16][1] = beta; dodec[16][2] = alpha;
+ dodec[17][0] = 0; dodec[17][1] = beta; dodec[17][2] = -alpha;
+ dodec[18][0] = 0; dodec[18][1] = -beta; dodec[18][2] = alpha;
+ dodec[19][0] = 0; dodec[19][1] = -beta; dodec[19][2] = -alpha;
+ /* *INDENT-ON* */
+
+}
+
+#define DIFF3(_a,_b,_c) { \
+ (_c)[0] = (_a)[0] - (_b)[0]; \
+ (_c)[1] = (_a)[1] - (_b)[1]; \
+ (_c)[2] = (_a)[2] - (_b)[2]; \
+}
+
+static void
+crossprod(GLfloat v1[3], GLfloat v2[3], GLfloat prod[3])
+{
+ GLfloat p[3]; /* in case prod == v1 or v2 */
+
+ p[0] = v1[1] * v2[2] - v2[1] * v1[2];
+ p[1] = v1[2] * v2[0] - v2[2] * v1[0];
+ p[2] = v1[0] * v2[1] - v2[0] * v1[1];
+ prod[0] = p[0];
+ prod[1] = p[1];
+ prod[2] = p[2];
+}
+
+static void
+normalize(GLfloat v[3])
+{
+ GLfloat d;
+
+ d = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
+ if (d == 0.0) {
+/* __glutWarning("normalize: zero length vector"); */
+ v[0] = d = 1.0;
+ }
+ d = 1 / d;
+ v[0] *= d;
+ v[1] *= d;
+ v[2] *= d;
+}
+
+static void
+pentagon(int a, int b, int c, int d, int e, GLenum shadeType)
+{
+ GLfloat n0[3], d1[3], d2[3];
+
+ DIFF3(dodec[a], dodec[b], d1);
+ DIFF3(dodec[b], dodec[c], d2);
+ crossprod(d1, d2, n0);
+ normalize(n0);
+
+ glBegin(shadeType);
+ glNormal3fv(n0);
+ glVertex3fv(&dodec[a][0]);
+ glVertex3fv(&dodec[b][0]);
+ glVertex3fv(&dodec[c][0]);
+ glVertex3fv(&dodec[d][0]);
+ glVertex3fv(&dodec[e][0]);
+ glEnd();
+}
+
+static void
+dodecahedron(GLenum type)
+{
+ static int inited = 0;
+
+ if (inited == 0) {
+ inited = 1;
+ initDodecahedron();
+ }
+ pentagon(0, 1, 9, 16, 5, type);
+ pentagon(1, 0, 3, 18, 7, type);
+ pentagon(1, 7, 11, 10, 9, type);
+ pentagon(11, 7, 18, 19, 6, type);
+ pentagon(8, 17, 16, 9, 10, type);
+ pentagon(2, 14, 15, 6, 19, type);
+ pentagon(2, 13, 12, 4, 14, type);
+ pentagon(2, 19, 18, 3, 13, type);
+ pentagon(3, 0, 5, 12, 13, type);
+ pentagon(6, 15, 8, 10, 11, type);
+ pentagon(4, 17, 8, 15, 14, type);
+ pentagon(4, 12, 5, 16, 17, type);
+}
+
+/* CENTRY */
+void APIENTRY
+glutWireDodecahedron(void)
+{
+ dodecahedron(GL_LINE_LOOP);
+}
+
+void APIENTRY
+glutSolidDodecahedron(void)
+{
+ dodecahedron(GL_TRIANGLE_FAN);
+}
+
+/* ENDCENTRY */
+
+static void
+recorditem(GLfloat * n1, GLfloat * n2, GLfloat * n3,
+ GLenum shadeType)
+{
+ GLfloat q0[3], q1[3];
+
+ DIFF3(n1, n2, q0);
+ DIFF3(n2, n3, q1);
+ crossprod(q0, q1, q1);
+ normalize(q1);
+
+ glBegin(shadeType);
+ glNormal3fv(q1);
+ glVertex3fv(n1);
+ glVertex3fv(n2);
+ glVertex3fv(n3);
+ glEnd();
+}
+
+static void
+subdivide(GLfloat * v0, GLfloat * v1, GLfloat * v2,
+ GLenum shadeType)
+{
+ int depth;
+ GLfloat w0[3], w1[3], w2[3];
+ GLfloat l;
+ int i, j, k, n;
+
+ depth = 1;
+ for (i = 0; i < depth; i++) {
+ for (j = 0; i + j < depth; j++) {
+ k = depth - i - j;
+ for (n = 0; n < 3; n++) {
+ w0[n] = (i * v0[n] + j * v1[n] + k * v2[n]) / depth;
+ w1[n] = ((i + 1) * v0[n] + j * v1[n] + (k - 1) * v2[n])
+ / depth;
+ w2[n] = (i * v0[n] + (j + 1) * v1[n] + (k - 1) * v2[n])
+ / depth;
+ }
+ l = sqrt(w0[0] * w0[0] + w0[1] * w0[1] + w0[2] * w0[2]);
+ w0[0] /= l;
+ w0[1] /= l;
+ w0[2] /= l;
+ l = sqrt(w1[0] * w1[0] + w1[1] * w1[1] + w1[2] * w1[2]);
+ w1[0] /= l;
+ w1[1] /= l;
+ w1[2] /= l;
+ l = sqrt(w2[0] * w2[0] + w2[1] * w2[1] + w2[2] * w2[2]);
+ w2[0] /= l;
+ w2[1] /= l;
+ w2[2] /= l;
+ recorditem(w1, w0, w2, shadeType);
+ }
+ }
+}
+
+static void
+drawtriangle(int i, GLfloat data[][3], int ndx[][3],
+ GLenum shadeType)
+{
+ GLfloat *x0, *x1, *x2;
+
+ x0 = data[ndx[i][0]];
+ x1 = data[ndx[i][1]];
+ x2 = data[ndx[i][2]];
+ subdivide(x0, x1, x2, shadeType);
+}
+
+/* octahedron data: The octahedron produced is centered at the
+ origin and has radius 1.0 */
+static GLfloat odata[6][3] =
+{
+ {1.0, 0.0, 0.0},
+ {-1.0, 0.0, 0.0},
+ {0.0, 1.0, 0.0},
+ {0.0, -1.0, 0.0},
+ {0.0, 0.0, 1.0},
+ {0.0, 0.0, -1.0}
+};
+
+static int ondex[8][3] =
+{
+ {0, 4, 2},
+ {1, 2, 4},
+ {0, 3, 4},
+ {1, 4, 3},
+ {0, 2, 5},
+ {1, 5, 2},
+ {0, 5, 3},
+ {1, 3, 5}
+};
+
+static void
+octahedron(GLenum shadeType)
+{
+ int i;
+
+ for (i = 7; i >= 0; i--) {
+ drawtriangle(i, odata, ondex, shadeType);
+ }
+}
+
+/* CENTRY */
+void APIENTRY
+glutWireOctahedron(void)
+{
+ octahedron(GL_LINE_LOOP);
+}
+
+void APIENTRY
+glutSolidOctahedron(void)
+{
+ octahedron(GL_TRIANGLES);
+}
+
+/* ENDCENTRY */
+
+/* icosahedron data: These numbers are rigged to make an
+ icosahedron of radius 1.0 */
+
+#define X .525731112119133606
+#define Z .850650808352039932
+
+static GLfloat idata[12][3] =
+{
+ {-X, 0, Z},
+ {X, 0, Z},
+ {-X, 0, -Z},
+ {X, 0, -Z},
+ {0, Z, X},
+ {0, Z, -X},
+ {0, -Z, X},
+ {0, -Z, -X},
+ {Z, X, 0},
+ {-Z, X, 0},
+ {Z, -X, 0},
+ {-Z, -X, 0}
+};
+
+static int index[20][3] =
+{
+ {0, 4, 1},
+ {0, 9, 4},
+ {9, 5, 4},
+ {4, 5, 8},
+ {4, 8, 1},
+ {8, 10, 1},
+ {8, 3, 10},
+ {5, 3, 8},
+ {5, 2, 3},
+ {2, 7, 3},
+ {7, 10, 3},
+ {7, 6, 10},
+ {7, 11, 6},
+ {11, 0, 6},
+ {0, 1, 6},
+ {6, 1, 10},
+ {9, 0, 11},
+ {9, 11, 2},
+ {9, 2, 5},
+ {7, 2, 11},
+};
+
+static void
+icosahedron(GLenum shadeType)
+{
+ int i;
+
+ for (i = 19; i >= 0; i--) {
+ drawtriangle(i, idata, index, shadeType);
+ }
+}
+
+/* CENTRY */
+void APIENTRY
+glutWireIcosahedron(void)
+{
+ icosahedron(GL_LINE_LOOP);
+}
+
+void APIENTRY
+glutSolidIcosahedron(void)
+{
+ icosahedron(GL_TRIANGLES);
+}
+
+/* ENDCENTRY */
+
+/* tetrahedron data: */
+
+#define T 1.73205080756887729
+
+static GLfloat tdata[4][3] =
+{
+ {T, T, T},
+ {T, -T, -T},
+ {-T, T, -T},
+ {-T, -T, T}
+};
+
+static int tndex[4][3] =
+{
+ {0, 1, 3},
+ {2, 1, 0},
+ {3, 2, 0},
+ {1, 2, 3}
+};
+
+static void
+tetrahedron(GLenum shadeType)
+{
+ int i;
+
+ for (i = 3; i >= 0; i--)
+ drawtriangle(i, tdata, tndex, shadeType);
+}
+
+/* CENTRY */
+void APIENTRY
+glutWireTetrahedron(void)
+{
+ tetrahedron(GL_LINE_LOOP);
+}
+
+void APIENTRY
+glutSolidTetrahedron(void)
+{
+ tetrahedron(GL_TRIANGLES);
+}
+
+/* ENDCENTRY */
diff --git a/src/glut/mini/overlay.c b/src/glut/mini/overlay.c
new file mode 100644
index 00000000000..fc8a8e5b0db
--- /dev/null
+++ b/src/glut/mini/overlay.c
@@ -0,0 +1,60 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.4
+ * Copyright (C) 1995-1998 Brian Paul
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * DOS/DJGPP glut driver v1.0 for Mesa 4.0
+ *
+ * Copyright (C) 2002 - Borca Daniel
+ * Email : dborca@yahoo.com
+ * Web : http://www.geocities.com/dborca
+ */
+
+
+#include "GL/glut.h"
+
+
+void APIENTRY glutEstablishOverlay (void)
+{
+}
+
+
+void APIENTRY glutRemoveOverlay (void)
+{
+}
+
+
+void APIENTRY glutUseLayer (GLenum layer)
+{
+}
+
+
+void APIENTRY glutPostOverlayRedisplay (void)
+{
+}
+
+
+void APIENTRY glutShowOverlay (void)
+{
+}
+
+
+void APIENTRY glutHideOverlay (void)
+{
+}
diff --git a/src/glut/mini/state.c b/src/glut/mini/state.c
new file mode 100644
index 00000000000..81aefc53bda
--- /dev/null
+++ b/src/glut/mini/state.c
@@ -0,0 +1,70 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.4
+ * Copyright (C) 1995-1998 Brian Paul
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * DOS/DJGPP glut driver v1.0 for Mesa 4.0
+ *
+ * Copyright (C) 2002 - Borca Daniel
+ * Email : dborca@yahoo.com
+ * Web : http://www.geocities.com/dborca
+ */
+
+
+#include "GL/glut.h"
+#include <sys/time.h>
+
+
+#define TIMEDELTA(dest, src1, src2) { \
+ if(((dest).tv_usec = (src1).tv_usec - (src2).tv_usec) < 0) { \
+ (dest).tv_usec += 1000000; \
+ (dest).tv_sec = (src1).tv_sec - (src2).tv_sec - 1; \
+ } else { \
+ (dest).tv_sec = (src1).tv_sec - (src2).tv_sec; \
+ } \
+}
+
+int APIENTRY glutGet (GLenum type)
+{
+
+ switch (type) {
+ case GLUT_WINDOW_RGBA:
+ return 1;
+ case GLUT_ELAPSED_TIME: {
+ static int inited = 0;
+ static struct timeval elapsed, beginning, now;
+ if (!inited) {
+ gettimeofday(&beginning, 0);
+ inited = 1;
+ }
+ gettimeofday(&now, 0);
+ TIMEDELTA(elapsed, now, beginning);
+ /* Return elapsed milliseconds. */
+ return (int) ((elapsed.tv_sec * 1000) + (elapsed.tv_usec / 1000));
+ }
+ default:
+ return 0;
+ }
+}
+
+
+int APIENTRY glutDeviceGet (GLenum type)
+{
+ return 0;
+}
diff --git a/src/glut/mini/teapot.c b/src/glut/mini/teapot.c
new file mode 100644
index 00000000000..aa96fcbbbd6
--- /dev/null
+++ b/src/glut/mini/teapot.c
@@ -0,0 +1,212 @@
+
+/* Copyright (c) Mark J. Kilgard, 1994. */
+
+/**
+(c) Copyright 1993, Silicon Graphics, Inc.
+
+ALL RIGHTS RESERVED
+
+Permission to use, copy, modify, and distribute this software
+for any purpose and without fee is hereby granted, provided
+that the above copyright notice appear in all copies and that
+both the copyright notice and this permission notice appear in
+supporting documentation, and that the name of Silicon
+Graphics, Inc. not be used in advertising or publicity
+pertaining to distribution of the software without specific,
+written prior permission.
+
+THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU
+"AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR
+OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO
+EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE
+ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER,
+INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE,
+SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR
+NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF THE POSSIBILITY
+OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
+US Government Users Restricted Rights
+
+Use, duplication, or disclosure by the Government is subject to
+restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
+(c)(1)(ii) of the Rights in Technical Data and Computer
+Software clause at DFARS 252.227-7013 and/or in similar or
+successor clauses in the FAR or the DOD or NASA FAR
+Supplement. Unpublished-- rights reserved under the copyright
+laws of the United States. Contractor/manufacturer is Silicon
+Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA
+94039-7311.
+
+OpenGL(TM) is a trademark of Silicon Graphics, Inc.
+*/
+
+#include <GL/gl.h>
+#include <GL/glu.h>
+#include "GL/glut.h"
+
+/* Rim, body, lid, and bottom data must be reflected in x and
+ y; handle and spout data across the y axis only. */
+
+static int patchdata[][16] =
+{
+ /* rim */
+ {102, 103, 104, 105, 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 14, 15},
+ /* body */
+ {12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27},
+ {24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 40},
+ /* lid */
+ {96, 96, 96, 96, 97, 98, 99, 100, 101, 101, 101,
+ 101, 0, 1, 2, 3,},
+ {0, 1, 2, 3, 106, 107, 108, 109, 110, 111, 112,
+ 113, 114, 115, 116, 117},
+ /* bottom */
+ {118, 118, 118, 118, 124, 122, 119, 121, 123, 126,
+ 125, 120, 40, 39, 38, 37},
+ /* handle */
+ {41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 53, 54, 55, 56},
+ {53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
+ 28, 65, 66, 67},
+ /* spout */
+ {68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83},
+ {80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
+ 92, 93, 94, 95}
+};
+/* *INDENT-OFF* */
+
+static float cpdata[][3] =
+{
+ {0.2, 0, 2.7}, {0.2, -0.112, 2.7}, {0.112, -0.2, 2.7}, {0,
+ -0.2, 2.7}, {1.3375, 0, 2.53125}, {1.3375, -0.749, 2.53125},
+ {0.749, -1.3375, 2.53125}, {0, -1.3375, 2.53125}, {1.4375,
+ 0, 2.53125}, {1.4375, -0.805, 2.53125}, {0.805, -1.4375,
+ 2.53125}, {0, -1.4375, 2.53125}, {1.5, 0, 2.4}, {1.5, -0.84,
+ 2.4}, {0.84, -1.5, 2.4}, {0, -1.5, 2.4}, {1.75, 0, 1.875},
+ {1.75, -0.98, 1.875}, {0.98, -1.75, 1.875}, {0, -1.75,
+ 1.875}, {2, 0, 1.35}, {2, -1.12, 1.35}, {1.12, -2, 1.35},
+ {0, -2, 1.35}, {2, 0, 0.9}, {2, -1.12, 0.9}, {1.12, -2,
+ 0.9}, {0, -2, 0.9}, {-2, 0, 0.9}, {2, 0, 0.45}, {2, -1.12,
+ 0.45}, {1.12, -2, 0.45}, {0, -2, 0.45}, {1.5, 0, 0.225},
+ {1.5, -0.84, 0.225}, {0.84, -1.5, 0.225}, {0, -1.5, 0.225},
+ {1.5, 0, 0.15}, {1.5, -0.84, 0.15}, {0.84, -1.5, 0.15}, {0,
+ -1.5, 0.15}, {-1.6, 0, 2.025}, {-1.6, -0.3, 2.025}, {-1.5,
+ -0.3, 2.25}, {-1.5, 0, 2.25}, {-2.3, 0, 2.025}, {-2.3, -0.3,
+ 2.025}, {-2.5, -0.3, 2.25}, {-2.5, 0, 2.25}, {-2.7, 0,
+ 2.025}, {-2.7, -0.3, 2.025}, {-3, -0.3, 2.25}, {-3, 0,
+ 2.25}, {-2.7, 0, 1.8}, {-2.7, -0.3, 1.8}, {-3, -0.3, 1.8},
+ {-3, 0, 1.8}, {-2.7, 0, 1.575}, {-2.7, -0.3, 1.575}, {-3,
+ -0.3, 1.35}, {-3, 0, 1.35}, {-2.5, 0, 1.125}, {-2.5, -0.3,
+ 1.125}, {-2.65, -0.3, 0.9375}, {-2.65, 0, 0.9375}, {-2,
+ -0.3, 0.9}, {-1.9, -0.3, 0.6}, {-1.9, 0, 0.6}, {1.7, 0,
+ 1.425}, {1.7, -0.66, 1.425}, {1.7, -0.66, 0.6}, {1.7, 0,
+ 0.6}, {2.6, 0, 1.425}, {2.6, -0.66, 1.425}, {3.1, -0.66,
+ 0.825}, {3.1, 0, 0.825}, {2.3, 0, 2.1}, {2.3, -0.25, 2.1},
+ {2.4, -0.25, 2.025}, {2.4, 0, 2.025}, {2.7, 0, 2.4}, {2.7,
+ -0.25, 2.4}, {3.3, -0.25, 2.4}, {3.3, 0, 2.4}, {2.8, 0,
+ 2.475}, {2.8, -0.25, 2.475}, {3.525, -0.25, 2.49375},
+ {3.525, 0, 2.49375}, {2.9, 0, 2.475}, {2.9, -0.15, 2.475},
+ {3.45, -0.15, 2.5125}, {3.45, 0, 2.5125}, {2.8, 0, 2.4},
+ {2.8, -0.15, 2.4}, {3.2, -0.15, 2.4}, {3.2, 0, 2.4}, {0, 0,
+ 3.15}, {0.8, 0, 3.15}, {0.8, -0.45, 3.15}, {0.45, -0.8,
+ 3.15}, {0, -0.8, 3.15}, {0, 0, 2.85}, {1.4, 0, 2.4}, {1.4,
+ -0.784, 2.4}, {0.784, -1.4, 2.4}, {0, -1.4, 2.4}, {0.4, 0,
+ 2.55}, {0.4, -0.224, 2.55}, {0.224, -0.4, 2.55}, {0, -0.4,
+ 2.55}, {1.3, 0, 2.55}, {1.3, -0.728, 2.55}, {0.728, -1.3,
+ 2.55}, {0, -1.3, 2.55}, {1.3, 0, 2.4}, {1.3, -0.728, 2.4},
+ {0.728, -1.3, 2.4}, {0, -1.3, 2.4}, {0, 0, 0}, {1.425,
+ -0.798, 0}, {1.5, 0, 0.075}, {1.425, 0, 0}, {0.798, -1.425,
+ 0}, {0, -1.5, 0.075}, {0, -1.425, 0}, {1.5, -0.84, 0.075},
+ {0.84, -1.5, 0.075}
+};
+
+static float tex[2][2][2] =
+{
+ { {0, 0},
+ {1, 0}},
+ { {0, 1},
+ {1, 1}}
+};
+
+/* *INDENT-ON* */
+
+static void
+teapot(GLint grid, GLdouble scale, GLenum type)
+{
+ float p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3];
+ long i, j, k, l;
+
+ glPushAttrib(GL_ENABLE_BIT | GL_EVAL_BIT);
+ glEnable(GL_AUTO_NORMAL);
+ glEnable(GL_NORMALIZE);
+ glEnable(GL_MAP2_VERTEX_3);
+ glEnable(GL_MAP2_TEXTURE_COORD_2);
+ glPushMatrix();
+ glRotatef(270.0, 1.0, 0.0, 0.0);
+ glScalef(0.5 * scale, 0.5 * scale, 0.5 * scale);
+ glTranslatef(0.0, 0.0, -1.5);
+ for (i = 0; i < 10; i++) {
+ for (j = 0; j < 4; j++) {
+ for (k = 0; k < 4; k++) {
+ for (l = 0; l < 3; l++) {
+ p[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l];
+ q[j][k][l] = cpdata[patchdata[i][j * 4 + (3 - k)]][l];
+ if (l == 1)
+ q[j][k][l] *= -1.0;
+ if (i < 6) {
+ r[j][k][l] =
+ cpdata[patchdata[i][j * 4 + (3 - k)]][l];
+ if (l == 0)
+ r[j][k][l] *= -1.0;
+ s[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l];
+ if (l == 0)
+ s[j][k][l] *= -1.0;
+ if (l == 1)
+ s[j][k][l] *= -1.0;
+ }
+ }
+ }
+ }
+ glMap2f(GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2,
+ &tex[0][0][0]);
+ glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
+ &p[0][0][0]);
+ glMapGrid2f(grid, 0.0, 1.0, grid, 0.0, 1.0);
+ glEvalMesh2(type, 0, grid, 0, grid);
+ glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
+ &q[0][0][0]);
+ glEvalMesh2(type, 0, grid, 0, grid);
+ if (i < 6) {
+ glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
+ &r[0][0][0]);
+ glEvalMesh2(type, 0, grid, 0, grid);
+ glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
+ &s[0][0][0]);
+ glEvalMesh2(type, 0, grid, 0, grid);
+ }
+ }
+ glPopMatrix();
+ glPopAttrib();
+}
+
+/* CENTRY */
+void APIENTRY
+glutSolidTeapot(GLdouble scale)
+{
+ teapot(7, scale, GL_FILL);
+}
+
+void APIENTRY
+glutWireTeapot(GLdouble scale)
+{
+ teapot(10, scale, GL_LINE);
+}
+
+/* ENDCENTRY */
diff --git a/src/glut/mini/window.c b/src/glut/mini/window.c
new file mode 100644
index 00000000000..73266769c53
--- /dev/null
+++ b/src/glut/mini/window.c
@@ -0,0 +1,273 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 4.1
+ * Copyright (C) 1995-1998 Brian Paul
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * DOS/DJGPP glut driver v1.2 for Mesa 4.1
+ *
+ * Copyright (C) 2002 - Borca Daniel
+ * Email : dborca@yahoo.com
+ * Web : http://www.geocities.com/dborca
+ */
+
+
+#include <stdio.h>
+#include <GL/gl.h>
+#include "GL/glut.h"
+#include "internal.h"
+
+#define USE_MINI_GLX 1
+#if USE_MINI_GLX
+#include "GL/miniglx.h"
+#else
+#include <GL/glx.h>
+#endif
+
+
+
+static GLXContext context = 0;
+static Window win;
+static XVisualInfo *visinfo = 0;
+static Display *dpy = 0;
+
+
+int APIENTRY glutCreateWindow (const char *title)
+{
+ XSetWindowAttributes attr;
+ unsigned long mask;
+ GLXContext ctx;
+ int scrnum = 0;
+ Window root = RootWindow( dpy, scrnum );
+
+ if (win)
+ return 0;
+
+ if (!dpy) {
+ dpy = XOpenDisplay(NULL);
+ if (!dpy) {
+ printf("Error: XOpenDisplay failed\n");
+ exit(1);
+ }
+ }
+
+ if (!visinfo) {
+ int attrib[] = {GLX_RGBA,
+ GLX_RED_SIZE, 1,
+ GLX_GREEN_SIZE, 1,
+ GLX_BLUE_SIZE, 1,
+ GLX_DEPTH_SIZE, 1,
+ GLX_DOUBLEBUFFER,
+ None };
+
+
+ visinfo = glXChooseVisual( dpy, scrnum, attrib );
+ if (!visinfo) {
+ printf("Error: couldn't get an RGB, Double-buffered visual\n");
+ exit(1);
+ }
+ }
+
+ /* window attributes */
+ attr.background_pixel = 0;
+ attr.border_pixel = 0;
+ attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
+ attr.event_mask = StructureNotifyMask | ExposureMask;
+ mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
+
+ win = XCreateWindow( dpy, root, 0, 0, g_width, g_height,
+ 0, visinfo->depth, InputOutput,
+ visinfo->visual, mask, &attr );
+ if (!win) {
+ printf("Error: XCreateWindow failed\n");
+ exit(1);
+ }
+
+ ctx = glXCreateContext( dpy, visinfo, NULL, True );
+ if (!ctx) {
+ printf("Error: glXCreateContext failed\n");
+ exit(1);
+ }
+
+ if (!glXMakeCurrent( dpy, win, ctx )) {
+ printf("Error: glXMakeCurrent failed\n");
+ exit(1);
+ }
+
+ if (!(g_display_mode & GLUT_DOUBLE))
+ glDrawBuffer( GL_FRONT );
+
+
+ XMapWindow( dpy, win );
+
+#if !USE_MINI_GLX
+ {
+ XEvent e;
+ while (1) {
+ XNextEvent( dpy, &e );
+ if (e.type == MapNotify && e.xmap.window == win) {
+ break;
+ }
+ }
+ }
+#endif
+
+ return 1;
+}
+
+
+int APIENTRY glutCreateSubWindow (int win, int x, int y, int width, int height)
+{
+ return GL_FALSE;
+}
+
+
+void APIENTRY glutDestroyWindow (int idx)
+{
+ if (dpy && win)
+ XDestroyWindow( dpy, win );
+
+ if (dpy)
+ XCloseDisplay( dpy );
+
+ win = 0;
+ dpy = 0;
+}
+
+
+void APIENTRY glutPostRedisplay (void)
+{
+ g_redisplay = GL_TRUE;
+}
+
+
+void APIENTRY glutSwapBuffers (void)
+{
+/* if (g_mouse) pc_scare_mouse(); */
+ if (dpy && win) glXSwapBuffers( dpy, win );
+/* if (g_mouse) pc_unscare_mouse(); */
+}
+
+
+int APIENTRY glutGetWindow (void)
+{
+ return 0;
+}
+
+
+void APIENTRY glutSetWindow (int win)
+{
+}
+
+
+void APIENTRY glutSetWindowTitle (const char *title)
+{
+}
+
+
+void APIENTRY glutSetIconTitle (const char *title)
+{
+}
+
+
+void APIENTRY glutPositionWindow (int x, int y)
+{
+}
+
+
+void APIENTRY glutReshapeWindow (int width, int height)
+{
+}
+
+
+void APIENTRY glutPopWindow (void)
+{
+}
+
+
+void APIENTRY glutPushWindow (void)
+{
+}
+
+
+void APIENTRY glutIconifyWindow (void)
+{
+}
+
+
+void APIENTRY glutShowWindow (void)
+{
+}
+
+
+void APIENTRY glutHideWindow (void)
+{
+}
+
+void APIENTRY glutMainLoop (void)
+{
+ GLboolean idle;
+ GLboolean have_event;
+ XEvent evt;
+ int visible = 0;
+
+ glutPostRedisplay();
+ if (reshape_func) reshape_func(g_width, g_height);
+
+ while (GL_TRUE) {
+ idle = GL_TRUE;
+
+
+ if (visible && idle_func)
+ have_event = XCheckMaskEvent( dpy, ~0, &evt );
+ else
+ have_event = XNextEvent( dpy, &evt );
+
+ if (have_event) {
+ idle = GL_FALSE;
+ switch(evt.type) {
+ case MapNotify:
+ if (visibility_func) {
+ visibility_func(GLUT_VISIBLE);
+ }
+ visible = 1;
+ break;
+ case UnmapNotify:
+ if (visibility_func) {
+ visibility_func(GLUT_NOT_VISIBLE);
+ }
+ visible = 0;
+ break;
+ case Expose:
+ g_redisplay = 1;
+ break;
+ }
+ }
+
+ if (visible && g_redisplay && display_func) {
+ idle = GL_FALSE;
+ g_redisplay = GL_FALSE;
+
+ display_func();
+ }
+
+ if (visible && idle && idle_func) {
+ idle_func();
+ }
+ }
+}