The bitmap and stroke code can't be shared with glx anymore because of this.
The model for the mini teapot is restored and I have tested it to work with
linux-fbdev and linux-solo
The driver recognizes 32bpp where there is no alpha (my radeon 7500) It also
sets the correct number of cmap entrees (instead of 256 which can be an error)
include $(TOP)/configs/linux
CONFIG_NAME = linux-fbdev
-DRIVER_DIRS = fbdev osmesa
-SRC_DIRS = mesa glu glut/fbdev glw
-CFLAGS = -g -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -DUSE_GLFBDEV_DRIVER
+CFLAGS = -O3 -ffast-math -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS -DUSE_GLFBDEV_DRIVER
+SRC_DIRS = mesa glu glut/fbdev
+DRIVER_DIRS = fbdev
+PROGRAM_DIRS = fbdev demos redbook samples
+
+GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(EXTRA_LIB_PATH) -lgpm -lm
-PROGRAM_DIRS = fbdev demos redbook samples
include $(TOP)/configs/current
GLX_SHARED = $(TOP)/src/glut/glx
-SHAPES = $(TOP)/src/glut/mini
+MINI_SHARED = $(TOP)/src/glut/mini
-GLUT_MAJOR = 5
-GLUT_MINOR = 0
+GLUT_MAJOR = 3
+GLUT_MINOR = 7
GLUT_TINY = 1
INCLUDES = -I$(TOP)/include -I$(GLX_SHARED)
input.c \
callback.c \
gamemode.c \
- vidresize.c
+ vidresize.c \
+ bitmap.c \
+ stroke.c
GLX_SHARED_SOURCES = \
$(GLX_SHARED)/glut_8x13.c \
$(GLX_SHARED)/glut_9x15.c \
- $(GLX_SHARED)/glut_bwidth.c \
- $(GLX_SHARED)/glut_bitmap.c \
$(GLX_SHARED)/glut_hel10.c \
$(GLX_SHARED)/glut_hel12.c \
$(GLX_SHARED)/glut_hel18.c \
$(GLX_SHARED)/glut_tr24.c \
$(GLX_SHARED)/glut_mroman.c \
$(GLX_SHARED)/glut_roman.c \
- $(GLX_SHARED)/glut_swidth.c \
- $(GLX_SHARED)/glut_stroke.c \
- $(TOP)/src/glut/mini/models.c \
- $(GLX_SHARED)/glut_teapot.c
-SOURCES = $(CORE_SOURCES) $(GLX_SHARED_SOURCES)
+MINI_SHARED_SOURCES = \
+ $(MINI_SHARED)/models.c \
+ $(MINI_SHARED)/teapot.c
+
+SOURCES = $(CORE_SOURCES) $(GLX_SHARED_SOURCES) $(MINI_SHARED_SOURCES)
OBJECTS = $(SOURCES:.c=.o)
##### RULES #####
.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
.S.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
$(GLUT_LIB_DEPS) -install $(TOP)/$(LIB_DIR) \
$(MKLIB_OPTIONS) $(OBJECTS)
+install:
+ $(INSTALL) -d $(INSTALL_DIR)/include/GL
+ $(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR)
+ $(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(INSTALL_DIR)/include/GL
+ $(COPY_LIBS) $(TOP)/$(LIB_DIR)/libglut* $(INSTALL_DIR)/$(LIB_DIR)
+
# Run 'make -f Makefile.solo dep' to update the dependencies if you change
# what's included by any source file.
depend: $(SOURCES)
--- /dev/null
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5
+ * Copyright (C) 1995-2006 Brian Paul
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * Library for glut using mesa fbdev driver
+ *
+ * Written by Sean D'Epagnier (c) 2006
+ *
+ * To improve on this library, maybe support subwindows or overlays,
+ * I (sean at depagnier dot com) will do my best to help.
+ */
+
+
+#include "glutbitmap.h"
+
+void glutBitmapCharacter(GLUTbitmapFont font, int c)
+{
+ const BitmapCharRec *ch;
+ BitmapFontPtr fi = (BitmapFontPtr) font;
+
+ if (c < fi->first ||
+ c >= fi->first + fi->num_chars)
+ return;
+ ch = fi->ch[c - fi->first];
+ if (!ch)
+ 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(ch->width, ch->height, ch->xorig, ch->yorig,
+ ch->advance, 0, ch->bitmap);
+ glPopClientAttrib();
+}
+
+int glutBitmapWidth (GLUTbitmapFont font, int c)
+{
+ const BitmapCharRec *ch;
+ BitmapFontPtr fi = (BitmapFontPtr) font;
+
+ if (c < fi->first || c >= fi->first + fi->num_chars)
+ return 0;
+ ch = fi->ch[c - fi->first];
+ if (ch)
+ return ch->advance;
+ return 0;
+}
+
+int glutBitmapLength(GLUTbitmapFont font, const unsigned char *string)
+{
+ int length = 0;
+
+ for (; *string; string++)
+ length += glutBitmapWidth(font, *string);
+ return length;
+}
/* we're assuming 256 entries here */
int i;
+ switch(VarInfo.bits_per_pixel) {
+ case 8:
+ case 24:
+ case 32:
+ ColorMap.len = 256;
+ break;
+ case 15:
+ ColorMap.len = 32;
+ break;
+ case 16:
+ ColorMap.len = 64;
+ break;
+ }
+
ColorMap.start = 0;
- ColorMap.len = 256;
ColorMap.red = RedColorMap;
ColorMap.green = GreenColorMap;
ColorMap.blue = BlueColorMap;
cstride /= 2;
for(i = yoff; i < ylen; i++) {
for(j = xoff; j < xlen; j++) {
- e[0] = ((((d[0] + (((int)(((e[0] >> 8) & 0xf8)
+ if(d[3] < 220)
+ e[0] = ((((d[0] + (((int)(((e[0] >> 8) & 0xf8)
| ((c[0] >> 11) & 0x7)) * d[3]) >> 8)) & 0xf8) << 8)
| (((d[1] + (((int)(((e[0] >> 3) & 0xfc)
| ((e[0] >> 5) & 0x3)) * d[3]) >> 8)) & 0xfc) << 3)
case 4:
for(i = yoff; i < ylen; i++) {
for(j = xoff; j < xlen; j++) {
- c[0] = d[0] + (((int)c[0] * d[3]) >> 8);
- c[1] = d[1] + (((int)c[1] * d[3]) >> 8);
- c[2] = d[2] + (((int)c[2] * d[3]) >> 8);
+ if(d[3] < 220) {
+ c[0] = d[0] + (((int)c[0] * d[3]) >> 8);
+ c[1] = d[1] + (((int)c[1] * d[3]) >> 8);
+ c[2] = d[2] + (((int)c[2] * d[3]) >> 8);
+ }
c+=bypp;
d+=4;
/* close mouse */
CloseMouse();
- glFBDevMakeCurrent( NULL, NULL, NULL);
-
- glFBDevDestroyContext(Context);
- glFBDevDestroyBuffer(Buffer);
- glFBDevDestroyVisual(Visual);
+ if(Visual)
+ glutDestroyWindow(1);
/* restore original variable screen info */
if(FrameBufferFD != -1) {
void glutDestroyWindow(int win)
{
+ glFBDevMakeCurrent( NULL, NULL, NULL);
+ glFBDevDestroyContext(Context);
+ glFBDevDestroyBuffer(Buffer);
+ glFBDevDestroyVisual(Visual);
+ Visual = NULL;
}
void glutPostRedisplay(void)
Swapping = 0;
}
+ /* if there was a vt switch while swapping, switch now */
if(VTSwitch) {
if(ioctl(ConsoleFD, VT_ACTIVATE, VTSwitch) < 0)
sprintf(exiterror, "Error switching console\n");
--- /dev/null
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5
+ * Copyright (C) 1995-2006 Brian Paul
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * Library for glut using mesa fbdev driver
+ *
+ * Written by Sean D'Epagnier (c) 2006
+ *
+ * To improve on this library, maybe support subwindows or overlays,
+ * I (sean at depagnier dot com) will do my best to help.
+ */
+
+#include <GL/glut.h>
+#include "glutstroke.h"
+
+void glutStrokeCharacter(GLUTstrokeFont font, int c)
+{
+ const StrokeCharRec *ch;
+ const StrokeRec *stroke;
+ const CoordRec *coord;
+ StrokeFontPtr fontinfo = (StrokeFontPtr) font;
+ int i, j;
+
+ if (c < 0 || c >= fontinfo->num_chars)
+ return;
+ ch = &(fontinfo->ch[c]);
+ if (ch) {
+ for (i = ch->num_strokes, stroke = ch->stroke;
+ i > 0; i--, stroke++) {
+ glBegin(GL_LINE_STRIP);
+ for (j = stroke->num_coords, coord = stroke->coord;
+ j > 0; j--, coord++) {
+ glVertex2f(coord->x, coord->y);
+ }
+ glEnd();
+ }
+ glTranslatef(ch->right, 0.0, 0.0);
+ }
+}
+
+int glutStrokeWidth(GLUTstrokeFont font, int c)
+{
+ StrokeFontPtr fontinfo;
+ const StrokeCharRec *ch;
+
+ fontinfo = (StrokeFontPtr) font;
+
+ if (c < 0 || c >= fontinfo->num_chars)
+ return 0;
+ ch = &(fontinfo->ch[c]);
+ if (ch)
+ return ch->right;
+
+ return 0;
+}
+
+int glutStrokeLength(GLUTstrokeFont font, const unsigned char *string)
+{
+ int length = 0;
+
+ for (; *string; string++)
+ length += glutStrokeWidth(font, *string);
+ return length;
+}
float p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3];
long i, j, k, l;
-#if 0
glPushAttrib(GL_ENABLE_BIT | GL_EVAL_BIT);
glEnable(GL_AUTO_NORMAL);
glEnable(GL_NORMALIZE);
}
glPopMatrix();
glPopAttrib();
-#endif
}
/* CENTRY */
fi
-
######################################################################
# BeOS driver target
######################################################################
# Stand-alone Mesa libGL and libOSMesa
-
-STAND_ALONE_DRIVER_SOURCES = \
+STAND_ALONE_DRIVER_SOURCES_A = \
$(COMMON_DRIVER_SOURCES) \
- $(X11_DRIVER_SOURCES) \
$(GLIDE_DRIVER_SOURCES) \
- $(SVGA_DRIVER_SOURCES) \
- $(FBDEV_DRIVER_SOURCES)
+ $(SVGA_DRIVER_SOURCES)
+
+# if x11 is not installed, compiling with x11 sources will not work for fbdev
+ifeq ($(DRIVER_DIRS), fbdev)
+STAND_ALONE_DRIVER_SOURCES = $(STAND_ALONE_DRIVER_SOURCES_A) $(FBDEV_DRIVER_SOURCES)
+else
+STAND_ALONE_DRIVER_SOURCES = $(STAND_ALONE_DRIVER_SOURCES_A) $(X11_DRIVER_SOURCES)
+endif
STAND_ALONE_DRIVER_OBJECTS = $(STAND_ALONE_DRIVER_SOURCES:.c=.o)
$(X86_SOURCES) \
$(COMMON_DRIVER_SOURCES)\
$(X11_DRIVER_SOURCES) \
+ $(FBDEV_DRIVER_SOURCES) \
$(OSMESA_DRIVER_SOURCES)
get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height )
{
const GLFBDevBufferPtr fbdevbuffer = GLFBDEV_BUFFER(buffer);
- *width = fbdevbuffer->var.xres_virtual;
- *height = fbdevbuffer->var.yres_virtual;
+ *width = fbdevbuffer->var.xres;
+ *height = fbdevbuffer->var.yres;
}
blueBits = varInfo->blue.length;
alphaBits = varInfo->transp.length;
- if ((fixInfo->visual == FB_VISUAL_TRUECOLOR ||
- fixInfo->visual == FB_VISUAL_DIRECTCOLOR)
- && varInfo->bits_per_pixel == 24
- && varInfo->red.offset == 16
- && varInfo->green.offset == 8
- && varInfo->blue.offset == 0) {
- vis->pixelFormat = PF_B8G8R8;
- }
- else if ((fixInfo->visual == FB_VISUAL_TRUECOLOR ||
- fixInfo->visual == FB_VISUAL_DIRECTCOLOR)
- && varInfo->bits_per_pixel == 32
- && varInfo->red.offset == 16
- && varInfo->green.offset == 8
- && varInfo->blue.offset == 0
- && varInfo->transp.offset == 24) {
- vis->pixelFormat = PF_B8G8R8A8;
- }
- else if ((fixInfo->visual == FB_VISUAL_TRUECOLOR ||
- fixInfo->visual == FB_VISUAL_DIRECTCOLOR)
- && varInfo->bits_per_pixel == 16
- && varInfo->red.offset == 11
- && varInfo->green.offset == 5
- && varInfo->blue.offset == 0) {
- vis->pixelFormat = PF_B5G6R5;
- }
- else if ((fixInfo->visual == FB_VISUAL_TRUECOLOR ||
- fixInfo->visual == FB_VISUAL_DIRECTCOLOR)
- && varInfo->bits_per_pixel == 16
- && varInfo->red.offset == 10
- && varInfo->green.offset == 5
- && varInfo->blue.offset == 0) {
- vis->pixelFormat = PF_B5G5R5;
- }
- else {
- _mesa_problem(NULL, "Unsupported fbdev RGB visual/bitdepth!\n");
- _mesa_free(vis);
- return NULL;
+ if (fixInfo->visual == FB_VISUAL_TRUECOLOR ||
+ fixInfo->visual == FB_VISUAL_DIRECTCOLOR) {
+ if(varInfo->bits_per_pixel == 24
+ && varInfo->red.offset == 16
+ && varInfo->green.offset == 8
+ && varInfo->blue.offset == 0)
+ vis->pixelFormat = PF_B8G8R8;
+
+ else if(varInfo->bits_per_pixel == 32
+ && varInfo->red.offset == 16
+ && varInfo->green.offset == 8
+ && varInfo->blue.offset == 0)
+ vis->pixelFormat = PF_B8G8R8A8;
+
+ else if(varInfo->bits_per_pixel == 16
+ && varInfo->red.offset == 11
+ && varInfo->green.offset == 5
+ && varInfo->blue.offset == 0)
+ vis->pixelFormat = PF_B5G6R5;
+
+ else if(varInfo->bits_per_pixel == 16
+ && varInfo->red.offset == 10
+ && varInfo->green.offset == 5
+ && varInfo->blue.offset == 0)
+ vis->pixelFormat = PF_B5G5R5;
+
+ else {
+ _mesa_problem(NULL, "Unsupported fbdev RGB visual/bitdepth!\n");
+ _mesa_free(vis);
+ return NULL;
+ }
}
}
else {
rb->rowStride = visual->var.xres_virtual * visual->var.bits_per_pixel / 8;
rb->bottom = (GLubyte *) bufferStart
- + (visual->var.yres_virtual - 1) * rb->rowStride;
+ + (visual->var.yres - 1) * rb->rowStride;
rb->Base.Width = visual->var.xres;
rb->Base.Height = visual->var.yres;