mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 22:38:05 +02:00
separated DOS GLUT from GLX GLUT.
added a few FreeGLUT specific functions.
This commit is contained in:
parent
0340663eb7
commit
84396a72df
26 changed files with 16230 additions and 589 deletions
|
|
@ -1,31 +1,25 @@
|
|||
# Mesa 3-D graphics library
|
||||
# Version: 4.0
|
||||
#
|
||||
# Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
#
|
||||
# DOS/DJGPP Mesa Utility Toolkit
|
||||
# Version: 1.0
|
||||
#
|
||||
# Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
# DOS/DJGPP glut makefile v1.6 for Mesa
|
||||
#
|
||||
# Copyright (C) 2002 - Daniel Borca
|
||||
# Email : dborca@users.sourceforge.net
|
||||
# Web : http://www.geocities.com/dborca
|
||||
|
||||
|
||||
#
|
||||
# Available options:
|
||||
|
|
@ -33,8 +27,6 @@
|
|||
# Environment variables:
|
||||
# CFLAGS
|
||||
#
|
||||
# MKGLUT absolute path to original GLUT.
|
||||
# default = $(TOP)/src/glut/glx
|
||||
# GLIDE path to Glide3 SDK; used to resolve DXEs.
|
||||
# default = $(TOP)/glide3
|
||||
#
|
||||
|
|
@ -49,7 +41,6 @@
|
|||
|
||||
TOP = ../../..
|
||||
GLIDE ?= $(TOP)/glide3
|
||||
MKGLUT ?= $(TOP)/src/glut/glx
|
||||
LIBDIR = $(TOP)/lib
|
||||
GLUT_LIB = libglut.a
|
||||
GLUT_DXE = glut.dxe
|
||||
|
|
@ -58,7 +49,7 @@ GLUT_IMP = libiglut.a
|
|||
export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH);$(LIBDIR);$(GLIDE)/lib
|
||||
|
||||
CC = gcc
|
||||
CFLAGS += -I- -I$(TOP)/include -I. -I$(MKGLUT) -IPC_HW
|
||||
CFLAGS += -I$(TOP)/include -I. -IPC_HW
|
||||
CFLAGS += -DGLUT_IMPORT_LIB
|
||||
|
||||
AR = ar
|
||||
|
|
@ -73,6 +64,7 @@ UNLINK = $(RM) $(1)
|
|||
endif
|
||||
|
||||
CORE_SOURCES = \
|
||||
loop.c \
|
||||
callback.c \
|
||||
color.c \
|
||||
extens.c \
|
||||
|
|
@ -82,7 +74,20 @@ CORE_SOURCES = \
|
|||
overlay.c \
|
||||
state.c \
|
||||
util.c \
|
||||
window.c
|
||||
window.c \
|
||||
f8x13.c \
|
||||
f9x15.c \
|
||||
hel10.c \
|
||||
hel12.c \
|
||||
hel18.c \
|
||||
tr10.c \
|
||||
tr24.c \
|
||||
mroman.c \
|
||||
roman.c \
|
||||
bitmap.c \
|
||||
stroke.c \
|
||||
teapot.c \
|
||||
shapes.c
|
||||
|
||||
PC_HW_SOURCES = \
|
||||
PC_HW/pc_hw.c \
|
||||
|
|
@ -91,25 +96,7 @@ PC_HW_SOURCES = \
|
|||
PC_HW/pc_timer.c \
|
||||
PC_HW/pc_irq.S
|
||||
|
||||
MKGLUT_SOURCES = \
|
||||
$(MKGLUT)/glut_bitmap.c \
|
||||
$(MKGLUT)/glut_bwidth.c \
|
||||
$(MKGLUT)/glut_stroke.c \
|
||||
$(MKGLUT)/glut_swidth.c \
|
||||
$(MKGLUT)/glut_shapes.c \
|
||||
$(MKGLUT)/glut_teapot.c \
|
||||
$(MKGLUT)/glut_8x13.c \
|
||||
$(MKGLUT)/glut_9x15.c \
|
||||
$(MKGLUT)/glut_hel10.c \
|
||||
$(MKGLUT)/glut_hel12.c \
|
||||
$(MKGLUT)/glut_hel18.c \
|
||||
$(MKGLUT)/glut_tr10.c \
|
||||
$(MKGLUT)/glut_tr24.c \
|
||||
$(MKGLUT)/glut_roman.c \
|
||||
$(MKGLUT)/glut_mroman.c \
|
||||
$(MKGLUT)/glut_util.c
|
||||
|
||||
SOURCES = $(CORE_SOURCES) $(PC_HW_SOURCES) $(MKGLUT_SOURCES)
|
||||
SOURCES = $(CORE_SOURCES) $(PC_HW_SOURCES)
|
||||
|
||||
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
|
||||
|
||||
|
|
@ -129,12 +116,11 @@ $(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS)
|
|||
ifeq ($(HAVEDXE3),)
|
||||
$(warning Missing DXE3 package... Skipping $(GLUT_DXE))
|
||||
else
|
||||
-dxe3gen -o $(LIBDIR)/$(GLUT_DXE) -Y $(LIBDIR)/$(GLUT_IMP) -D "MesaGLUT DJGPP" -E _glut -P gl.dxe -P glu.dxe -U $^
|
||||
-dxe3gen -o $(LIBDIR)/$(GLUT_DXE) -Y $(LIBDIR)/$(GLUT_IMP) -D "MesaGLUT DJGPP" -E _glut -P gl.dxe -U $^
|
||||
endif
|
||||
|
||||
clean:
|
||||
-$(call UNLINK,*.o)
|
||||
-$(call UNLINK,PC_HW/*.o)
|
||||
-$(call UNLINK,$(MKGLUT)/*.o)
|
||||
|
||||
-include depend
|
||||
|
|
|
|||
115
src/glut/dos/bitmap.c
Normal file
115
src/glut/dos/bitmap.c
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutBitmapCharacter (void *font, int c)
|
||||
{
|
||||
const GLUTBitmapFont *bfp = _glut_font(font);
|
||||
const GLUTBitmapChar *bcp;
|
||||
|
||||
if (c >= bfp->num || !(bcp = bfp->table[c]))
|
||||
return;
|
||||
|
||||
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
|
||||
|
||||
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(bcp->width, bcp->height, bcp->xorig, bcp->yorig,
|
||||
bcp->xmove, 0, bcp->bitmap);
|
||||
|
||||
glPopClientAttrib();
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutBitmapString (void *font, const unsigned char *string)
|
||||
{
|
||||
const GLUTBitmapFont *bfp = _glut_font(font);
|
||||
const GLUTBitmapChar *bcp;
|
||||
unsigned char c;
|
||||
|
||||
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
|
||||
|
||||
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);
|
||||
|
||||
while ((c = *(string++))) {
|
||||
if (c < bfp->num && (bcp = bfp->table[c]))
|
||||
glBitmap(bcp->width, bcp->height, bcp->xorig,
|
||||
bcp->yorig, bcp->xmove, 0, bcp->bitmap);
|
||||
}
|
||||
|
||||
glPopClientAttrib();
|
||||
}
|
||||
|
||||
|
||||
int APIENTRY
|
||||
glutBitmapWidth (void *font, int c)
|
||||
{
|
||||
const GLUTBitmapFont *bfp = _glut_font(font);
|
||||
const GLUTBitmapChar *bcp;
|
||||
|
||||
if (c >= bfp->num || !(bcp = bfp->table[c]))
|
||||
return 0;
|
||||
|
||||
return bcp->xmove;
|
||||
}
|
||||
|
||||
|
||||
int APIENTRY
|
||||
glutBitmapLength (void *font, const unsigned char *string)
|
||||
{
|
||||
const GLUTBitmapFont *bfp = _glut_font(font);
|
||||
const GLUTBitmapChar *bcp;
|
||||
unsigned char c;
|
||||
int length = 0;
|
||||
|
||||
while ((c = *(string++))) {
|
||||
if (c < bfp->num && (bcp = bfp->table[c]))
|
||||
length += bcp->xmove;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
int APIENTRY
|
||||
glutBitmapHeight (void *font)
|
||||
{
|
||||
const GLUTBitmapFont *bfp = _glut_font(font);
|
||||
|
||||
return bfp->height;
|
||||
}
|
||||
|
|
@ -1,106 +1,103 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* 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.
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* 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.
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.6 for Mesa
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
#include "glutint.h"
|
||||
GLUTSShotCB _glut_timer_cb[MAX_TIMER_CB];
|
||||
|
||||
|
||||
GLUTSShotCB g_sscb[MAX_SSHOT_CB];
|
||||
|
||||
GLUTidleCB g_idle_func = NULL;
|
||||
GLUTidleCB _glut_idle_func = NULL;
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutDisplayFunc (GLUTdisplayCB func)
|
||||
{
|
||||
g_curwin->display = func;
|
||||
_glut_current->display = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutReshapeFunc (GLUTreshapeCB func)
|
||||
{
|
||||
g_curwin->reshape = func;
|
||||
_glut_current->reshape = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutKeyboardFunc (GLUTkeyboardCB func)
|
||||
{
|
||||
g_curwin->keyboard = func;
|
||||
_glut_current->keyboard = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutMouseFunc (GLUTmouseCB func)
|
||||
{
|
||||
g_curwin->mouse = func;
|
||||
_glut_current->mouse = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutMotionFunc (GLUTmotionCB func)
|
||||
{
|
||||
g_curwin->motion = func;
|
||||
_glut_current->motion = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutPassiveMotionFunc (GLUTpassiveCB func)
|
||||
{
|
||||
g_curwin->passive = func;
|
||||
_glut_current->passive = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutEntryFunc (GLUTentryCB func)
|
||||
{
|
||||
g_curwin->entry = func;
|
||||
_glut_current->entry = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutVisibilityFunc (GLUTvisibilityCB func)
|
||||
{
|
||||
g_curwin->visibility = func;
|
||||
_glut_current->visibility = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutWindowStatusFunc (GLUTwindowStatusCB func)
|
||||
{
|
||||
_glut_current->windowStatus = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutIdleFunc (GLUTidleCB func)
|
||||
{
|
||||
g_idle_func = func;
|
||||
_glut_idle_func = func;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -110,8 +107,8 @@ glutTimerFunc (unsigned int millis, GLUTtimerCB func, int value)
|
|||
int i;
|
||||
|
||||
if (millis > 0) {
|
||||
for (i = 0; i < MAX_SSHOT_CB; i++) {
|
||||
GLUTSShotCB *cb = &g_sscb[i];
|
||||
for (i = 0; i < MAX_TIMER_CB; i++) {
|
||||
GLUTSShotCB *cb = &_glut_timer_cb[i];
|
||||
if (cb->func == NULL) {
|
||||
cb->value = value;
|
||||
cb->func = func;
|
||||
|
|
@ -126,53 +123,82 @@ glutTimerFunc (unsigned int millis, GLUTtimerCB func, int value)
|
|||
void APIENTRY
|
||||
glutSpecialFunc (GLUTspecialCB func)
|
||||
{
|
||||
g_curwin->special = func;
|
||||
_glut_current->special = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutSpaceballMotionFunc (GLUTspaceMotionCB func)
|
||||
{
|
||||
_glut_current->spaceMotion = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutSpaceballRotateFunc (GLUTspaceRotateCB func)
|
||||
{
|
||||
_glut_current->spaceRotate = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutSpaceballButtonFunc (GLUTspaceButtonCB func)
|
||||
{
|
||||
_glut_current->spaceButton = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutDialsFunc (GLUTdialsCB func)
|
||||
{
|
||||
_glut_current->dials = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutButtonBoxFunc (GLUTbuttonBoxCB func)
|
||||
{
|
||||
_glut_current->buttonBox = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutTabletMotionFunc (GLUTtabletMotionCB func)
|
||||
{
|
||||
_glut_current->tabletMotion = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutTabletButtonFunc (GLUTtabletButtonCB func)
|
||||
{
|
||||
_glut_current->tabletButton = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutJoystickFunc (GLUTjoystickCB func, int interval)
|
||||
{
|
||||
_glut_current->joystick = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutKeyboardUpFunc (GLUTkeyboardCB func)
|
||||
{
|
||||
_glut_current->keyboardUp = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutSpecialUpFunc (GLUTspecialCB func)
|
||||
{
|
||||
_glut_current->specialUp = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutMouseWheelFunc (GLUTmouseWheelCB func)
|
||||
{
|
||||
_glut_current->mouseWheel = func;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,34 +1,29 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* 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.
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* 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.
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.3 for Mesa
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
|
||||
#include "glutint.h"
|
||||
#include "GL/dmesa.h"
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
#define CLAMP(i) ((i) > 1.0F ? 1.0F : ((i) < 0.0F ? 0.0F : (i)))
|
||||
|
|
@ -37,7 +32,7 @@
|
|||
void APIENTRY
|
||||
glutSetColor (int ndx, GLfloat red, GLfloat green, GLfloat blue)
|
||||
{
|
||||
if (g_display_mode & GLUT_INDEX) {
|
||||
if (_glut_default.mode & GLUT_INDEX) {
|
||||
if ((ndx >= 0) && (ndx < (256 - RESERVED_COLORS))) {
|
||||
DMesaSetCI(ndx, CLAMP(red), CLAMP(green), CLAMP(blue));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,37 +1,31 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* 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.
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* 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.5 for Mesa
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include "GL/dmesa.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
int APIENTRY
|
||||
|
|
|
|||
1183
src/glut/dos/f8x13.c
Normal file
1183
src/glut/dos/f8x13.c
Normal file
File diff suppressed because it is too large
Load diff
1407
src/glut/dos/f9x15.c
Normal file
1407
src/glut/dos/f9x15.c
Normal file
File diff suppressed because it is too large
Load diff
1019
src/glut/dos/hel10.c
Normal file
1019
src/glut/dos/hel10.c
Normal file
File diff suppressed because it is too large
Load diff
1029
src/glut/dos/hel12.c
Normal file
1029
src/glut/dos/hel12.c
Normal file
File diff suppressed because it is too large
Load diff
1138
src/glut/dos/hel18.c
Normal file
1138
src/glut/dos/hel18.c
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,63 +1,88 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 4.0
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* 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.
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* 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.5 for Mesa
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@users.sourceforge.net
|
||||
* Web : http://www.geocities.com/dborca
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "glutint.h"
|
||||
#include "internal.h"
|
||||
|
||||
#define DEFAULT_WIDTH 300
|
||||
#define DEFAULT_HEIGHT 300
|
||||
#define DEFAULT_BPP 16
|
||||
|
||||
#define ALPHA_SIZE 8
|
||||
#define DEPTH_SIZE 16
|
||||
#define STENCIL_SIZE 8
|
||||
#define ACCUM_SIZE 16
|
||||
|
||||
|
||||
GLuint g_bpp = DEFAULT_BPP;
|
||||
GLuint g_alpha = ALPHA_SIZE;
|
||||
GLuint g_depth = DEPTH_SIZE;
|
||||
GLuint g_stencil = STENCIL_SIZE;
|
||||
GLuint g_accum = ACCUM_SIZE;
|
||||
GLuint g_refresh = 0;
|
||||
GLuint g_screen_w, g_screen_h;
|
||||
GLint g_driver_caps;
|
||||
|
||||
GLuint g_fps = 0;
|
||||
|
||||
GLuint g_display_mode = 0;
|
||||
int g_init_x = 0, g_init_y = 0;
|
||||
GLuint g_init_w = DEFAULT_WIDTH, g_init_h = DEFAULT_HEIGHT;
|
||||
|
||||
char *__glutProgramName = NULL;
|
||||
|
||||
GLUTvisual _glut_visual = {
|
||||
16, 8, 16, 8, 16, /* bpp, alpha, depth, stencil, accum */
|
||||
|
||||
{ 0, 0 }, 0, /* geometry */
|
||||
|
||||
0 /* flags */
|
||||
};
|
||||
|
||||
GLUTdefault _glut_default = {
|
||||
0, 0, /* glutInitWindowPosition */
|
||||
300, 300, /* glutInitWindowSize */
|
||||
0 /* glutInitDisplayMode */
|
||||
};
|
||||
|
||||
GLuint _glut_fps = 0;
|
||||
|
||||
static char *init_string;
|
||||
|
||||
|
||||
void
|
||||
_glut_fatal (char *format,...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
fprintf(stderr, "GLUT: Fatal Error in %s: ",
|
||||
__glutProgramName ? __glutProgramName : "(unamed)");
|
||||
vfprintf(stderr, format, args);
|
||||
va_end(args);
|
||||
putc('\n', stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* strdup is actually not a standard ANSI C or POSIX routine
|
||||
* so implement a private one for GLUT.
|
||||
*/
|
||||
static char *
|
||||
_glut_strdup (const char *string)
|
||||
{
|
||||
if (string != NULL) {
|
||||
int len = strlen(string) + 1;
|
||||
char *p = malloc(len);
|
||||
if (p != NULL) {
|
||||
return strcpy(p, string);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutInit (int *argc, char **argv)
|
||||
|
|
@ -66,22 +91,22 @@ glutInit (int *argc, char **argv)
|
|||
const char *env;
|
||||
|
||||
if ((env = getenv("DMESA_GLUT_BPP")) != NULL) {
|
||||
g_bpp = atoi(env);
|
||||
_glut_visual.bpp = atoi(env);
|
||||
}
|
||||
if ((env = getenv("DMESA_GLUT_ALPHA")) != NULL) {
|
||||
g_alpha = atoi(env);
|
||||
_glut_visual.alpha = atoi(env);
|
||||
}
|
||||
if ((env = getenv("DMESA_GLUT_DEPTH")) != NULL) {
|
||||
g_depth = atoi(env);
|
||||
_glut_visual.depth = atoi(env);
|
||||
}
|
||||
if ((env = getenv("DMESA_GLUT_STENCIL")) != NULL) {
|
||||
g_stencil = atoi(env);
|
||||
_glut_visual.stencil = atoi(env);
|
||||
}
|
||||
if ((env = getenv("DMESA_GLUT_ACCUM")) != NULL) {
|
||||
g_accum = atoi(env);
|
||||
_glut_visual.accum = atoi(env);
|
||||
}
|
||||
if ((env = getenv("DMESA_GLUT_REFRESH")) != NULL) {
|
||||
g_refresh = atoi(env);
|
||||
_glut_visual.refresh = atoi(env);
|
||||
}
|
||||
|
||||
/* Determine program name. */
|
||||
|
|
@ -91,12 +116,12 @@ glutInit (int *argc, char **argv)
|
|||
} else {
|
||||
str++;
|
||||
}
|
||||
__glutProgramName = __glutStrdup(str);
|
||||
__glutProgramName = _glut_strdup(str);
|
||||
|
||||
/* check if GLUT_FPS env var is set */
|
||||
if ((env = getenv("GLUT_FPS")) != NULL) {
|
||||
if ((g_fps = atoi(env)) <= 0) {
|
||||
g_fps = 5000; /* 5000 milliseconds */
|
||||
if ((_glut_fps = atoi(env)) <= 0) {
|
||||
_glut_fps = 5000; /* 5000 milliseconds */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -108,220 +133,91 @@ glutInit (int *argc, char **argv)
|
|||
void APIENTRY
|
||||
glutInitDisplayMode (unsigned int mode)
|
||||
{
|
||||
g_display_mode = mode;
|
||||
_glut_default.mode = mode;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutInitWindowPosition (int x, int y)
|
||||
{
|
||||
g_init_x = x;
|
||||
g_init_y = y;
|
||||
_glut_default.x = x;
|
||||
_glut_default.y = y;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutInitWindowSize (int width, int height)
|
||||
{
|
||||
g_init_w = width;
|
||||
g_init_h = height;
|
||||
_glut_default.width = width;
|
||||
_glut_default.height = height;
|
||||
}
|
||||
|
||||
|
||||
#define DO_REDISPLAY(w, ccin, ccout) \
|
||||
do { \
|
||||
if (w->redisplay && w->display) { \
|
||||
int rv = GL_TRUE; \
|
||||
\
|
||||
idle = GL_FALSE; \
|
||||
w->redisplay = GL_FALSE; \
|
||||
\
|
||||
/* test IN condition (whether we need to `MakeCurrent') */\
|
||||
if (ccin) { \
|
||||
rv = DMesaMakeCurrent(w->context, w->buffer); \
|
||||
} \
|
||||
\
|
||||
/* do the display only if `MakeCurrent' didn't failed */ \
|
||||
if (rv) { \
|
||||
if (w->show_mouse && !(g_display_mode & GLUT_DOUBLE)) {\
|
||||
/* XXX scare mouse */ \
|
||||
w->display(); \
|
||||
/* XXX unscare mouse */ \
|
||||
} else { \
|
||||
w->display(); \
|
||||
} \
|
||||
\
|
||||
/* update OUT condition */ \
|
||||
ccout; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutMainLoop (void)
|
||||
glutInitDisplayString (const char *string)
|
||||
{
|
||||
int i, n;
|
||||
GLUTwindow *w;
|
||||
GLboolean idle;
|
||||
static int old_mouse_x = 0;
|
||||
static int old_mouse_y = 0;
|
||||
static int old_mouse_b = 0;
|
||||
init_string = _glut_strdup(string);
|
||||
}
|
||||
|
||||
{
|
||||
GLint screen_size[2];
|
||||
DMesaGetIntegerv(DMESA_GET_SCREEN_SIZE, screen_size);
|
||||
g_screen_w = screen_size[0];
|
||||
g_screen_h = screen_size[1];
|
||||
DMesaGetIntegerv(DMESA_GET_DRIVER_CAPS, &g_driver_caps);
|
||||
}
|
||||
|
||||
pc_install_keyb();
|
||||
__glutInitMouse();
|
||||
|
||||
for (i = 0; i < MAX_WINDOWS; i++) {
|
||||
w = g_windows[i];
|
||||
if (w != NULL) {
|
||||
glutSetWindow(w->num);
|
||||
glutPostRedisplay();
|
||||
if (w->reshape) {
|
||||
w->reshape(w->width, w->height);
|
||||
}
|
||||
if (w->visibility) {
|
||||
w->visibility(GLUT_VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (GL_TRUE) {
|
||||
idle = GL_TRUE;
|
||||
|
||||
n = 0;
|
||||
for (i = 0; i < MAX_WINDOWS; i++) {
|
||||
w = g_windows[i];
|
||||
if ((w != NULL) && (w != g_curwin)) {
|
||||
/* 1) redisplay `w'
|
||||
* 2) `MakeCurrent' always
|
||||
* 3) update number of non-default windows
|
||||
*/
|
||||
DO_REDISPLAY(w, GL_TRUE, n++);
|
||||
}
|
||||
}
|
||||
/* 1) redisplay `g_curwin'
|
||||
* 2) `MakeCurrent' only if we previously did non-default windows
|
||||
* 3) don't update anything
|
||||
*/
|
||||
DO_REDISPLAY(g_curwin, n, n);
|
||||
|
||||
if (g_mouse) {
|
||||
int mouse_x;
|
||||
int mouse_y;
|
||||
int mouse_z;
|
||||
int mouse_b;
|
||||
|
||||
/* query mouse */
|
||||
mouse_b = pc_query_mouse(&mouse_x, &mouse_y, &mouse_z);
|
||||
|
||||
/* relative to window coordinates */
|
||||
g_mouse_x = mouse_x - g_curwin->xpos;
|
||||
g_mouse_y = mouse_y - g_curwin->ypos;
|
||||
|
||||
/* mouse was moved? */
|
||||
if ((mouse_x != old_mouse_x) || (mouse_y != old_mouse_y)) {
|
||||
idle = GL_FALSE;
|
||||
old_mouse_x = mouse_x;
|
||||
old_mouse_y = mouse_y;
|
||||
|
||||
if (mouse_b) {
|
||||
/* any button pressed */
|
||||
if (g_curwin->motion) {
|
||||
g_curwin->motion(g_mouse_x, g_mouse_y);
|
||||
}
|
||||
} else {
|
||||
/* no button pressed */
|
||||
if (g_curwin->passive) {
|
||||
g_curwin->passive(g_mouse_x, g_mouse_y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* button state changed? */
|
||||
if (mouse_b != old_mouse_b) {
|
||||
GLUTmouseCB mouse_func;
|
||||
|
||||
if ((mouse_func = g_curwin->mouse)) {
|
||||
if ((old_mouse_b & 1) && !(mouse_b & 1))
|
||||
mouse_func(GLUT_LEFT_BUTTON, GLUT_UP, g_mouse_x, g_mouse_y);
|
||||
else if (!(old_mouse_b & 1) && (mouse_b & 1))
|
||||
mouse_func(GLUT_LEFT_BUTTON, GLUT_DOWN, g_mouse_x, g_mouse_y);
|
||||
|
||||
if ((old_mouse_b & 2) && !(mouse_b & 2))
|
||||
mouse_func(GLUT_RIGHT_BUTTON, GLUT_UP, g_mouse_x, g_mouse_y);
|
||||
else if (!(old_mouse_b & 2) && (mouse_b & 2))
|
||||
mouse_func(GLUT_RIGHT_BUTTON, GLUT_DOWN, g_mouse_x, g_mouse_y);
|
||||
|
||||
if ((old_mouse_b & 4) && !(mouse_b & 4))
|
||||
mouse_func(GLUT_MIDDLE_BUTTON, GLUT_UP, g_mouse_x, g_mouse_y);
|
||||
else if (!(old_mouse_b & 3) && (mouse_b & 4))
|
||||
mouse_func(GLUT_MIDDLE_BUTTON, GLUT_DOWN, g_mouse_x, g_mouse_y);
|
||||
}
|
||||
|
||||
idle = GL_FALSE;
|
||||
old_mouse_b = mouse_b;
|
||||
}
|
||||
}
|
||||
|
||||
if (pc_keypressed()) {
|
||||
int key;
|
||||
int glut_key;
|
||||
|
||||
idle = GL_FALSE;
|
||||
key = pc_readkey();
|
||||
|
||||
switch (key>>16) {
|
||||
case KEY_F1: glut_key = GLUT_KEY_F1; goto special;
|
||||
case KEY_F2: glut_key = GLUT_KEY_F2; goto special;
|
||||
case KEY_F3: glut_key = GLUT_KEY_F3; goto special;
|
||||
case KEY_F4: glut_key = GLUT_KEY_F4; goto special;
|
||||
case KEY_F5: glut_key = GLUT_KEY_F5; goto special;
|
||||
case KEY_F6: glut_key = GLUT_KEY_F6; goto special;
|
||||
case KEY_F7: glut_key = GLUT_KEY_F7; goto special;
|
||||
case KEY_F8: glut_key = GLUT_KEY_F8; goto special;
|
||||
case KEY_F9: glut_key = GLUT_KEY_F9; goto special;
|
||||
case KEY_F10: glut_key = GLUT_KEY_F10; goto special;
|
||||
case KEY_F11: glut_key = GLUT_KEY_F11; goto special;
|
||||
case KEY_F12: glut_key = GLUT_KEY_F12; goto special;
|
||||
case KEY_LEFT: glut_key = GLUT_KEY_LEFT; goto special;
|
||||
case KEY_UP: glut_key = GLUT_KEY_UP; goto special;
|
||||
case KEY_RIGHT: glut_key = GLUT_KEY_RIGHT; goto special;
|
||||
case KEY_DOWN: glut_key = GLUT_KEY_DOWN; goto special;
|
||||
case KEY_PGUP: glut_key = GLUT_KEY_PAGE_UP; goto special;
|
||||
case KEY_PGDN: glut_key = GLUT_KEY_PAGE_DOWN; goto special;
|
||||
case KEY_HOME: glut_key = GLUT_KEY_HOME; goto special;
|
||||
case KEY_END: glut_key = GLUT_KEY_END; goto special;
|
||||
case KEY_INSERT: glut_key = GLUT_KEY_INSERT; goto special;
|
||||
special:
|
||||
if (g_curwin->special) {
|
||||
g_curwin->special(glut_key, g_mouse_x, g_mouse_y);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (g_curwin->keyboard) {
|
||||
g_curwin->keyboard(key & 0xFF, g_mouse_x, g_mouse_y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (idle && g_idle_func)
|
||||
g_idle_func();
|
||||
|
||||
for (i = 0; i < MAX_SSHOT_CB; i++) {
|
||||
int time = glutGet(GLUT_ELAPSED_TIME);
|
||||
GLUTSShotCB *cb = &g_sscb[i];
|
||||
if (cb->func && (time >= cb->time)) {
|
||||
cb->func(cb->value);
|
||||
cb->func = NULL;
|
||||
}
|
||||
}
|
||||
void APIENTRY
|
||||
glutSetOption (GLenum pname, int value)
|
||||
{
|
||||
switch (pname) {
|
||||
case GLUT_INIT_WINDOW_X:
|
||||
_glut_default.x = value;
|
||||
break;
|
||||
case GLUT_INIT_WINDOW_Y:
|
||||
_glut_default.y = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutForceJoystickFunc (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutIgnoreKeyRepeat (int ignore)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutSetKeyRepeat (int repeatMode)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutVideoPan (int x, int y, int w, int h)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int APIENTRY
|
||||
glutVideoResizeGet( GLenum eWhat )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutSetupVideoResizing (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutStopVideoResizing (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutVideoResize (int x, int y, int w, int h)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
197
src/glut/dos/internal.h
Normal file
197
src/glut/dos/internal.h
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
/*
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INTERNAL_H_included
|
||||
#define INTERNAL_H_included
|
||||
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include "GL/dmesa.h"
|
||||
|
||||
|
||||
#define MAX_WINDOWS 2
|
||||
#define MAX_TIMER_CB 8
|
||||
#define RESERVED_COLORS 0
|
||||
|
||||
|
||||
/* GLUT function types */
|
||||
typedef void (GLUTCALLBACK *GLUTdisplayCB) (void);
|
||||
typedef void (GLUTCALLBACK *GLUTreshapeCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTkeyboardCB) (unsigned char, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTmouseCB) (int, int, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTmotionCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTpassiveCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTentryCB) (int);
|
||||
typedef void (GLUTCALLBACK *GLUTvisibilityCB) (int);
|
||||
typedef void (GLUTCALLBACK *GLUTwindowStatusCB) (int);
|
||||
typedef void (GLUTCALLBACK *GLUTidleCB) (void);
|
||||
typedef void (GLUTCALLBACK *GLUTtimerCB) (int);
|
||||
typedef void (GLUTCALLBACK *GLUTmenuStateCB) (int); /* DEPRECATED. */
|
||||
typedef void (GLUTCALLBACK *GLUTmenuStatusCB) (int, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTselectCB) (int);
|
||||
typedef void (GLUTCALLBACK *GLUTspecialCB) (int, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTspaceMotionCB) (int, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTspaceRotateCB) (int, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTspaceButtonCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTdialsCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTbuttonBoxCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTtabletMotionCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTtabletButtonCB) (int, int, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTjoystickCB) (unsigned int, int, int, int);
|
||||
|
||||
typedef void (GLUTCALLBACK *GLUTdestroyCB) (void);
|
||||
typedef void (GLUTCALLBACK *GLUTmouseWheelCB) (int, int, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTmenuDestroyCB) (void);
|
||||
|
||||
|
||||
typedef struct {
|
||||
GLuint bpp, alpha;
|
||||
GLuint depth, stencil;
|
||||
GLuint accum;
|
||||
|
||||
GLint geometry[2];
|
||||
GLuint refresh;
|
||||
|
||||
GLint flags;
|
||||
} GLUTvisual;
|
||||
|
||||
typedef struct {
|
||||
GLint x, y;
|
||||
GLint width, height;
|
||||
GLuint mode;
|
||||
} GLUTdefault;
|
||||
|
||||
typedef struct {
|
||||
void (*func) (int);
|
||||
int value;
|
||||
int time;
|
||||
} GLUTSShotCB;
|
||||
|
||||
typedef struct GLUTwindow {
|
||||
int num; /* window id */
|
||||
|
||||
DMesaContext context;
|
||||
DMesaBuffer buffer;
|
||||
|
||||
int show_mouse;
|
||||
GLboolean redisplay;
|
||||
|
||||
/* GLUT settable or visible window state. */
|
||||
int xpos;
|
||||
int ypos;
|
||||
int width; /* window width in pixels */
|
||||
int height; /* window height in pixels */
|
||||
|
||||
/* Per-window callbacks. */
|
||||
GLUTdisplayCB display; /* redraw */
|
||||
GLUTreshapeCB reshape; /* resize (width,height) */
|
||||
GLUTmouseCB mouse; /* mouse (button,state,x,y) */
|
||||
GLUTmotionCB motion; /* motion (x,y) */
|
||||
GLUTpassiveCB passive; /* passive motion (x,y) */
|
||||
GLUTentryCB entry; /* window entry/exit (state) */
|
||||
GLUTkeyboardCB keyboard; /* keyboard (ASCII,x,y) */
|
||||
GLUTkeyboardCB keyboardUp; /* keyboard up (ASCII,x,y) */
|
||||
GLUTwindowStatusCB windowStatus; /* window status */
|
||||
GLUTvisibilityCB visibility; /* visibility */
|
||||
GLUTspecialCB special; /* special key */
|
||||
GLUTspecialCB specialUp; /* special up key */
|
||||
GLUTbuttonBoxCB buttonBox; /* button box */
|
||||
GLUTdialsCB dials; /* dials */
|
||||
GLUTspaceMotionCB spaceMotion; /* Spaceball motion */
|
||||
GLUTspaceRotateCB spaceRotate; /* Spaceball rotate */
|
||||
GLUTspaceButtonCB spaceButton; /* Spaceball button */
|
||||
GLUTtabletMotionCB tabletMotion; /* tablet motion */
|
||||
GLUTtabletButtonCB tabletButton; /* tablet button */
|
||||
GLUTjoystickCB joystick; /* joystick */
|
||||
|
||||
GLUTdestroyCB destroy; /* destroy */
|
||||
GLUTmouseWheelCB mouseWheel; /* mouse wheel */
|
||||
|
||||
/* specific data */
|
||||
void *data;
|
||||
} GLUTwindow;
|
||||
|
||||
typedef struct {
|
||||
int width, height;
|
||||
int xorig, yorig;
|
||||
int xmove;
|
||||
const unsigned char *bitmap;
|
||||
} GLUTBitmapChar;
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
int height;
|
||||
int num;
|
||||
const GLUTBitmapChar *const *table;
|
||||
} GLUTBitmapFont;
|
||||
|
||||
typedef struct {
|
||||
const GLfloat x, y;
|
||||
} GLUTStrokeVertex;
|
||||
|
||||
typedef struct {
|
||||
const unsigned num;
|
||||
const GLUTStrokeVertex *vertex;
|
||||
} GLUTStrokeStrip;
|
||||
|
||||
typedef struct {
|
||||
const GLfloat right;
|
||||
const unsigned num;
|
||||
const GLUTStrokeStrip *strip;
|
||||
} GLUTStrokeChar;
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
const unsigned num;
|
||||
const GLUTStrokeChar *const *table;
|
||||
const GLfloat height;
|
||||
const GLfloat descent;
|
||||
} GLUTStrokeFont;
|
||||
|
||||
|
||||
extern char *__glutProgramName;
|
||||
|
||||
extern GLUTvisual _glut_visual;
|
||||
extern GLUTdefault _glut_default;
|
||||
|
||||
extern GLuint _glut_fps;
|
||||
extern GLUTidleCB _glut_idle_func;
|
||||
extern GLUTmenuStatusCB _glut_menu_status_func;
|
||||
extern GLUTSShotCB _glut_timer_cb[];
|
||||
|
||||
extern GLUTwindow *_glut_current, *_glut_windows[];
|
||||
|
||||
extern int _glut_mouse; /* number of buttons, if mouse installed */
|
||||
extern int _glut_mouse_x, _glut_mouse_y; /* mouse coords, relative to current win */
|
||||
|
||||
|
||||
extern void _glut_mouse_init (void);
|
||||
extern void _glut_fatal(char *format,...);
|
||||
extern void *_glut_font (void *font);
|
||||
|
||||
|
||||
#include "pc_hw/pc_hw.h"
|
||||
|
||||
#endif
|
||||
245
src/glut/dos/loop.c
Normal file
245
src/glut/dos/loop.c
Normal file
|
|
@ -0,0 +1,245 @@
|
|||
/*
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <GL/glut.h>
|
||||
#include "GL/dmesa.h"
|
||||
|
||||
#include "PC_HW/pc_hw.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
static int looping = 0;
|
||||
|
||||
|
||||
#define DO_REDISPLAY(w, ccin, ccout) \
|
||||
do { \
|
||||
if (w->redisplay && w->display) { \
|
||||
int rv = GL_TRUE; \
|
||||
\
|
||||
idle = GL_FALSE; \
|
||||
w->redisplay = GL_FALSE; \
|
||||
\
|
||||
/* test IN condition (whether we need to `MakeCurrent') */\
|
||||
if (ccin) { \
|
||||
rv = DMesaMakeCurrent(w->context, w->buffer); \
|
||||
} \
|
||||
\
|
||||
/* do the display only if `MakeCurrent' didn't failed */ \
|
||||
if (rv) { \
|
||||
if (w->show_mouse && !(_glut_default.mode & GLUT_DOUBLE)) {\
|
||||
/* XXX scare mouse */ \
|
||||
w->display(); \
|
||||
/* XXX unscare mouse */ \
|
||||
} else { \
|
||||
w->display(); \
|
||||
} \
|
||||
\
|
||||
/* update OUT condition */ \
|
||||
ccout; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutMainLoopEvent (void)
|
||||
{
|
||||
int i, n;
|
||||
GLUTwindow *w;
|
||||
GLboolean idle;
|
||||
static int old_mouse_x = 0;
|
||||
static int old_mouse_y = 0;
|
||||
static int old_mouse_b = 0;
|
||||
|
||||
static GLboolean virgin = GL_TRUE;
|
||||
if (virgin) {
|
||||
pc_install_keyb();
|
||||
_glut_mouse_init();
|
||||
|
||||
for (i = 0; i < MAX_WINDOWS; i++) {
|
||||
w = _glut_windows[i];
|
||||
if (w != NULL) {
|
||||
glutSetWindow(w->num);
|
||||
glutPostRedisplay();
|
||||
if (w->reshape) {
|
||||
w->reshape(w->width, w->height);
|
||||
}
|
||||
if (w->visibility) {
|
||||
w->visibility(GLUT_VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
virgin = GL_FALSE;
|
||||
}
|
||||
|
||||
idle = GL_TRUE;
|
||||
|
||||
n = 0;
|
||||
for (i = 0; i < MAX_WINDOWS; i++) {
|
||||
w = _glut_windows[i];
|
||||
if ((w != NULL) && (w != _glut_current)) {
|
||||
/* 1) redisplay `w'
|
||||
* 2) `MakeCurrent' always
|
||||
* 3) update number of non-default windows
|
||||
*/
|
||||
DO_REDISPLAY(w, GL_TRUE, n++);
|
||||
}
|
||||
}
|
||||
/* 1) redisplay `_glut_current'
|
||||
* 2) `MakeCurrent' only if we previously did non-default windows
|
||||
* 3) don't update anything
|
||||
*/
|
||||
DO_REDISPLAY(_glut_current, n, n);
|
||||
|
||||
if (_glut_mouse) {
|
||||
int mouse_x;
|
||||
int mouse_y;
|
||||
int mouse_z;
|
||||
int mouse_b;
|
||||
|
||||
/* query mouse */
|
||||
mouse_b = pc_query_mouse(&mouse_x, &mouse_y, &mouse_z);
|
||||
|
||||
/* relative to window coordinates */
|
||||
_glut_mouse_x = mouse_x - _glut_current->xpos;
|
||||
_glut_mouse_y = mouse_y - _glut_current->ypos;
|
||||
|
||||
/* mouse was moved? */
|
||||
if ((mouse_x != old_mouse_x) || (mouse_y != old_mouse_y)) {
|
||||
idle = GL_FALSE;
|
||||
old_mouse_x = mouse_x;
|
||||
old_mouse_y = mouse_y;
|
||||
|
||||
if (mouse_b) {
|
||||
/* any button pressed */
|
||||
if (_glut_current->motion) {
|
||||
_glut_current->motion(_glut_mouse_x, _glut_mouse_y);
|
||||
}
|
||||
} else {
|
||||
/* no button pressed */
|
||||
if (_glut_current->passive) {
|
||||
_glut_current->passive(_glut_mouse_x, _glut_mouse_y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* button state changed? */
|
||||
if (mouse_b != old_mouse_b) {
|
||||
GLUTmouseCB mouse_func;
|
||||
|
||||
if ((mouse_func = _glut_current->mouse)) {
|
||||
if ((old_mouse_b & 1) && !(mouse_b & 1))
|
||||
mouse_func(GLUT_LEFT_BUTTON, GLUT_UP, _glut_mouse_x, _glut_mouse_y);
|
||||
else if (!(old_mouse_b & 1) && (mouse_b & 1))
|
||||
mouse_func(GLUT_LEFT_BUTTON, GLUT_DOWN, _glut_mouse_x, _glut_mouse_y);
|
||||
|
||||
if ((old_mouse_b & 2) && !(mouse_b & 2))
|
||||
mouse_func(GLUT_RIGHT_BUTTON, GLUT_UP, _glut_mouse_x, _glut_mouse_y);
|
||||
else if (!(old_mouse_b & 2) && (mouse_b & 2))
|
||||
mouse_func(GLUT_RIGHT_BUTTON, GLUT_DOWN, _glut_mouse_x, _glut_mouse_y);
|
||||
|
||||
if ((old_mouse_b & 4) && !(mouse_b & 4))
|
||||
mouse_func(GLUT_MIDDLE_BUTTON, GLUT_UP, _glut_mouse_x, _glut_mouse_y);
|
||||
else if (!(old_mouse_b & 3) && (mouse_b & 4))
|
||||
mouse_func(GLUT_MIDDLE_BUTTON, GLUT_DOWN, _glut_mouse_x, _glut_mouse_y);
|
||||
}
|
||||
|
||||
idle = GL_FALSE;
|
||||
old_mouse_b = mouse_b;
|
||||
}
|
||||
}
|
||||
|
||||
if (pc_keypressed()) {
|
||||
int key;
|
||||
int glut_key;
|
||||
|
||||
idle = GL_FALSE;
|
||||
key = pc_readkey();
|
||||
|
||||
switch (key>>16) {
|
||||
case KEY_F1: glut_key = GLUT_KEY_F1; goto special;
|
||||
case KEY_F2: glut_key = GLUT_KEY_F2; goto special;
|
||||
case KEY_F3: glut_key = GLUT_KEY_F3; goto special;
|
||||
case KEY_F4: glut_key = GLUT_KEY_F4; goto special;
|
||||
case KEY_F5: glut_key = GLUT_KEY_F5; goto special;
|
||||
case KEY_F6: glut_key = GLUT_KEY_F6; goto special;
|
||||
case KEY_F7: glut_key = GLUT_KEY_F7; goto special;
|
||||
case KEY_F8: glut_key = GLUT_KEY_F8; goto special;
|
||||
case KEY_F9: glut_key = GLUT_KEY_F9; goto special;
|
||||
case KEY_F10: glut_key = GLUT_KEY_F10; goto special;
|
||||
case KEY_F11: glut_key = GLUT_KEY_F11; goto special;
|
||||
case KEY_F12: glut_key = GLUT_KEY_F12; goto special;
|
||||
case KEY_LEFT: glut_key = GLUT_KEY_LEFT; goto special;
|
||||
case KEY_UP: glut_key = GLUT_KEY_UP; goto special;
|
||||
case KEY_RIGHT: glut_key = GLUT_KEY_RIGHT; goto special;
|
||||
case KEY_DOWN: glut_key = GLUT_KEY_DOWN; goto special;
|
||||
case KEY_PGUP: glut_key = GLUT_KEY_PAGE_UP; goto special;
|
||||
case KEY_PGDN: glut_key = GLUT_KEY_PAGE_DOWN; goto special;
|
||||
case KEY_HOME: glut_key = GLUT_KEY_HOME; goto special;
|
||||
case KEY_END: glut_key = GLUT_KEY_END; goto special;
|
||||
case KEY_INSERT: glut_key = GLUT_KEY_INSERT; goto special;
|
||||
special:
|
||||
if (_glut_current->special) {
|
||||
_glut_current->special(glut_key, _glut_mouse_x, _glut_mouse_y);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (_glut_current->keyboard) {
|
||||
_glut_current->keyboard(key & 0xFF, _glut_mouse_x, _glut_mouse_y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (idle && _glut_idle_func)
|
||||
_glut_idle_func();
|
||||
|
||||
for (i = 0; i < MAX_TIMER_CB; i++) {
|
||||
int time = glutGet(GLUT_ELAPSED_TIME);
|
||||
GLUTSShotCB *cb = &_glut_timer_cb[i];
|
||||
if (cb->func && (time >= cb->time)) {
|
||||
cb->func(cb->value);
|
||||
cb->func = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutMainLoop (void)
|
||||
{
|
||||
looping++;
|
||||
while (looping) {
|
||||
glutMainLoopEvent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutLeaveMainLoop (void)
|
||||
{
|
||||
looping--;
|
||||
}
|
||||
|
|
@ -1,49 +1,45 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* 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.
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* 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.3 for Mesa
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "glutint.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
GLUTmenuStatusCB g_menu_status_func = NULL;
|
||||
GLUTmenuStatusCB _glut_menu_status_func = NULL;
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutMenuStateFunc (GLUTmenuStateCB func)
|
||||
{
|
||||
g_menu_status_func = (GLUTmenuStatusCB)func;
|
||||
_glut_menu_status_func = (GLUTmenuStatusCB)func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutMenuStatusFunc (GLUTmenuStatusCB func)
|
||||
{
|
||||
g_menu_status_func = func;
|
||||
_glut_menu_status_func = func;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -113,3 +109,22 @@ void APIENTRY
|
|||
glutDetachMenu (int button)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutMenuDestroyFunc ( void (* callback)( void ) )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void * APIENTRY
|
||||
glutGetMenuData (void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutSetMenuData (void *data)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,46 +1,42 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* 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.
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* 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.3 for Mesa
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "glutint.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
int g_mouse;
|
||||
int g_mouse_x = 0, g_mouse_y = 0;
|
||||
int _glut_mouse;
|
||||
int _glut_mouse_x = 0, _glut_mouse_y = 0;
|
||||
|
||||
|
||||
void
|
||||
__glutInitMouse (void)
|
||||
_glut_mouse_init (void)
|
||||
{
|
||||
if ((g_mouse = pc_install_mouse())) {
|
||||
pc_mouse_area(g_curwin->xpos, g_curwin->ypos, g_curwin->xpos + g_curwin->width - 1, g_curwin->ypos + g_curwin->height - 1);
|
||||
if ((_glut_mouse = pc_install_mouse())) {
|
||||
pc_mouse_area(_glut_current->xpos, _glut_current->ypos, _glut_current->xpos + _glut_current->width - 1, _glut_current->ypos + _glut_current->height - 1);
|
||||
|
||||
g_curwin->show_mouse = (g_curwin->mouse || g_curwin->motion || g_curwin->passive);
|
||||
_glut_current->show_mouse = (_glut_current->mouse || _glut_current->motion || _glut_current->passive);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
2783
src/glut/dos/mroman.c
Normal file
2783
src/glut/dos/mroman.c
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,33 +1,29 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* 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.
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* 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.3 for Mesa
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "glutint.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
int APIENTRY
|
||||
|
|
@ -89,3 +85,9 @@ void APIENTRY
|
|||
glutHideOverlay (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutPostWindowOverlayRedisplay (int win)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
2783
src/glut/dos/roman.c
Normal file
2783
src/glut/dos/roman.c
Normal file
File diff suppressed because it is too large
Load diff
1143
src/glut/dos/shapes.c
Normal file
1143
src/glut/dos/shapes.c
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,35 +1,31 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* 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.
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* 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.5 for Mesa
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "glutint.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
#define FREQUENCY 100 /* set this to zero to use the default timer */
|
||||
|
|
@ -58,35 +54,35 @@ glutGet (GLenum type)
|
|||
{
|
||||
switch (type) {
|
||||
case GLUT_WINDOW_X:
|
||||
return g_curwin->xpos;
|
||||
return _glut_current->xpos;
|
||||
case GLUT_WINDOW_Y:
|
||||
return g_curwin->ypos;
|
||||
return _glut_current->ypos;
|
||||
case GLUT_WINDOW_WIDTH:
|
||||
return g_curwin->width;
|
||||
return _glut_current->width;
|
||||
case GLUT_WINDOW_HEIGHT:
|
||||
return g_curwin->height;
|
||||
return _glut_current->height;
|
||||
case GLUT_WINDOW_STENCIL_SIZE:
|
||||
return g_stencil;
|
||||
return _glut_visual.stencil;
|
||||
case GLUT_WINDOW_DEPTH_SIZE:
|
||||
return g_depth;
|
||||
return _glut_visual.depth;
|
||||
case GLUT_WINDOW_RGBA:
|
||||
return !(g_display_mode & GLUT_INDEX);
|
||||
return !(_glut_default.mode & GLUT_INDEX);
|
||||
case GLUT_WINDOW_COLORMAP_SIZE:
|
||||
return (g_display_mode & GLUT_INDEX) ? (256 - RESERVED_COLORS) : 0;
|
||||
return (_glut_default.mode & GLUT_INDEX) ? (256 - RESERVED_COLORS) : 0;
|
||||
case GLUT_SCREEN_WIDTH:
|
||||
return g_screen_w;
|
||||
return _glut_visual.geometry[0];
|
||||
case GLUT_SCREEN_HEIGHT:
|
||||
return g_screen_h;
|
||||
return _glut_visual.geometry[1];
|
||||
case GLUT_INIT_WINDOW_X:
|
||||
return g_init_x;
|
||||
return _glut_default.x;
|
||||
case GLUT_INIT_WINDOW_Y:
|
||||
return g_init_y;
|
||||
return _glut_default.y;
|
||||
case GLUT_INIT_WINDOW_WIDTH:
|
||||
return g_init_w;
|
||||
return _glut_default.width;
|
||||
case GLUT_INIT_WINDOW_HEIGHT:
|
||||
return g_init_h;
|
||||
return _glut_default.height;
|
||||
case GLUT_INIT_DISPLAY_MODE:
|
||||
return g_display_mode;
|
||||
return _glut_default.mode;
|
||||
case GLUT_ELAPSED_TIME:
|
||||
#if FREQUENCY
|
||||
if (!timer_installed) {
|
||||
|
|
@ -121,9 +117,9 @@ glutDeviceGet (GLenum type)
|
|||
case GLUT_HAS_KEYBOARD:
|
||||
return GL_TRUE;
|
||||
case GLUT_HAS_MOUSE:
|
||||
return (g_mouse != 0);
|
||||
return (_glut_mouse != 0);
|
||||
case GLUT_NUM_MOUSE_BUTTONS:
|
||||
return g_mouse;
|
||||
return _glut_mouse;
|
||||
case GLUT_HAS_SPACEBALL:
|
||||
case GLUT_HAS_DIAL_AND_BUTTON_BOX:
|
||||
case GLUT_HAS_TABLET:
|
||||
|
|
@ -161,10 +157,17 @@ glutGetModifiers (void)
|
|||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutReportErrors (void)
|
||||
{
|
||||
/* reports all the OpenGL errors that happened till now */
|
||||
}
|
||||
|
||||
|
||||
/* GAME MODE
|
||||
* Hack alert: incomplete... what is GameMode, anyway?
|
||||
*/
|
||||
GLint g_game;
|
||||
static GLint game;
|
||||
static GLboolean game_possible;
|
||||
static GLboolean game_active;
|
||||
static GLuint game_width;
|
||||
|
|
@ -189,7 +192,7 @@ glutGameModeGet (GLenum mode)
|
|||
case GLUT_GAME_MODE_ACTIVE:
|
||||
return game_active;
|
||||
case GLUT_GAME_MODE_POSSIBLE:
|
||||
return game_possible && !g_curwin;
|
||||
return game_possible && !_glut_current;
|
||||
case GLUT_GAME_MODE_WIDTH:
|
||||
return game_active ? (int)game_width : -1;
|
||||
case GLUT_GAME_MODE_HEIGHT:
|
||||
|
|
@ -208,16 +211,16 @@ int APIENTRY
|
|||
glutEnterGameMode (void)
|
||||
{
|
||||
if (glutGameModeGet(GLUT_GAME_MODE_POSSIBLE)) {
|
||||
g_bpp = game_bpp;
|
||||
g_refresh = game_refresh;
|
||||
_glut_visual.bpp = game_bpp;
|
||||
_glut_visual.refresh = game_refresh;
|
||||
|
||||
glutInitWindowSize(game_width, game_height);
|
||||
|
||||
if ((g_game = glutCreateWindow("<game>")) > 0) {
|
||||
if ((game = glutCreateWindow("<game>")) > 0) {
|
||||
game_active = GL_TRUE;
|
||||
}
|
||||
|
||||
return g_game;
|
||||
return game;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -230,6 +233,6 @@ glutLeaveGameMode (void)
|
|||
if (glutGameModeGet(GLUT_GAME_MODE_ACTIVE)) {
|
||||
game_active = GL_FALSE;
|
||||
|
||||
glutDestroyWindow(g_game);
|
||||
glutDestroyWindow(game);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
118
src/glut/dos/stroke.c
Normal file
118
src/glut/dos/stroke.c
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* FxGLUT version 0.12 - GLUT for Voodoo 1 and 2 under Linux
|
||||
* Copyright (C) 1999 Christopher John Purnell
|
||||
* cjp@lost.org.uk
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
void
|
||||
glutStrokeCharacter (void *font, int c)
|
||||
{
|
||||
const GLUTStrokeFont *sfp = _glut_font(font);
|
||||
const GLUTStrokeChar *scp;
|
||||
const GLUTStrokeStrip *ssp;
|
||||
const GLUTStrokeVertex *svp;
|
||||
unsigned i, j;
|
||||
|
||||
if (((unsigned)c) >= sfp->num || !(scp = sfp->table[c]))
|
||||
return;
|
||||
|
||||
ssp = scp->strip;
|
||||
|
||||
for (i = 0; i < scp->num; i++, ssp++) {
|
||||
svp = ssp->vertex;
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
for (j = 0; j < ssp->num; j++, svp++) {
|
||||
glVertex2f(svp->x, svp->y);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
glTranslatef(scp->right, 0.0, 0.0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
glutStrokeString (void *font, const unsigned char *string)
|
||||
{
|
||||
const GLUTStrokeFont *sfp = _glut_font(font);
|
||||
const GLUTStrokeChar *scp;
|
||||
const GLUTStrokeStrip *ssp;
|
||||
const GLUTStrokeVertex *svp;
|
||||
unsigned char c;
|
||||
unsigned i, j;
|
||||
|
||||
while ((c = *(string++))) {
|
||||
if (c < sfp->num && (scp = sfp->table[c])) {
|
||||
ssp = scp->strip;
|
||||
|
||||
for (i = 0; i < scp->num; i++, ssp++) {
|
||||
svp = ssp->vertex;
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
for (j = 0; j < ssp->num; j++, svp++) {
|
||||
glVertex2f(svp->x, svp->y);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
glTranslatef(scp->right, 0.0, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
glutStrokeWidth (void *font, int c)
|
||||
{
|
||||
const GLUTStrokeFont *sfp = _glut_font(font);
|
||||
const GLUTStrokeChar *scp;
|
||||
|
||||
if (((unsigned)c) >= sfp->num || !(scp = sfp->table[c]))
|
||||
return 0;
|
||||
|
||||
return scp->right;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
glutStrokeLength (void *font, const unsigned char *string)
|
||||
{
|
||||
const GLUTStrokeFont *sfp = _glut_font(font);
|
||||
const GLUTStrokeChar *scp;
|
||||
unsigned char c;
|
||||
int length = 0;
|
||||
|
||||
while ((c = *(string++))) {
|
||||
if (c < sfp->num && (scp = sfp->table[c]))
|
||||
length += scp->right;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
GLfloat
|
||||
glutStrokeHeight (void *font)
|
||||
{
|
||||
const GLUTStrokeFont *sfp = _glut_font(font);
|
||||
|
||||
return sfp->height;
|
||||
}
|
||||
201
src/glut/dos/teapot.c
Normal file
201
src/glut/dos/teapot.c
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
/*
|
||||
* (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 "internal.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] =
|
||||
{
|
||||
{ 102, 103, 104, 105, 4, 5, 6, 7,
|
||||
8, 9, 10, 11, 12, 13, 14, 15 }, /* rim */
|
||||
{ 12, 13, 14, 15, 16, 17, 18, 19,
|
||||
20, 21, 22, 23, 24, 25, 26, 27 }, /* body */
|
||||
{ 24, 25, 26, 27, 29, 30, 31, 32,
|
||||
33, 34, 35, 36, 37, 38, 39, 40 },
|
||||
{ 96, 96, 96, 96, 97, 98, 99, 100,
|
||||
101, 101, 101, 101, 0, 1, 2, 3 }, /* lid */
|
||||
{ 0, 1, 2, 3, 106, 107, 108, 109,
|
||||
110, 111, 112, 113, 114, 115, 116, 117 },
|
||||
{ 118, 118, 118, 118, 124, 122, 119, 121,
|
||||
123, 126, 125, 120, 40, 39, 38, 37 }, /* bottom */
|
||||
{ 41, 42, 43, 44, 45, 46, 47, 48,
|
||||
49, 50, 51, 52, 53, 54, 55, 56 }, /* handle */
|
||||
{ 53, 54, 55, 56, 57, 58, 59, 60,
|
||||
61, 62, 63, 64, 28, 65, 66, 67 },
|
||||
{ 68, 69, 70, 71, 72, 73, 74, 75,
|
||||
76, 77, 78, 79, 80, 81, 82, 83 }, /* spout */
|
||||
{ 80, 81, 82, 83, 84, 85, 86, 87,
|
||||
88, 89, 90, 91, 92, 93, 94, 95 }
|
||||
};
|
||||
|
||||
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} }
|
||||
};
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
void glutWireTeapot(GLdouble size)
|
||||
{
|
||||
teapot(10, size, GL_LINE);
|
||||
}
|
||||
|
||||
void glutSolidTeapot(GLdouble size)
|
||||
{
|
||||
teapot(7, size, GL_FILL);
|
||||
}
|
||||
1018
src/glut/dos/tr10.c
Normal file
1018
src/glut/dos/tr10.c
Normal file
File diff suppressed because it is too large
Load diff
1301
src/glut/dos/tr24.c
Normal file
1301
src/glut/dos/tr24.c
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,40 +1,33 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* 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.
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* 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.4 for Mesa
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "glutint.h"
|
||||
#include "glutbitmap.h"
|
||||
#include "glutstroke.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
#ifdef GLUT_IMPORT_LIB
|
||||
extern StrokeFontRec glutStrokeRoman, glutStrokeMonoRoman;
|
||||
extern BitmapFontRec glutBitmap8By13, glutBitmap9By15, glutBitmapTimesRoman10, glutBitmapTimesRoman24, glutBitmapHelvetica10, glutBitmapHelvetica12, glutBitmapHelvetica18;
|
||||
extern GLUTStrokeFont glutStrokeRoman, glutStrokeMonoRoman;
|
||||
extern GLUTBitmapFont glutBitmap8By13, glutBitmap9By15, glutBitmapTimesRoman10, glutBitmapTimesRoman24, glutBitmapHelvetica10, glutBitmapHelvetica12, glutBitmapHelvetica18;
|
||||
|
||||
/* To get around the fact that DJGPP DXEs only allow functions
|
||||
to be exported and no data addresses (as Unix DSOs support), the
|
||||
|
|
@ -42,7 +35,7 @@ extern BitmapFontRec glutBitmap8By13, glutBitmap9By15, glutBitmapTimesRoman10, g
|
|||
through a case statement to get mapped to the actual data structure
|
||||
address. */
|
||||
void *
|
||||
__glutFont (void *font)
|
||||
_glut_font (void *font)
|
||||
{
|
||||
switch ((int)font) {
|
||||
case (int)GLUT_STROKE_ROMAN:
|
||||
|
|
@ -63,9 +56,19 @@ __glutFont (void *font)
|
|||
return &glutBitmapHelvetica12;
|
||||
case (int)GLUT_BITMAP_HELVETICA_18:
|
||||
return &glutBitmapHelvetica18;
|
||||
default: /* NOTREACHED */
|
||||
__glutFatalError("bad font!");
|
||||
default:
|
||||
if ((font == &glutStrokeRoman) ||
|
||||
(font == &glutStrokeMonoRoman) ||
|
||||
(font == &glutBitmap9By15) ||
|
||||
(font == &glutBitmap8By13) ||
|
||||
(font == &glutBitmapTimesRoman10) ||
|
||||
(font == &glutBitmapTimesRoman24) ||
|
||||
(font == &glutBitmapHelvetica10) ||
|
||||
(font == &glutBitmapHelvetica12) ||
|
||||
(font == &glutBitmapHelvetica18)) {
|
||||
return font;
|
||||
}
|
||||
_glut_fatal("bad font!");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,43 +1,38 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 4.1
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* 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.
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* 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.
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* 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.4 for Mesa
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@users.sourceforge.net
|
||||
* Web : http://www.geocities.com/dborca
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "glutint.h"
|
||||
#include "GL/dmesa.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
GLUTwindow *g_curwin;
|
||||
static GLuint swaptime, swapcount;
|
||||
|
||||
static DMesaVisual visual = NULL;
|
||||
GLUTwindow *g_windows[MAX_WINDOWS];
|
||||
|
||||
GLUTwindow *_glut_current, *_glut_windows[MAX_WINDOWS];
|
||||
|
||||
|
||||
static void
|
||||
|
|
@ -55,11 +50,21 @@ clean (void)
|
|||
}
|
||||
|
||||
|
||||
static GLUTwindow *
|
||||
_glut_window (int win)
|
||||
{
|
||||
if (win > 0 && --win < MAX_WINDOWS) {
|
||||
return _glut_windows[win];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int APIENTRY
|
||||
glutCreateWindow (const char *title)
|
||||
{
|
||||
int i;
|
||||
int m8width = (g_init_w + 7) & ~7;
|
||||
int m8width = (_glut_default.width + 7) & ~7;
|
||||
|
||||
/* We set the Visual once. This will be our desktop (graphic mode).
|
||||
* We should do this in the `glutInit' code, but we don't have any idea
|
||||
|
|
@ -67,16 +72,19 @@ glutCreateWindow (const char *title)
|
|||
* window, we have a slight idea about resolution.
|
||||
*/
|
||||
if (!visual) {
|
||||
if ((visual=DMesaCreateVisual(g_init_x + m8width, g_init_y + g_init_h, g_bpp, g_refresh,
|
||||
g_display_mode & GLUT_DOUBLE,
|
||||
!(g_display_mode & GLUT_INDEX),
|
||||
(g_display_mode & GLUT_ALPHA ) ? g_alpha : 0,
|
||||
(g_display_mode & GLUT_DEPTH ) ? g_depth : 0,
|
||||
(g_display_mode & GLUT_STENCIL) ? g_stencil : 0,
|
||||
(g_display_mode & GLUT_ACCUM ) ? g_accum : 0))==NULL) {
|
||||
if ((visual=DMesaCreateVisual(_glut_default.x + m8width, _glut_default.y + _glut_default.height, _glut_visual.bpp, _glut_visual.refresh,
|
||||
_glut_default.mode & GLUT_DOUBLE,
|
||||
!(_glut_default.mode & GLUT_INDEX),
|
||||
(_glut_default.mode & GLUT_ALPHA ) ? _glut_visual.alpha : 0,
|
||||
(_glut_default.mode & GLUT_DEPTH ) ? _glut_visual.depth : 0,
|
||||
(_glut_default.mode & GLUT_STENCIL) ? _glut_visual.stencil : 0,
|
||||
(_glut_default.mode & GLUT_ACCUM ) ? _glut_visual.accum : 0))==NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
DMesaGetIntegerv(DMESA_GET_SCREEN_SIZE, _glut_visual.geometry);
|
||||
DMesaGetIntegerv(DMESA_GET_DRIVER_CAPS, &_glut_visual.flags);
|
||||
|
||||
/* Also hook stdio/stderr once */
|
||||
pc_open_stdout();
|
||||
pc_open_stderr();
|
||||
|
|
@ -87,7 +95,7 @@ glutCreateWindow (const char *title)
|
|||
* Each window has its own rendering Context and its own Buffer.
|
||||
*/
|
||||
for (i=0; i<MAX_WINDOWS; i++) {
|
||||
if (g_windows[i] == NULL) {
|
||||
if (_glut_windows[i] == NULL) {
|
||||
DMesaContext c;
|
||||
DMesaBuffer b;
|
||||
GLUTwindow *w;
|
||||
|
|
@ -105,7 +113,7 @@ glutCreateWindow (const char *title)
|
|||
/* Allocate the Buffer (displayable area).
|
||||
* We have to specify buffer size and position (inside the desktop).
|
||||
*/
|
||||
if ((b = DMesaCreateBuffer(visual, g_init_x, g_init_y, m8width, g_init_h)) == NULL) {
|
||||
if ((b = DMesaCreateBuffer(visual, _glut_default.x, _glut_default.y, m8width, _glut_default.height)) == NULL) {
|
||||
DMesaDestroyContext(c);
|
||||
free(w);
|
||||
return 0;
|
||||
|
|
@ -119,13 +127,13 @@ glutCreateWindow (const char *title)
|
|||
return 0;
|
||||
}
|
||||
|
||||
g_curwin = g_windows[i] = w;
|
||||
_glut_current = _glut_windows[i] = w;
|
||||
|
||||
w->num = ++i;
|
||||
w->xpos = g_init_x;
|
||||
w->ypos = g_init_y;
|
||||
w->xpos = _glut_default.x;
|
||||
w->ypos = _glut_default.y;
|
||||
w->width = m8width;
|
||||
w->height = g_init_h;
|
||||
w->height = _glut_default.height;
|
||||
w->context = c;
|
||||
w->buffer = b;
|
||||
|
||||
|
|
@ -147,13 +155,16 @@ glutCreateSubWindow (int win, int x, int y, int width, int height)
|
|||
void APIENTRY
|
||||
glutDestroyWindow (int win)
|
||||
{
|
||||
if (g_windows[--win]) {
|
||||
GLUTwindow *w = g_windows[win];
|
||||
GLUTwindow *w = _glut_window(win);
|
||||
if (w != NULL) {
|
||||
if (w->destroy) {
|
||||
w->destroy();
|
||||
}
|
||||
DMesaMakeCurrent(NULL, NULL);
|
||||
DMesaDestroyBuffer(w->buffer);
|
||||
DMesaDestroyContext(w->context);
|
||||
free(w);
|
||||
g_windows[win] = NULL;
|
||||
_glut_windows[win - 1] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -161,27 +172,27 @@ glutDestroyWindow (int win)
|
|||
void APIENTRY
|
||||
glutPostRedisplay (void)
|
||||
{
|
||||
g_curwin->redisplay = GL_TRUE;
|
||||
_glut_current->redisplay = GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutSwapBuffers (void)
|
||||
{
|
||||
if (g_curwin->show_mouse) {
|
||||
if (_glut_current->show_mouse) {
|
||||
/* XXX scare mouse */
|
||||
DMesaSwapBuffers(g_curwin->buffer);
|
||||
DMesaSwapBuffers(_glut_current->buffer);
|
||||
/* XXX unscare mouse */
|
||||
} else {
|
||||
DMesaSwapBuffers(g_curwin->buffer);
|
||||
DMesaSwapBuffers(_glut_current->buffer);
|
||||
}
|
||||
|
||||
if (g_fps) {
|
||||
if (_glut_fps) {
|
||||
GLint t = glutGet(GLUT_ELAPSED_TIME);
|
||||
swapcount++;
|
||||
if (swaptime == 0)
|
||||
swaptime = t;
|
||||
else if (t - swaptime > g_fps) {
|
||||
else if (t - swaptime > _glut_fps) {
|
||||
double time = 0.001 * (t - swaptime);
|
||||
double fps = (double)swapcount / time;
|
||||
fprintf(stderr, "GLUT: %d frames in %.2f seconds = %.2f FPS\n", swapcount, time, fps);
|
||||
|
|
@ -195,15 +206,18 @@ glutSwapBuffers (void)
|
|||
int APIENTRY
|
||||
glutGetWindow (void)
|
||||
{
|
||||
return g_curwin->num;
|
||||
return _glut_current->num;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutSetWindow (int win)
|
||||
{
|
||||
g_curwin = g_windows[win - 1];
|
||||
DMesaMakeCurrent(g_curwin->context, g_curwin->buffer);
|
||||
GLUTwindow *w = _glut_window(win);
|
||||
if (w != NULL) {
|
||||
_glut_current = w;
|
||||
DMesaMakeCurrent(_glut_current->context, _glut_current->buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -223,8 +237,8 @@ void APIENTRY
|
|||
glutPositionWindow (int x, int y)
|
||||
{
|
||||
if (DMesaMoveBuffer(x, y)) {
|
||||
g_curwin->xpos = x;
|
||||
g_curwin->ypos = y;
|
||||
_glut_current->xpos = x;
|
||||
_glut_current->ypos = y;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -233,10 +247,10 @@ void APIENTRY
|
|||
glutReshapeWindow (int width, int height)
|
||||
{
|
||||
if (DMesaResizeBuffer(width, height)) {
|
||||
g_curwin->width = width;
|
||||
g_curwin->height = height;
|
||||
if (g_curwin->reshape) {
|
||||
g_curwin->reshape(width, height);
|
||||
_glut_current->width = width;
|
||||
_glut_current->height = height;
|
||||
if (_glut_current->reshape) {
|
||||
_glut_current->reshape(width, height);
|
||||
} else {
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
|
@ -278,3 +292,34 @@ void APIENTRY
|
|||
glutHideWindow (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutCloseFunc (GLUTdestroyCB destroy)
|
||||
{
|
||||
_glut_current->destroy = destroy;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutPostWindowRedisplay (int win)
|
||||
{
|
||||
GLUTwindow *w = _glut_window(win);
|
||||
if (w != NULL) {
|
||||
w->redisplay = GL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void * APIENTRY
|
||||
glutGetWindowData (void)
|
||||
{
|
||||
return _glut_current->data;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutSetWindowData (void *data)
|
||||
{
|
||||
_glut_current->data = data;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue