$(DIRECTORY)/docs/*.spec \
$(DIRECTORY)/include/GL/internal/glcore.h \
$(DIRECTORY)/include/GL/dmesa.h \
- $(DIRECTORY)/include/GL/ggimesa.h \
$(DIRECTORY)/include/GL/gl.h \
$(DIRECTORY)/include/GL/glext.h \
$(DIRECTORY)/include/GL/gl_mangle.h \
$(DIRECTORY)/src/mesa/drivers/fbdev/Makefile \
$(DIRECTORY)/src/mesa/drivers/fbdev/glfbdev.c \
$(DIRECTORY)/src/mesa/drivers/glide/*.[ch] \
- $(DIRECTORY)/src/mesa/drivers/ggi/*.[ch] \
- $(DIRECTORY)/src/mesa/drivers/ggi/ggimesa.conf.in \
- $(DIRECTORY)/src/mesa/drivers/ggi/default/*.c \
- $(DIRECTORY)/src/mesa/drivers/ggi/default/genkgi.conf.in \
- $(DIRECTORY)/src/mesa/drivers/ggi/display/*.c \
- $(DIRECTORY)/src/mesa/drivers/ggi/display/fbdev.conf.in \
- $(DIRECTORY)/src/mesa/drivers/ggi/include/ggi/mesa/*.h \
$(DIRECTORY)/src/mesa/drivers/osmesa/Makefile \
$(DIRECTORY)/src/mesa/drivers/osmesa/Makefile.win \
$(DIRECTORY)/src/mesa/drivers/osmesa/descrip.mms \
$(DIRECTORY)/progs/windml/Makefile.ugl \
$(DIRECTORY)/progs/windml/*.c \
$(DIRECTORY)/progs/windml/*.bmp \
- $(DIRECTORY)/progs/ggi/*.c
GLUT_FILES = \
$(DIRECTORY)/include/GL/glut.h \
$(DIRECTORY)/src/glut/beos/*.[ch] \
$(DIRECTORY)/src/glut/beos/*.cpp \
$(DIRECTORY)/src/glut/beos/Makefile \
- $(DIRECTORY)/src/glut/ggi/*.[ch] \
- $(DIRECTORY)/src/glut/ggi/Makefile \
$(DIRECTORY)/src/glut/fbdev/Makefile \
$(DIRECTORY)/src/glut/fbdev/*[ch] \
$(DIRECTORY)/src/glut/mini/*[ch] \
+++ /dev/null
-/*
- test program for the ggi-mesa driver
-
- Copyright (C) 1997,1998 Uwe Maurer - uwe_maurer@t-online.de
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include <sys/time.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include <GL/gl.h>
-#include <GL/ggimesa.h>
-#include <ggi/ggi.h>
-#include <stdlib.h>
-
-ggi_visual_t vis,vis_mem;
-
-GGIMesaContext ctx;
-
-int screen_x=GGI_AUTO,screen_y=GGI_AUTO;
-ggi_graphtype bpp=GT_AUTO;
-
-//#define ZBUFFER
-
-//#define SMOOTH_NORMALS
-
-void Init()
-{
- GLfloat h=(GLfloat)3/4;
- GLfloat pos[4]={5,5,-20,0};
- GLfloat specular[4]={.4,.4,.4,1};
- GLfloat diffuse[4]={.3,.3,.3,1};
- GLfloat ambient[4]={.2,.2,.2,1};
-
- int err;
-
- if (ggiInit()<0)
- {
- printf("ggiInit() failed\n");
- exit(1);
- }
- ctx=GGIMesaCreateContext();
- if (ctx==NULL)
- {
- printf("Can't create Context!\n");
- exit(1);
- }
-
- vis=ggiOpen(NULL);
- vis_mem=ggiOpen("display-memory",NULL);
- if (vis==NULL || vis_mem==NULL)
- {
- printf("Can't open ggi_visuals!\n");
- exit(1);
- }
- err=ggiSetGraphMode(vis,screen_x,screen_y,screen_x,screen_y,bpp);
- err+=ggiSetGraphMode(vis_mem,screen_x,screen_y,screen_x,screen_y,bpp);
- if (err)
- {
- printf("Can't set %ix%i\n",screen_x,screen_y);
- exit(1);
- }
-
- if (GGIMesaSetVisual(ctx,vis_mem,GL_TRUE,GL_FALSE)<0)
- {
- printf("GGIMesaSetVisual() failed!\n");
- exit(1);
- }
-
- GGIMesaMakeCurrent(ctx);
-
- glViewport(0,0,screen_x,screen_y);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-1,1,-h,h,1,50);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0,0,-9);
- glShadeModel(GL_FLAT);
-
- glFrontFace(GL_CW);
- glEnable(GL_CULL_FACE);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
-
- glLightfv(GL_LIGHT0,GL_POSITION,pos);
-
- glLightfv(GL_LIGHT0,GL_DIFFUSE,diffuse);
- glLightfv(GL_LIGHT0,GL_AMBIENT,ambient);
- glLightfv(GL_LIGHT0,GL_SPECULAR,specular);
-
- #ifdef ZBUFFER
- glEnable(GL_DEPTH_TEST);
- #endif
-}
-
-
-#define MAX_VERTS 1000
-#define MAX_TRIS 2000
-#define MAX_LEN 1024
-#define MAX_F 100000000
-
-void LoadAsc(GLuint *list,char *file)
-{
- FILE *fp;
-
- GLfloat p[MAX_VERTS][3];
- GLfloat normal[MAX_VERTS][3];
- float ncount[MAX_VERTS];
- int v[MAX_TRIS][3];
- char line[MAX_LEN];
- char *s;
- int i,j;
- int verts,faces;
- GLuint v0,v1,v2;
- GLfloat n[3];
- GLfloat len,k;
- GLfloat min[3]={MAX_F,MAX_F,MAX_F};
- GLfloat max[3]={-MAX_F,-MAX_F,-MAX_F};
- char *coord_str[]={"X","Z","Y"};
-
- fp=fopen(file,"r");
- if (!fp)
- {
- printf("Can't open %s!\n",file);
- exit(1);
- }
-
- while (strncmp(fgets(line,MAX_LEN,fp),"Tri-mesh",8)) ;
-
- s=strstr(line,":")+1;
- verts=atoi(s);
- s=strstr(s,":")+1;
- faces=atoi(s);
-
- if (verts>MAX_VERTS)
- {
- printf("Too many vertices..\n");
- exit(1);
- }
-
- while (strncmp(fgets(line,MAX_LEN,fp),"Vertex list",11)) ;
-
- for (i=0;i<verts;i++)
- {
- while (strncmp(fgets(line,MAX_LEN,fp),"Vertex",6)) ;
- for (j=0;j<3;j++)
- {
- s=strstr(line,coord_str[j])+2;
- k=atoi(s);
- if (k>max[j]) max[j]=k;
- if (k<min[j]) min[j]=k;
- p[i][j]=k;
- }
-
- }
- len=0;
- for (i=0;i<3;i++)
- {
- k=max[i]-min[i];
- if (k>len) {len=k;j=i;}
- n[i]=(max[i]+min[i])/2;
- }
-
- len/=2;
-
- for (i=0;i<verts;i++)
- {
- for (j=0;j<3;j++)
- {
- p[i][j]-=n[j];
- p[i][j]/=len;
- }
- }
-
- *list=glGenLists(1);
- glNewList(*list,GL_COMPILE);
- glBegin(GL_TRIANGLES);
-
- memset(ncount,0,sizeof(ncount));
- memset(normal,0,sizeof(normal));
-
- while (strncmp(fgets(line,MAX_LEN,fp),"Face list",9)) ;
- for (i=0;i<faces;i++)
- {
- while (strncmp(fgets(line,MAX_LEN,fp),"Face",4)) ;
- s=strstr(line,"A")+2;
- v0=v[i][0]=atoi(s);
- s=strstr(line,"B")+2;
- v1=v[i][1]=atoi(s);
- s=strstr(line,"C")+2;
- v2=v[i][2]=atoi(s);
- n[0]=((p[v1][1]-p[v0][1])*(p[v2][2]-p[v0][2])
- - (p[v1][2]-p[v0][2])*(p[v2][1]-p[v0][1]));
- n[1]=((p[v1][2]-p[v0][2])*(p[v2][0]-p[v0][0])
- - (p[v1][0]-p[v0][0])*(p[v2][2]-p[v0][2]));
- n[2]=((p[v1][0]-p[v0][0])*(p[v2][1]-p[v0][1])
- - (p[v1][1]-p[v0][1])*(p[v2][0]-p[v0][0]));
- len=n[0]*n[0]+n[1]*n[1]+n[2]*n[2];
- len=sqrt(len);
- n[0]/=len;
- n[1]/=len;
- n[2]/=len;
- #ifdef SMOOTH_NORMALS
- for (j=0;j<3;j++){
- normal[v[i][j]][0]+=n[0];
- normal[v[i][j]][1]+=n[1];
- normal[v[i][j]][2]+=n[2];
- ncount[v[i][j]]++;
- }
- #else
- glNormal3fv(n);
- for (j=0;j<3;j++)
- glVertex3fv(p[v[i][j]]);
- #endif
- }
-
- #ifdef SMOOTH_NORMALS
- for (i=0;i<verts;i++) {
- for (j=0;j<3;j++) {
- normal[i][j]/=ncount[i];
- }
- }
- for (i=0;i<faces;i++) {
- for (j=0;j<3;j++) {
- glNormal3f(normal[v[i][j]][0],
- normal[v[i][j]][1],
- normal[v[i][j]][2]);
- glVertex3fv(p[v[i][j]]);
- }
- }
- #endif
-
- glEnd();
- glEndList();
- fclose(fp);
-}
-
-double Display(GLuint l,int *maxframes)
-{
- int x,y;
- GLfloat col[]={.25,0,.25,1};
- int frames=0;
- struct timeval start,stop;
- double len;
- GLfloat rotate=0;
-
- gettimeofday(&start,NULL);
-
-
- while(1)
- {
- glClearColor(0,0,0,0);
- glClearIndex(0);
-
- #ifdef ZBUFFER
- glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
- #else
- glClear(GL_COLOR_BUFFER_BIT);
- #endif
-
- glPushMatrix();
-
- glRotatef(30,1,0,0);
- glRotatef(rotate/10,0,0,1);
- glTranslatef(-6,-4,0);
- for (y=0;y<3;y++)
- {
- glPushMatrix();
- for (x=0;x<5;x++)
- {
- glPushMatrix();
- glRotatef(rotate,y+1,-x-1,0);
-
- col[0]=(GLfloat)(x+1)/4;
- col[1]=0;
- col[2]=(GLfloat)(y+1)/2;
- glMaterialfv(GL_FRONT,GL_AMBIENT,col);
- glCallList(l);
- glPopMatrix();
- glTranslatef(3,0,0);
- }
- glPopMatrix();
- glTranslatef(0,4,0);
- }
- glPopMatrix();
- glFinish();
-
- ggiPutBox(vis,0,0,screen_x,screen_y,ggiDBGetBuffer(vis,0)->read);
- rotate+=10;
- frames++;
- if (frames==(*maxframes)) break;
-
- if (ggiKbhit(vis))
- {
- *maxframes=frames;
- break;
- }
- }
-
- gettimeofday(&stop,NULL);
- len=(double)(stop.tv_sec-start.tv_sec)+
- (double)(stop.tv_usec-start.tv_usec)/1e6;
- return len;
-}
-
-void visible(int vis)
-{
- if (vis == GLUT_VISIBLE)
- glutIdleFunc(idle);
- else
- glutIdleFunc(NULL);
-}
-
-int main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
- glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
-
- glutInitWindowPosition(0, 0);
- glutInitWindowSize(300, 300);
- glutCreateWindow("asc-view");
- init();
-
- glutDisplayFunc(draw);
- glutReshapeFunc(reshape);
- glutKeyboardFunc(key);
- glutSpecialFunc(special);
- glutVisibilityFunc(visible);
-
- glutMainLoop();
-#if 0
- GLuint l;
- char *file;
- int maxframes=0;
- double len;
-
- Init();
-
- file=(argc>1) ? argv[1] : "asc/box.asc";
- if (argc>2) maxframes=atoi(argv[2]);
-
- if (argc==1)
- {
- printf("usage: %s filename.asc\n",argv[0]);
- }
-
- LoadAsc(&l,file);
-
- len=Display(l,&maxframes);
-
- printf("\ttime: %.3f sec\n",len);
- printf("\tframes: %i\n",maxframes);
- printf("\tfps: %.3f \n",(double)maxframes/len);
-
- GGIMesaDestroyContext(ctx);
- ggiClose(vis);
- ggiClose(vis_mem);
- ggiExit();
-#endif
- return 0;
-}
-
+++ /dev/null
-Terminating on signal 11
-
+++ /dev/null
-#!/bin/sh
-
-function foobar() {
- echo "foo!"
-}
-
-foobar
+++ /dev/null
-Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
-
-Named object: "Object01"
-Tri-mesh, Vertices: 8 Faces: 12
-Vertex list:
-Vertex 0: X: -20 Y: -19.999998 Z: 20.000002
-Vertex 1: X: 20 Y: -19.999998 Z: 20.000002
-Vertex 2: X: 20 Y: 20.000002 Z: 19.999998
-Vertex 3: X: -20 Y: 20.000002 Z: 19.999998
-Vertex 4: X: -20 Y: -20.000002 Z: -19.999998
-Vertex 5: X: 20 Y: -20.000002 Z: -19.999998
-Vertex 6: X: 20 Y: 19.999998 Z: -20.000002
-Vertex 7: X: -20 Y: 19.999998 Z: -20.000002
-Face list:
-Face 0: A:0 B:1 C:2 AB:1 BC:1 CA:0
-Smoothing: 1
-Face 1: A:0 B:2 C:3 AB:0 BC:1 CA:1
-Smoothing: 1
-Face 2: A:0 B:4 C:5 AB:1 BC:1 CA:0
-Smoothing: 2
-Face 3: A:0 B:5 C:1 AB:0 BC:1 CA:1
-Smoothing: 2
-Face 4: A:1 B:5 C:6 AB:1 BC:1 CA:0
-Smoothing: 3
-Face 5: A:1 B:6 C:2 AB:0 BC:1 CA:1
-Smoothing: 3
-Face 6: A:2 B:6 C:7 AB:1 BC:1 CA:0
-Smoothing: 4
-Face 7: A:2 B:7 C:3 AB:0 BC:1 CA:1
-Smoothing: 4
-Face 8: A:3 B:7 C:4 AB:1 BC:1 CA:0
-Smoothing: 5
-Face 9: A:3 B:4 C:0 AB:0 BC:1 CA:1
-Smoothing: 5
-Face 10: A:4 B:7 C:6 AB:1 BC:1 CA:0
-Smoothing: 6
-Face 11: A:4 B:6 C:5 AB:0 BC:1 CA:1
-Smoothing: 6
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 1
-
-
-
+++ /dev/null
-Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
-
-Named object: "Object01"
-Tri-mesh, Vertices: 34 Faces: 64
-Vertex list:
-Vertex 0: X: 60.167416 Y: -87.419525 Z: -53.3088
-Vertex 1: X: 76.70787 Y: -87.419518 Z: -29.84565
-Vertex 2: X: 83.0103 Y: -87.419518 Z: -1.838764
-Vertex 3: X: 78.115204 Y: -87.419518 Z: 26.448057
-Vertex 4: X: 62.767834 Y: -87.41951 Z: 50.708401
-Vertex 5: X: 39.304672 Y: -87.41951 Z: 67.248848
-Vertex 6: X: 11.297782 Y: -87.41951 Z: 73.551254
-Vertex 7: X: -16.989004 Y: -87.41951 Z: 68.656158
-Vertex 8: X: -41.249344 Y: -87.41951 Z: 53.308777
-Vertex 9: X: -57.789783 Y: -87.419518 Z: 29.845612
-Vertex 10: X: -64.092194 Y: -87.419518 Z: 1.838721
-Vertex 11: X: -59.197079 Y: -87.419518 Z: -26.448097
-Vertex 12: X: -43.849678 Y: -87.419525 Z: -50.708427
-Vertex 13: X: -20.386503 Y: -87.419525 Z: -67.248856
-Vertex 14: X: 7.62039 Y: -87.419525 Z: -73.551239
-Vertex 15: X: 35.907204 Y: -87.419525 Z: -68.656105
-Vertex 16: X: 101.684875 Y: 94.590591 Z: -96.955391
-Vertex 17: X: 131.767838 Y: 94.590591 Z: -54.281792
-Vertex 18: X: 143.230377 Y: 94.590599 Z: -3.344275
-Vertex 19: X: 134.327423 Y: 94.590607 Z: 48.102379
-Vertex 20: X: 106.414383 Y: 94.590607 Z: 92.225876
-Vertex 21: X: 63.740765 Y: 94.590607 Z: 122.3088
-Vertex 22: X: 12.803238 Y: 94.590614 Z: 133.771301
-Vertex 23: X: -38.643349 Y: 94.590607 Z: 124.868355
-Vertex 24: X: -82.766846 Y: 94.590607 Z: 96.955307
-Vertex 25: X: -112.849762 Y: 94.590607 Z: 54.281677
-Vertex 26: X: -124.312256 Y: 94.590599 Z: 3.344152
-Vertex 27: X: -115.409271 Y: 94.590591 Z: -48.102493
-Vertex 28: X: -87.496201 Y: 94.590591 Z: -92.225967
-Vertex 29: X: -44.822552 Y: 94.590591 Z: -122.308861
-Vertex 30: X: 6.114983 Y: 94.590584 Z: -133.771332
-Vertex 31: X: 57.561623 Y: 94.590591 Z: -124.868301
-Vertex 32: X: 9.459057 Y: -87.419518 Z: 0.000008
-Vertex 33: X: 9.459057 Y: 94.590599 Z: -0.000008
-Face list:
-Face 0: A:0 B:1 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 1: A:1 B:2 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 2: A:2 B:3 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 3: A:3 B:4 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 4: A:4 B:5 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 5: A:5 B:6 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 6: A:6 B:7 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 7: A:7 B:8 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 8: A:8 B:9 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 9: A:9 B:10 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 10: A:10 B:11 C:32 AB:1 BC:0 CA:0
-
- Page 1
-
-
-
-Smoothing: 1
-Face 11: A:11 B:12 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 12: A:12 B:13 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 13: A:13 B:14 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 14: A:14 B:15 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 15: A:15 B:0 C:32 AB:1 BC:0 CA:0
-Smoothing: 1
-Face 16: A:0 B:16 C:17 AB:1 BC:1 CA:0
-Smoothing: 2
-Face 17: A:0 B:17 C:1 AB:0 BC:1 CA:1
-Smoothing: 2
-Face 18: A:1 B:17 C:18 AB:1 BC:1 CA:0
-Smoothing: 3
-Face 19: A:1 B:18 C:2 AB:0 BC:1 CA:1
-Smoothing: 3
-Face 20: A:2 B:18 C:19 AB:1 BC:1 CA:0
-Smoothing: 4
-Face 21: A:2 B:19 C:3 AB:0 BC:1 CA:1
-Smoothing: 4
-Face 22: A:3 B:19 C:20 AB:1 BC:1 CA:0
-Smoothing: 5
-Face 23: A:3 B:20 C:4 AB:0 BC:1 CA:1
-Smoothing: 5
-Face 24: A:4 B:20 C:21 AB:1 BC:1 CA:0
-Smoothing: 6
-Face 25: A:4 B:21 C:5 AB:0 BC:1 CA:1
-Smoothing: 6
-Face 26: A:5 B:21 C:22 AB:1 BC:1 CA:0
-Smoothing: 7
-Face 27: A:5 B:22 C:6 AB:0 BC:1 CA:1
-Smoothing: 7
-Face 28: A:6 B:22 C:23 AB:1 BC:1 CA:0
-Smoothing: 8
-Face 29: A:6 B:23 C:7 AB:0 BC:1 CA:1
-Smoothing: 8
-Face 30: A:7 B:23 C:24 AB:1 BC:1 CA:0
-Smoothing: 9
-Face 31: A:7 B:24 C:8 AB:0 BC:1 CA:1
-Smoothing: 9
-Face 32: A:8 B:24 C:25 AB:1 BC:1 CA:0
-Smoothing: 10
-Face 33: A:8 B:25 C:9 AB:0 BC:1 CA:1
-Smoothing: 10
-Face 34: A:9 B:25 C:26 AB:1 BC:1 CA:0
-Smoothing: 11
-Face 35: A:9 B:26 C:10 AB:0 BC:1 CA:1
-Smoothing: 11
-Face 36: A:10 B:26 C:27 AB:1 BC:1 CA:0
-Smoothing: 12
-Face 37: A:10 B:27 C:11 AB:0 BC:1 CA:1
-Smoothing: 12
-Face 38: A:11 B:27 C:28 AB:1 BC:1 CA:0
-Smoothing: 13
-Face 39: A:11 B:28 C:12 AB:0 BC:1 CA:1
-Smoothing: 13
-Face 40: A:12 B:28 C:29 AB:1 BC:1 CA:0
-Smoothing: 14
-
- Page 2
-
-
-
-Face 41: A:12 B:29 C:13 AB:0 BC:1 CA:1
-Smoothing: 14
-Face 42: A:13 B:29 C:30 AB:1 BC:1 CA:0
-Smoothing: 15
-Face 43: A:13 B:30 C:14 AB:0 BC:1 CA:1
-Smoothing: 15
-Face 44: A:14 B:30 C:31 AB:1 BC:1 CA:0
-Smoothing: 16
-Face 45: A:14 B:31 C:15 AB:0 BC:1 CA:1
-Smoothing: 16
-Face 46: A:15 B:31 C:16 AB:1 BC:1 CA:0
-Smoothing: 17
-Face 47: A:15 B:16 C:0 AB:0 BC:1 CA:1
-Smoothing: 17
-Face 48: A:16 B:33 C:17 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 49: A:17 B:33 C:18 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 50: A:18 B:33 C:19 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 51: A:19 B:33 C:20 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 52: A:20 B:33 C:21 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 53: A:21 B:33 C:22 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 54: A:22 B:33 C:23 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 55: A:23 B:33 C:24 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 56: A:24 B:33 C:25 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 57: A:25 B:33 C:26 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 58: A:26 B:33 C:27 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 59: A:27 B:33 C:28 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 60: A:28 B:33 C:29 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 61: A:29 B:33 C:30 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 62: A:30 B:33 C:31 AB:0 BC:0 CA:1
-Smoothing: 18
-Face 63: A:31 B:33 C:16 AB:0 BC:0 CA:1
-Smoothing: 18
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 3
-
-
-
+++ /dev/null
-
-/*
- * 3-D gear wheels. This program is in the public domain.
- *
- * Brian Paul
- */
-
-/* Conversion to GLUT by Mark J. Kilgard */
-
-#include <math.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <GL/glut.h>
-
-#ifndef M_PI
-#define M_PI 3.14159265
-#endif
-
-static GLint T0 = 0;
-static GLint Frames = 0;
-
-
-/**
-
- Draw a gear wheel. You'll probably want to call this function when
- building a display list since we do a lot of trig here.
-
- Input: inner_radius - radius of hole at center
- outer_radius - radius at center of teeth
- width - width of gear
- teeth - number of teeth
- tooth_depth - depth of tooth
-
- **/
-
-static void
-gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
- GLint teeth, GLfloat tooth_depth)
-{
- GLint i;
- GLfloat r0, r1, r2;
- GLfloat angle, da;
- GLfloat u, v, len;
-
- r0 = inner_radius;
- r1 = outer_radius - tooth_depth / 2.0;
- r2 = outer_radius + tooth_depth / 2.0;
-
- da = 2.0 * M_PI / teeth / 4.0;
-
- glShadeModel(GL_FLAT);
-
- glNormal3f(0.0, 0.0, 1.0);
-
- /* draw front face */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
- glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
- glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
- if (i < teeth) {
- glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
- }
- }
- glEnd();
-
- /* draw front sides of teeth */
- glBegin(GL_QUADS);
- da = 2.0 * M_PI / teeth / 4.0;
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
-
- glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
- }
- glEnd();
-
- glNormal3f(0.0, 0.0, -1.0);
-
- /* draw back face */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
- glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
- if (i < teeth) {
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
- }
- }
- glEnd();
-
- /* draw back sides of teeth */
- glBegin(GL_QUADS);
- da = 2.0 * M_PI / teeth / 4.0;
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
-
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
- glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
- }
- glEnd();
-
- /* draw outward faces of teeth */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i < teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
-
- glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
- glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
- u = r2 * cos(angle + da) - r1 * cos(angle);
- v = r2 * sin(angle + da) - r1 * sin(angle);
- len = sqrt(u * u + v * v);
- u /= len;
- v /= len;
- glNormal3f(v, -u, 0.0);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
- glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
- glNormal3f(cos(angle), sin(angle), 0.0);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
- glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
- u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
- v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
- glNormal3f(v, -u, 0.0);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
- glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
- glNormal3f(cos(angle), sin(angle), 0.0);
- }
-
- glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5);
- glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5);
-
- glEnd();
-
- glShadeModel(GL_SMOOTH);
-
- /* draw inside radius cylinder */
- glBegin(GL_QUAD_STRIP);
- for (i = 0; i <= teeth; i++) {
- angle = i * 2.0 * M_PI / teeth;
- glNormal3f(-cos(angle), -sin(angle), 0.0);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
- glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
- }
- glEnd();
-
-}
-
-static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
-static GLint gear1, gear2, gear3;
-static GLfloat angle = 0.0;
-
-static void
-draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glPushMatrix();
- glRotatef(view_rotx, 1.0, 0.0, 0.0);
- glRotatef(view_roty, 0.0, 1.0, 0.0);
- glRotatef(view_rotz, 0.0, 0.0, 1.0);
-
- glPushMatrix();
- glTranslatef(-3.0, -2.0, 0.0);
- glRotatef(angle, 0.0, 0.0, 1.0);
- glCallList(gear1);
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef(3.1, -2.0, 0.0);
- glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
- glCallList(gear2);
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef(-3.1, 4.2, 0.0);
- glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
- glCallList(gear3);
- glPopMatrix();
-
- glPopMatrix();
-
- glutSwapBuffers();
-
- Frames++;
- {
- GLint t = glutGet(GLUT_ELAPSED_TIME);
- if (t - T0 >= 5000) {
- GLfloat seconds = (t - T0) / 1000.0;
- GLfloat fps = Frames / seconds;
- printf("%d frames in %g seconds = %g FPS\n", Frames, seconds, fps);
- T0 = t;
- Frames = 0;
- }
- }
-}
-
-
-static void
-idle(void)
-{
- angle += 2.0;
- glutPostRedisplay();
-}
-
-/* change view angle, exit upon ESC */
-/* ARGSUSED1 */
-static void
-key(unsigned char k, int x, int y)
-{
- switch (k) {
- case 'z':
- view_rotz += 5.0;
- break;
- case 'Z':
- view_rotz -= 5.0;
- break;
- case 27: /* Escape */
- exit(0); /* FIXME: Shutdown and free resources cleanly in ggiglut */
- break;
- default:
- return;
- }
- glutPostRedisplay();
-}
-
-/* change view angle */
-/* ARGSUSED1 */
-static void
-special(int k, int x, int y)
-{
- switch (k) {
- case GLUT_KEY_UP:
- view_rotx += 5.0;
- break;
- case GLUT_KEY_DOWN:
- view_rotx -= 5.0;
- break;
- case GLUT_KEY_LEFT:
- view_roty += 5.0;
- break;
- case GLUT_KEY_RIGHT:
- view_roty -= 5.0;
- break;
- default:
- return;
- }
- glutPostRedisplay();
-}
-
-/* new window size or exposure */
-static void
-reshape(int width, int height)
-{
- GLfloat h = (GLfloat) height / (GLfloat) width;
-
- glViewport(0, 0, (GLint) width, (GLint) height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0, 0.0, -40.0);
-}
-
-static void
-init(void)
-{
- static GLfloat pos[4] =
- {5.0, 5.0, 10.0, 0.0};
- static GLfloat red[4] =
- {0.8, 0.1, 0.0, 1.0};
- static GLfloat green[4] =
- {0.0, 0.8, 0.2, 1.0};
- static GLfloat blue[4] =
- {0.2, 0.2, 1.0, 1.0};
-
- glLightfv(GL_LIGHT0, GL_POSITION, pos);
- glEnable(GL_CULL_FACE);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_DEPTH_TEST);
-
- /* make the gears */
- gear1 = glGenLists(1);
- glNewList(gear1, GL_COMPILE);
- glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
- gear(1.0, 4.0, 1.0, 20, 0.7);
- glEndList();
-
- gear2 = glGenLists(1);
- glNewList(gear2, GL_COMPILE);
- glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
- gear(0.5, 2.0, 2.0, 10, 0.7);
- glEndList();
-
- gear3 = glGenLists(1);
- glNewList(gear3, GL_COMPILE);
- glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
- gear(1.3, 2.0, 0.5, 10, 0.7);
- glEndList();
-
- glEnable(GL_NORMALIZE);
-}
-
-void
-visible(int vis)
-{
- if (vis == GLUT_VISIBLE)
- glutIdleFunc(idle);
- else
- glutIdleFunc(NULL);
-}
-
-int main(int argc, char *argv[])
-{
- glutInit(&argc, argv);
- glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
-
-// glutInitWindowPosition(0, 0);
-// glutInitWindowSize(300, 300);
- glutCreateWindow("Gears");
- init();
-
- glutDisplayFunc(draw);
- glutReshapeFunc(reshape);
- glutKeyboardFunc(key);
- glutSpecialFunc(special);
- glutVisibilityFunc(visible);
-
- glutMainLoop();
-
- return 0;
-}
+++ /dev/null
-/* gears.c */
-
-/*
- * 3-D gear wheels. This program is in the public domain.
- *
- * Brian Paul
- * modified by Uwe Maurer (uwe_maurer@t-online.de)
- */
-
-#include <string.h>
-#include <math.h>
-#include <stdlib.h>
-#include <ggi/ggi.h>
-#include <GL/ggimesa.h>
-#ifndef M_PI
-# define M_PI 3.14159265
-#endif
-
-
-ggi_visual_t vis;
-char text[100];
-int db_flag,vis_x, vis_y, vir_x, vir_y, gt;
-
-/*
- * Draw a gear wheel. You'll probably want to call this function when
- * building a display list since we do a lot of trig here.
- *
- * Input: inner_radius - radius of hole at center
- * outer_radius - radius at center of teeth
- * width - width of gear
- * teeth - number of teeth
- * tooth_depth - depth of tooth
- */
-static void gear( GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
- GLint teeth, GLfloat tooth_depth )
-{
- GLint i;
- GLfloat r0, r1, r2;
- GLfloat angle, da;
- GLfloat u, v, len;
-
- r0 = inner_radius;
- r1 = outer_radius - tooth_depth/2.0;
- r2 = outer_radius + tooth_depth/2.0;
-
- da = 2.0*M_PI / teeth / 4.0;
-
- glShadeModel( GL_FLAT );
-
- glNormal3f( 0.0, 0.0, 1.0 );
-
- /* draw front face */
- glBegin( GL_QUAD_STRIP );
- for (i=0;i<=teeth;i++) {
- angle = i * 2.0*M_PI / teeth;
- glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
- glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 );
- glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
- glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
- }
- glEnd();
-
- /* draw front sides of teeth */
- glBegin( GL_QUADS );
- da = 2.0*M_PI / teeth / 4.0;
- for (i=0;i<teeth;i++) {
- angle = i * 2.0*M_PI / teeth;
-
- glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 );
- glVertex3f( r2*cos(angle+da), r2*sin(angle+da), width*0.5 );
- glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), width*0.5 );
- glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
- }
- glEnd();
-
-
- glNormal3f( 0.0, 0.0, -1.0 );
-
- /* draw back face */
- glBegin( GL_QUAD_STRIP );
- for (i=0;i<=teeth;i++) {
- angle = i * 2.0*M_PI / teeth;
- glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 );
- glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
- glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
- glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
- }
- glEnd();
-
- /* draw back sides of teeth */
- glBegin( GL_QUADS );
- da = 2.0*M_PI / teeth / 4.0;
- for (i=0;i<teeth;i++) {
- angle = i * 2.0*M_PI / teeth;
-
- glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
- glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), -width*0.5 );
- glVertex3f( r2*cos(angle+da), r2*sin(angle+da), -width*0.5 );
- glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 );
- }
- glEnd();
-
-
- /* draw outward faces of teeth */
- glBegin( GL_QUAD_STRIP );
- for (i=0;i<teeth;i++) {
- angle = i * 2.0*M_PI / teeth;
-
- glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 );
- glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 );
- u = r2*cos(angle+da) - r1*cos(angle);
- v = r2*sin(angle+da) - r1*sin(angle);
- len = sqrt( u*u + v*v );
- u /= len;
- v /= len;
- glNormal3f( v, -u, 0.0 );
- glVertex3f( r2*cos(angle+da), r2*sin(angle+da), width*0.5 );
- glVertex3f( r2*cos(angle+da), r2*sin(angle+da), -width*0.5 );
- glNormal3f( cos(angle), sin(angle), 0.0 );
- glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), width*0.5 );
- glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), -width*0.5 );
- u = r1*cos(angle+3*da) - r2*cos(angle+2*da);
- v = r1*sin(angle+3*da) - r2*sin(angle+2*da);
- glNormal3f( v, -u, 0.0 );
- glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
- glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
- glNormal3f( cos(angle), sin(angle), 0.0 );
- }
-
- glVertex3f( r1*cos(0), r1*sin(0), width*0.5 );
- glVertex3f( r1*cos(0), r1*sin(0), -width*0.5 );
-
- glEnd();
-
-
- glShadeModel( GL_SMOOTH );
-
- /* draw inside radius cylinder */
- glBegin( GL_QUAD_STRIP );
- for (i=0;i<=teeth;i++) {
- angle = i * 2.0*M_PI / teeth;
- glNormal3f( -cos(angle), -sin(angle), 0.0 );
- glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
- glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
- }
- glEnd();
-
-}
-
-
-static GLfloat view_rotx=20.0, view_roty=30.0, view_rotz=0.0;
-static GLint gear1, gear2, gear3;
-static GLfloat angle = 0.0;
-
-static GLuint limit;
-static GLuint count = 1;
-
-
-static void draw( void )
-{
- static int n = 0;
- glClearColor(0,0,0,0);
- glClearIndex(0);
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
- glPushMatrix();
- glRotatef( view_rotx, 1.0, 0.0, 0.0 );
- glRotatef( view_roty, 0.0, 1.0, 0.0 );
- glRotatef( view_rotz, 0.0, 0.0, 1.0 );
-
- glPushMatrix();
- glTranslatef( -3.0, -2.0, 0.0 );
- glRotatef( angle, 0.0, 0.0, 1.0 );
- glCallList(gear1);
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef( 3.1, -2.0, 0.0 );
- glRotatef( -2.0*angle-9.0, 0.0, 0.0, 1.0 );
- glCallList(gear2);
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef( -3.1, 4.2, 0.0 );
- glRotatef( -2.0*angle-25.0, 0.0, 0.0, 1.0 );
- glCallList(gear3);
- glPopMatrix();
-
- glPopMatrix();
- glFlush();
- glFinish();
-
-#if 0
- ggiSetGCForeground(vis,255);
- ggiPuts(vis,0,0,"Mesa -> GGI");
- ggiPuts(vis,0,ggiGetInfo(vis)->mode->visible.y," Mesa -> GGI");
-
- ggiPuts(vis,0,16,text);
- ggiPuts(vis,0,ggiGetInfo(vis)->mode->visible.y+16,text);
-#endif
-
- if(db_flag)
- ggiMesaSwapBuffers();
-
- count++;
- if (count==limit) {
- exit(1);
- }
- ++n;
- /*
- if (!(n%10)){
- ggi_color rgb = { 10000, 10000, 10000 };
- ggiSetSimpleMode(vis,vis_x+(n/10),vis_y+(n/10),db_flag?2:1, gt);
- glViewport(0, 0,vis_x+(n/10),vis_y+(n/10));
- ggiSetGCForeground(vis, ggiMapColor(vis, &rgb));
- ggiDrawBox(vis, 20, 20, 100, 100);
- if(db_flag)
- ggiSetWriteFrame(vis, 1);
- }
- */
-}
-
-static void idle( void )
-{
- angle += 2.0;
- draw();
-}
-
-/* new window size or exposure */
-static void reshape( int width, int height )
-{
- GLfloat h = (GLfloat) height / (GLfloat) width;
-
- if(db_flag)
- glDrawBuffer(GL_BACK);
- else
- glDrawBuffer(GL_FRONT);
- glViewport(0, 0, (GLint)width, (GLint)height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -h, h, 5.0, 60.0 );
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef( 0.0, 0.0, -40.0 );
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-
-}
-
-
-static void init( void )
-{
- static GLfloat pos[4] = {5.0, 5.0, 10.0, 0.0 };
- static GLfloat red[4] = {0.9, 0.9, 0.9, 1.0 };
- static GLfloat green[4] = {0.0, 0.8, 0.9, 1.0 };
- static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0 };
-
- glLightfv( GL_LIGHT0, GL_POSITION, pos );
- glEnable( GL_CULL_FACE );
- glEnable( GL_LIGHTING );
- glEnable( GL_LIGHT0 );
- glEnable( GL_DEPTH_TEST );
-
- /* make the gears */
- gear1 = glGenLists(1);
- glNewList(gear1, GL_COMPILE);
- glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red );
- glIndexi(1);
- gear( 1.0, 4.0, 1.0, 20, 0.7 );
- glEndList();
-
- gear2 = glGenLists(1);
- glNewList(gear2, GL_COMPILE);
- glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green );
- glIndexi(2);
- gear( 0.5, 2.0, 2.0, 10, 0.7 );
- glEndList();
-
- gear3 = glGenLists(1);
- glNewList(gear3, GL_COMPILE);
- glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue );
- glIndexi(3);
- gear( 1.3, 2.0, 0.5, 10, 0.7 );
- glEndList();
-
- glEnable( GL_NORMALIZE );
-}
-
-static void usage(char *s)
-{
- printf("%s visible_x visible_y virtual_x virtual_y bpp db_flag\n",s);
- printf("example:\n");
- printf("%s 320 200 320 400 8 1\n",s);
- exit(1);
-}
-
-int main( int argc, char *argv[] )
-{
- ggi_mesa_context_t ctx;
- ggi_mode mode;
- int bpp;
-
- limit=0;
-
- if (argc<7) usage(argv[0]);
-
- vis_x=atoi(argv[1]);
- vis_y=atoi(argv[2]);
- vir_x=atoi(argv[3]);
- vir_y=atoi(argv[4]);
- bpp=atoi(argv[5]);
- db_flag=atoi(argv[6]);
-
- switch(bpp)
- {
- case 4: gt=GT_4BIT;break;
- case 8: gt=GT_8BIT;break;
- case 15:gt=GT_15BIT;break;
- case 16:gt=GT_16BIT;break;
- case 24:gt=GT_24BIT;break;
- case 32:gt=GT_32BIT;break;
- default:
- printf("%i Bits per Pixel ???\n",bpp);
- exit(1);
- }
- sprintf(text,"%sx%s %i colors, RGB mode, %s",
- argv[1],argv[2],1<<bpp,
- (db_flag) ? "doublebuffer" : "no doublebuffer");
-
- if (ggiInit()<0)
- {
- printf("ggiInit() failed\n");
- exit(1);
- }
-
- if (ggiMesaInit() < 0)
- {
- printf("ggiMesaInit failed\n");
- exit(1);
- }
-
- vis=ggiOpen(NULL);
- if (vis==NULL)
- {
- printf("ggiOpen() failed\n");
- exit(1);
- }
-
- if (ggiSetSimpleMode(vis,vis_x,vis_y,db_flag ? 2 : 1,gt)<0)
- {
- printf("%s: can't set graphmode (%i %i %i %i) %i BPP\n",
- argv[0],vis_x,vis_y,vir_x,vir_y,bpp);
- exit(1);
- }
-
- if (ggiMesaAttach(vis) < 0)
- {
- printf("ggiMesaAttach failed\n");
- exit(1);
- }
- if (ggiMesaExtendVisual(vis, GL_FALSE, GL_FALSE, 16,
- 0, 0, 0, 0, 0, 1) < 0)
- {
- printf ("GGIMesaSetVisual() failed\n");
- exit(1);
- }
-
- ctx = ggiMesaCreateContext(vis);
- if (ctx==NULL)
- {
- printf("GGIMesaCreateContext() failed\n");
- exit(1);
- }
-
- ggiMesaMakeCurrent(ctx, vis);
- ggiGetMode(vis,&mode);
-
- reshape(mode.visible.x,mode.visible.y);
-
- init();
-
- while (!ggiKbhit(vis)) { /*sleep(1);*/ idle(); }
-
- ggiMesaDestroyContext(ctx);
- ggiClose(vis);
-
- printf("%s\n",text);
-
- ggiExit();
- return 0;
-}
+++ /dev/null
-Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
-
-Named object: "Object01"
-Tri-mesh, Vertices: 20 Faces: 36
-Vertex list:
-Vertex 0: X: -210 Y: -432.781738 Z: 180.000031
-Vertex 1: X: -610.810303 Y: 144.260559 Z: 103.580154
-Vertex 2: X: 56.586655 Y: 144.260544 Z: -128.902023
-Vertex 3: X: -75.776352 Y: 144.260605 Z: 565.321838
-Vertex 4: X: -462.815979 Y: -347.937683 Z: 131.797302
-Vertex 5: X: -616.506042 Y: -126.67173 Z: 102.494209
-Vertex 6: X: -41.847229 Y: -347.937683 Z: -14.843644
-Vertex 7: X: 60.375015 Y: -126.671753 Z: -133.291641
-Vertex 8: X: -125.336807 Y: -347.937653 Z: 423.046448
-Vertex 9: X: -73.868958 Y: -126.671692 Z: 570.797424
-Vertex 10: X: -448.353271 Y: 237.304672 Z: -92.34951
-Vertex 11: X: -192.440964 Y: 237.304672 Z: -181.494431
-Vertex 12: X: 145.038193 Y: 237.304672 Z: 109.754745
-Vertex 13: X: 94.283768 Y: 237.304688 Z: 375.953766
-Vertex 14: X: -326.684937 Y: 237.304733 Z: 522.594727
-Vertex 15: X: -531.842834 Y: 237.304718 Z: 345.540588
-Vertex 16: X: -331.419525 Y: -225.964966 Z: -168.564438
-Vertex 17: X: 152.575485 Y: -225.964935 Z: 249.129868
-Vertex 18: X: -451.155914 Y: -225.964905 Z: 459.434662
-Vertex 19: X: -298.413483 Y: 423.31897 Z: 163.142761
-Face list:
-Face 0: A:0 B:4 C:6 AB:1 BC:1 CA:1
-Face 1: A:4 B:5 C:16 AB:1 BC:1 CA:1
-Face 2: A:4 B:16 C:6 AB:1 BC:1 CA:1
-Face 3: A:6 B:16 C:7 AB:1 BC:1 CA:1
-Face 4: A:5 B:1 C:10 AB:1 BC:1 CA:1
-Face 5: A:5 B:10 C:16 AB:1 BC:1 CA:1
-Face 6: A:16 B:10 C:11 AB:1 BC:1 CA:1
-Face 7: A:16 B:11 C:7 AB:1 BC:1 CA:1
-Face 8: A:7 B:11 C:2 AB:1 BC:1 CA:1
-Face 9: A:0 B:6 C:8 AB:1 BC:1 CA:1
-Face 10: A:6 B:7 C:17 AB:1 BC:1 CA:1
-Face 11: A:6 B:17 C:8 AB:1 BC:1 CA:1
-Face 12: A:8 B:17 C:9 AB:1 BC:1 CA:1
-Face 13: A:7 B:2 C:12 AB:1 BC:1 CA:1
-Face 14: A:7 B:12 C:17 AB:1 BC:1 CA:1
-Face 15: A:17 B:12 C:13 AB:1 BC:1 CA:1
-Face 16: A:17 B:13 C:9 AB:1 BC:1 CA:1
-Face 17: A:9 B:13 C:3 AB:1 BC:1 CA:1
-Face 18: A:0 B:8 C:4 AB:1 BC:1 CA:1
-Face 19: A:8 B:9 C:18 AB:1 BC:1 CA:1
-Face 20: A:8 B:18 C:4 AB:1 BC:1 CA:1
-Face 21: A:4 B:18 C:5 AB:1 BC:1 CA:1
-Face 22: A:9 B:3 C:14 AB:1 BC:1 CA:1
-Face 23: A:9 B:14 C:18 AB:1 BC:1 CA:1
-Face 24: A:18 B:14 C:15 AB:1 BC:1 CA:1
-Face 25: A:18 B:15 C:5 AB:1 BC:1 CA:1
-Face 26: A:5 B:15 C:1 AB:1 BC:1 CA:1
-Face 27: A:1 B:15 C:10 AB:1 BC:1 CA:1
-Face 28: A:15 B:14 C:19 AB:1 BC:1 CA:1
-Face 29: A:15 B:19 C:10 AB:1 BC:1 CA:1
-Face 30: A:10 B:19 C:11 AB:1 BC:1 CA:1
-Face 31: A:14 B:3 C:13 AB:1 BC:1 CA:1
-Face 32: A:14 B:13 C:19 AB:1 BC:1 CA:1
-Face 33: A:19 B:13 C:12 AB:1 BC:1 CA:1
-Face 34: A:19 B:12 C:11 AB:1 BC:1 CA:1
-
- Page 1
-
-
-
-Face 35: A:11 B:12 C:2 AB:1 BC:1 CA:1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 2
-
-
-
+++ /dev/null
-Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
-
-Named object: "Object01"
-Tri-mesh, Vertices: 40 Faces: 80
-Vertex list:
-Vertex 0: X: -50.170624 Y: -0.000026 Z: -240.147842
-Vertex 1: X: -80.584503 Y: -63.958851 Z: -205.014572
-Vertex 2: X: -129.795166 Y: -39.528744 Z: -148.16774
-Vertex 3: X: -129.795166 Y: 39.528721 Z: -148.16774
-Vertex 4: X: -80.584503 Y: 63.958797 Z: -205.014572
-Vertex 5: X: 85.963654 Y: -0.000002 Z: 31.490465
-Vertex 6: X: 39.614838 Y: -63.958828 Z: 34.827602
-Vertex 7: X: -35.37915 Y: -39.528728 Z: 40.227196
-Vertex 8: X: -35.37912 Y: 39.528736 Z: 40.227188
-Vertex 9: X: 39.614838 Y: 63.95882 Z: 34.827595
-Vertex 10: X: -9.852051 Y: 0.000023 Z: 319.829254
-Vertex 11: X: -44.985352 Y: -63.958805 Z: 289.415405
-Vertex 12: X: -101.832199 Y: -39.528709 Z: 240.204758
-Vertex 13: X: -101.832184 Y: 39.528755 Z: 240.204773
-Vertex 14: X: -44.985352 Y: 63.958843 Z: 289.415405
-Vertex 15: X: -281.490326 Y: 0.000035 Z: 455.963654
-Vertex 16: X: -284.827484 Y: -63.958794 Z: 409.614868
-Vertex 17: X: -290.227112 Y: -39.528702 Z: 334.62085
-Vertex 18: X: -290.227112 Y: 39.528763 Z: 334.62088
-Vertex 19: X: -284.827484 Y: 63.958855 Z: 409.614838
-Vertex 20: X: -569.829163 Y: 0.000026 Z: 360.14798
-Vertex 21: X: -539.415344 Y: -63.958801 Z: 325.014709
-Vertex 22: X: -490.204712 Y: -39.528709 Z: 268.167847
-Vertex 23: X: -490.204712 Y: 39.528755 Z: 268.167847
-Vertex 24: X: -539.415344 Y: 63.958847 Z: 325.014679
-Vertex 25: X: -705.963684 Y: 0.000002 Z: 88.509598
-Vertex 26: X: -659.614807 Y: -63.958824 Z: 85.172462
-Vertex 27: X: -584.62085 Y: -39.528725 Z: 79.77285
-Vertex 28: X: -584.62085 Y: 39.52874 Z: 79.77285
-Vertex 29: X: -659.614868 Y: 63.958824 Z: 85.172447
-Vertex 30: X: -610.147827 Y: -0.000023 Z: -199.829361
-Vertex 31: X: -575.014587 Y: -63.958847 Z: -169.415497
-Vertex 32: X: -518.167725 Y: -39.528744 Z: -120.204819
-Vertex 33: X: -518.167725 Y: 39.528721 Z: -120.204834
-Vertex 34: X: -575.014587 Y: 63.958801 Z: -169.415497
-Vertex 35: X: -338.509338 Y: -0.000035 Z: -335.963745
-Vertex 36: X: -335.172241 Y: -63.958858 Z: -289.614868
-Vertex 37: X: -329.772675 Y: -39.528751 Z: -214.620865
-Vertex 38: X: -329.772675 Y: 39.528713 Z: -214.620865
-Vertex 39: X: -335.172241 Y: 63.95879 Z: -289.614899
-Face list:
-Face 0: A:0 B:6 C:1 AB:0 BC:1 CA:1
-Smoothing: 1
-Face 1: A:0 B:5 C:6 AB:1 BC:1 CA:0
-Smoothing: 1
-Face 2: A:1 B:7 C:2 AB:0 BC:1 CA:1
-Smoothing: 2
-Face 3: A:1 B:6 C:7 AB:1 BC:1 CA:0
-Smoothing: 2
-Face 4: A:2 B:8 C:3 AB:0 BC:1 CA:1
-Smoothing: 3
-Face 5: A:2 B:7 C:8 AB:1 BC:1 CA:0
-Smoothing: 3
-Face 6: A:3 B:9 C:4 AB:0 BC:1 CA:1
-Smoothing: 4
-Face 7: A:3 B:8 C:9 AB:1 BC:1 CA:0
-
- Page 1
-
-
-
-Smoothing: 4
-Face 8: A:4 B:5 C:0 AB:0 BC:1 CA:1
-Smoothing: 5
-Face 9: A:4 B:9 C:5 AB:1 BC:1 CA:0
-Smoothing: 5
-Face 10: A:5 B:11 C:6 AB:0 BC:1 CA:1
-Smoothing: 6
-Face 11: A:5 B:10 C:11 AB:1 BC:1 CA:0
-Smoothing: 6
-Face 12: A:6 B:12 C:7 AB:0 BC:1 CA:1
-Smoothing: 7
-Face 13: A:6 B:11 C:12 AB:1 BC:1 CA:0
-Smoothing: 7
-Face 14: A:7 B:13 C:8 AB:0 BC:1 CA:1
-Smoothing: 8
-Face 15: A:7 B:12 C:13 AB:1 BC:1 CA:0
-Smoothing: 8
-Face 16: A:8 B:14 C:9 AB:0 BC:1 CA:1
-Smoothing: 9
-Face 17: A:8 B:13 C:14 AB:1 BC:1 CA:0
-Smoothing: 9
-Face 18: A:9 B:10 C:5 AB:0 BC:1 CA:1
-Smoothing: 10
-Face 19: A:9 B:14 C:10 AB:1 BC:1 CA:0
-Smoothing: 10
-Face 20: A:10 B:16 C:11 AB:0 BC:1 CA:1
-Smoothing: 11
-Face 21: A:10 B:15 C:16 AB:1 BC:1 CA:0
-Smoothing: 11
-Face 22: A:11 B:17 C:12 AB:0 BC:1 CA:1
-Smoothing: 12
-Face 23: A:11 B:16 C:17 AB:1 BC:1 CA:0
-Smoothing: 12
-Face 24: A:12 B:18 C:13 AB:0 BC:1 CA:1
-Smoothing: 13
-Face 25: A:12 B:17 C:18 AB:1 BC:1 CA:0
-Smoothing: 13
-Face 26: A:13 B:19 C:14 AB:0 BC:1 CA:1
-Smoothing: 14
-Face 27: A:13 B:18 C:19 AB:1 BC:1 CA:0
-Smoothing: 14
-Face 28: A:14 B:15 C:10 AB:0 BC:1 CA:1
-Smoothing: 15
-Face 29: A:14 B:19 C:15 AB:1 BC:1 CA:0
-Smoothing: 15
-Face 30: A:15 B:21 C:16 AB:0 BC:1 CA:1
-Smoothing: 16
-Face 31: A:15 B:20 C:21 AB:1 BC:1 CA:0
-Smoothing: 16
-Face 32: A:16 B:22 C:17 AB:0 BC:1 CA:1
-Smoothing: 17
-Face 33: A:16 B:21 C:22 AB:1 BC:1 CA:0
-Smoothing: 17
-Face 34: A:17 B:23 C:18 AB:0 BC:1 CA:1
-Smoothing: 18
-Face 35: A:17 B:22 C:23 AB:1 BC:1 CA:0
-Smoothing: 18
-Face 36: A:18 B:24 C:19 AB:0 BC:1 CA:1
-Smoothing: 19
-Face 37: A:18 B:23 C:24 AB:1 BC:1 CA:0
-Smoothing: 19
-
- Page 2
-
-
-
-Face 38: A:19 B:20 C:15 AB:0 BC:1 CA:1
-Smoothing: 20
-Face 39: A:19 B:24 C:20 AB:1 BC:1 CA:0
-Smoothing: 20
-Face 40: A:20 B:26 C:21 AB:0 BC:1 CA:1
-Smoothing: 21
-Face 41: A:20 B:25 C:26 AB:1 BC:1 CA:0
-Smoothing: 21
-Face 42: A:21 B:27 C:22 AB:0 BC:1 CA:1
-Smoothing: 22
-Face 43: A:21 B:26 C:27 AB:1 BC:1 CA:0
-Smoothing: 22
-Face 44: A:22 B:28 C:23 AB:0 BC:1 CA:1
-Smoothing: 23
-Face 45: A:22 B:27 C:28 AB:1 BC:1 CA:0
-Smoothing: 23
-Face 46: A:23 B:29 C:24 AB:0 BC:1 CA:1
-Smoothing: 24
-Face 47: A:23 B:28 C:29 AB:1 BC:1 CA:0
-Smoothing: 24
-Face 48: A:24 B:25 C:20 AB:0 BC:1 CA:1
-Smoothing: 25
-Face 49: A:24 B:29 C:25 AB:1 BC:1 CA:0
-Smoothing: 25
-Face 50: A:25 B:31 C:26 AB:0 BC:1 CA:1
-Smoothing: 26
-Face 51: A:25 B:30 C:31 AB:1 BC:1 CA:0
-Smoothing: 26
-Face 52: A:26 B:32 C:27 AB:0 BC:1 CA:1
-Smoothing: 27
-Face 53: A:26 B:31 C:32 AB:1 BC:1 CA:0
-Smoothing: 27
-Face 54: A:27 B:33 C:28 AB:0 BC:1 CA:1
-Smoothing: 28
-Face 55: A:27 B:32 C:33 AB:1 BC:1 CA:0
-Smoothing: 28
-Face 56: A:28 B:34 C:29 AB:0 BC:1 CA:1
-Smoothing: 29
-Face 57: A:28 B:33 C:34 AB:1 BC:1 CA:0
-Smoothing: 29
-Face 58: A:29 B:30 C:25 AB:0 BC:1 CA:1
-Smoothing: 30
-Face 59: A:29 B:34 C:30 AB:1 BC:1 CA:0
-Smoothing: 30
-Face 60: A:30 B:36 C:31 AB:0 BC:1 CA:1
-Smoothing: 31
-Face 61: A:30 B:35 C:36 AB:1 BC:1 CA:0
-Smoothing: 31
-Face 62: A:31 B:37 C:32 AB:0 BC:1 CA:1
-Smoothing: 32
-Face 63: A:31 B:36 C:37 AB:1 BC:1 CA:0
-Smoothing: 32
-Face 64: A:32 B:38 C:33 AB:0 BC:1 CA:1
-Smoothing: 1
-Face 65: A:32 B:37 C:38 AB:1 BC:1 CA:0
-Smoothing: 1
-Face 66: A:33 B:39 C:34 AB:0 BC:1 CA:1
-Smoothing: 2
-Face 67: A:33 B:38 C:39 AB:1 BC:1 CA:0
-Smoothing: 2
-Face 68: A:34 B:35 C:30 AB:0 BC:1 CA:1
-
- Page 3
-
-
-
-Smoothing: 3
-Face 69: A:34 B:39 C:35 AB:1 BC:1 CA:0
-Smoothing: 3
-Face 70: A:35 B:1 C:36 AB:0 BC:1 CA:1
-Smoothing: 4
-Face 71: A:35 B:0 C:1 AB:1 BC:1 CA:0
-Smoothing: 4
-Face 72: A:36 B:2 C:37 AB:0 BC:1 CA:1
-Smoothing: 5
-Face 73: A:36 B:1 C:2 AB:1 BC:1 CA:0
-Smoothing: 5
-Face 74: A:37 B:3 C:38 AB:0 BC:1 CA:1
-Smoothing: 6
-Face 75: A:37 B:2 C:3 AB:1 BC:1 CA:0
-Smoothing: 6
-Face 76: A:38 B:4 C:39 AB:0 BC:1 CA:1
-Smoothing: 7
-Face 77: A:38 B:3 C:4 AB:1 BC:1 CA:0
-Smoothing: 7
-Face 78: A:39 B:0 C:35 AB:0 BC:1 CA:1
-Smoothing: 8
-Face 79: A:39 B:4 C:0 AB:1 BC:1 CA:0
-Smoothing: 8
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 4
-
-
-
+++ /dev/null
-Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
-
-Named object: "Object01"
-Tri-mesh, Vertices: 64 Faces: 128
-Vertex list:
-Vertex 0: X: 61.483898 Y: 37.836231 Z: -70.94294
-Vertex 1: X: 82.867447 Y: 37.836235 Z: -41.288902
-Vertex 2: X: 91.275154 Y: 37.836239 Z: -5.70901
-Vertex 3: X: 85.427025 Y: 37.836243 Z: 30.380013
-Vertex 4: X: 66.213379 Y: 37.836243 Z: 61.483936
-Vertex 5: X: 36.559322 Y: 37.836246 Z: 82.86747
-Vertex 6: X: 0.979424 Y: 37.836246 Z: 91.275154
-Vertex 7: X: -35.109554 Y: 37.836246 Z: 85.42701
-Vertex 8: X: -66.213478 Y: 37.836246 Z: 66.213356
-Vertex 9: X: -87.597 Y: 37.836243 Z: 36.559303
-Vertex 10: X: -96.004677 Y: 37.836239 Z: 0.979406
-Vertex 11: X: -90.156517 Y: 37.836235 Z: -35.109615
-Vertex 12: X: -70.942848 Y: 37.836235 Z: -66.213516
-Vertex 13: X: -41.288776 Y: 37.836231 Z: -87.597023
-Vertex 14: X: -5.708872 Y: 37.836231 Z: -96.004692
-Vertex 15: X: 30.380142 Y: 37.836231 Z: -90.156502
-Vertex 16: X: 61.483898 Y: -38.14529 Z: -70.942932
-Vertex 17: X: 82.867447 Y: -38.145287 Z: -41.288895
-Vertex 18: X: 91.275154 Y: -38.145283 Z: -5.709003
-Vertex 19: X: 85.427025 Y: -38.145279 Z: 30.38002
-Vertex 20: X: 66.213379 Y: -38.145279 Z: 61.483944
-Vertex 21: X: 36.559322 Y: -38.145275 Z: 82.867477
-Vertex 22: X: 0.979424 Y: -38.145275 Z: 91.275162
-Vertex 23: X: -35.109554 Y: -38.145275 Z: 85.427017
-Vertex 24: X: -66.213478 Y: -38.145275 Z: 66.213364
-Vertex 25: X: -87.597 Y: -38.145279 Z: 36.559311
-Vertex 26: X: -96.004677 Y: -38.145283 Z: 0.979412
-Vertex 27: X: -90.156517 Y: -38.145287 Z: -35.109608
-Vertex 28: X: -70.942848 Y: -38.145287 Z: -66.213516
-Vertex 29: X: -41.288776 Y: -38.14529 Z: -87.597015
-Vertex 30: X: -5.708872 Y: -38.14529 Z: -96.004684
-Vertex 31: X: 30.380142 Y: -38.14529 Z: -90.156494
-Vertex 32: X: 29.53923 Y: 37.836235 Z: -36.632011
-Vertex 33: X: 40.224194 Y: 37.836239 Z: -21.814436
-Vertex 34: X: 44.425369 Y: 37.836239 Z: -4.035822
-Vertex 35: X: 41.503166 Y: 37.836239 Z: 13.997195
-Vertex 36: X: 31.902466 Y: 37.836243 Z: 29.539249
-Vertex 37: X: 17.084883 Y: 37.836243 Z: 40.224201
-Vertex 38: X: -0.693734 Y: 37.836243 Z: 44.425365
-Vertex 39: X: -18.726728 Y: 37.836243 Z: 41.503159
-Vertex 40: X: -34.26878 Y: 37.836243 Z: 31.902454
-Vertex 41: X: -44.953732 Y: 37.836239 Z: 17.084871
-Vertex 42: X: -49.154892 Y: 37.836239 Z: -0.693745
-Vertex 43: X: -46.232677 Y: 37.836239 Z: -18.726759
-Vertex 44: X: -36.631962 Y: 37.836235 Z: -34.268806
-Vertex 45: X: -21.814371 Y: 37.836235 Z: -44.953747
-Vertex 46: X: -4.035751 Y: 37.836235 Z: -49.1549
-Vertex 47: X: 13.997261 Y: 37.836235 Z: -46.23267
-Vertex 48: X: 29.53923 Y: -38.145287 Z: -36.632004
-Vertex 49: X: 40.224194 Y: -38.145283 Z: -21.814428
-Vertex 50: X: 44.425369 Y: -38.145283 Z: -4.035816
-Vertex 51: X: 41.503166 Y: -38.145283 Z: 13.997201
-Vertex 52: X: 31.902466 Y: -38.145279 Z: 29.539257
-Vertex 53: X: 17.084883 Y: -38.145279 Z: 40.224209
-Vertex 54: X: -0.693734 Y: -38.145279 Z: 44.425373
-Vertex 55: X: -18.726728 Y: -38.145279 Z: 41.503166
-
- Page 1
-
-
-
-Vertex 56: X: -34.26878 Y: -38.145279 Z: 31.902462
-Vertex 57: X: -44.953732 Y: -38.145283 Z: 17.084879
-Vertex 58: X: -49.154892 Y: -38.145283 Z: -0.693738
-Vertex 59: X: -46.232677 Y: -38.145283 Z: -18.726751
-Vertex 60: X: -36.631962 Y: -38.145287 Z: -34.268799
-Vertex 61: X: -21.814371 Y: -38.145287 Z: -44.953739
-Vertex 62: X: -4.035751 Y: -38.145287 Z: -49.154892
-Vertex 63: X: 13.997261 Y: -38.145287 Z: -46.232662
-Face list:
-Face 0: A:0 B:1 C:17 AB:1 BC:1 CA:0
-Smoothing: 1
-Face 1: A:0 B:17 C:16 AB:0 BC:1 CA:1
-Smoothing: 1
-Face 2: A:1 B:2 C:18 AB:1 BC:1 CA:0
-Smoothing: 2
-Face 3: A:1 B:18 C:17 AB:0 BC:1 CA:1
-Smoothing: 2
-Face 4: A:2 B:3 C:19 AB:1 BC:1 CA:0
-Smoothing: 3
-Face 5: A:2 B:19 C:18 AB:0 BC:1 CA:1
-Smoothing: 3
-Face 6: A:3 B:4 C:20 AB:1 BC:1 CA:0
-Smoothing: 4
-Face 7: A:3 B:20 C:19 AB:0 BC:1 CA:1
-Smoothing: 4
-Face 8: A:4 B:5 C:21 AB:1 BC:1 CA:0
-Smoothing: 5
-Face 9: A:4 B:21 C:20 AB:0 BC:1 CA:1
-Smoothing: 5
-Face 10: A:5 B:6 C:22 AB:1 BC:1 CA:0
-Smoothing: 6
-Face 11: A:5 B:22 C:21 AB:0 BC:1 CA:1
-Smoothing: 6
-Face 12: A:6 B:7 C:23 AB:1 BC:1 CA:0
-Smoothing: 7
-Face 13: A:6 B:23 C:22 AB:0 BC:1 CA:1
-Smoothing: 7
-Face 14: A:7 B:8 C:24 AB:1 BC:1 CA:0
-Smoothing: 8
-Face 15: A:7 B:24 C:23 AB:0 BC:1 CA:1
-Smoothing: 8
-Face 16: A:8 B:9 C:25 AB:1 BC:1 CA:0
-Smoothing: 9
-Face 17: A:8 B:25 C:24 AB:0 BC:1 CA:1
-Smoothing: 9
-Face 18: A:9 B:10 C:26 AB:1 BC:1 CA:0
-Smoothing: 10
-Face 19: A:9 B:26 C:25 AB:0 BC:1 CA:1
-Smoothing: 10
-Face 20: A:10 B:11 C:27 AB:1 BC:1 CA:0
-Smoothing: 11
-Face 21: A:10 B:27 C:26 AB:0 BC:1 CA:1
-Smoothing: 11
-Face 22: A:11 B:12 C:28 AB:1 BC:1 CA:0
-Smoothing: 12
-Face 23: A:11 B:28 C:27 AB:0 BC:1 CA:1
-Smoothing: 12
-Face 24: A:12 B:13 C:29 AB:1 BC:1 CA:0
-Smoothing: 13
-Face 25: A:12 B:29 C:28 AB:0 BC:1 CA:1
-Smoothing: 13
-
- Page 2
-
-
-
-Face 26: A:13 B:14 C:30 AB:1 BC:1 CA:0
-Smoothing: 14
-Face 27: A:13 B:30 C:29 AB:0 BC:1 CA:1
-Smoothing: 14
-Face 28: A:14 B:15 C:31 AB:1 BC:1 CA:0
-Smoothing: 15
-Face 29: A:14 B:31 C:30 AB:0 BC:1 CA:1
-Smoothing: 15
-Face 30: A:15 B:0 C:16 AB:1 BC:1 CA:0
-Smoothing: 16
-Face 31: A:15 B:16 C:31 AB:0 BC:1 CA:1
-Smoothing: 16
-Face 32: A:32 B:49 C:33 AB:0 BC:1 CA:1
-Smoothing: 17
-Face 33: A:32 B:48 C:49 AB:1 BC:1 CA:0
-Smoothing: 17
-Face 34: A:33 B:50 C:34 AB:0 BC:1 CA:1
-Smoothing: 18
-Face 35: A:33 B:49 C:50 AB:1 BC:1 CA:0
-Smoothing: 18
-Face 36: A:34 B:51 C:35 AB:0 BC:1 CA:1
-Smoothing: 19
-Face 37: A:34 B:50 C:51 AB:1 BC:1 CA:0
-Smoothing: 19
-Face 38: A:35 B:52 C:36 AB:0 BC:1 CA:1
-Smoothing: 20
-Face 39: A:35 B:51 C:52 AB:1 BC:1 CA:0
-Smoothing: 20
-Face 40: A:36 B:53 C:37 AB:0 BC:1 CA:1
-Smoothing: 21
-Face 41: A:36 B:52 C:53 AB:1 BC:1 CA:0
-Smoothing: 21
-Face 42: A:37 B:54 C:38 AB:0 BC:1 CA:1
-Smoothing: 22
-Face 43: A:37 B:53 C:54 AB:1 BC:1 CA:0
-Smoothing: 22
-Face 44: A:38 B:55 C:39 AB:0 BC:1 CA:1
-Smoothing: 23
-Face 45: A:38 B:54 C:55 AB:1 BC:1 CA:0
-Smoothing: 23
-Face 46: A:39 B:56 C:40 AB:0 BC:1 CA:1
-Smoothing: 24
-Face 47: A:39 B:55 C:56 AB:1 BC:1 CA:0
-Smoothing: 24
-Face 48: A:40 B:57 C:41 AB:0 BC:1 CA:1
-Smoothing: 25
-Face 49: A:40 B:56 C:57 AB:1 BC:1 CA:0
-Smoothing: 25
-Face 50: A:41 B:58 C:42 AB:0 BC:1 CA:1
-Smoothing: 26
-Face 51: A:41 B:57 C:58 AB:1 BC:1 CA:0
-Smoothing: 26
-Face 52: A:42 B:59 C:43 AB:0 BC:1 CA:1
-Smoothing: 27
-Face 53: A:42 B:58 C:59 AB:1 BC:1 CA:0
-Smoothing: 27
-Face 54: A:43 B:60 C:44 AB:0 BC:1 CA:1
-Smoothing: 28
-Face 55: A:43 B:59 C:60 AB:1 BC:1 CA:0
-Smoothing: 28
-Face 56: A:44 B:61 C:45 AB:0 BC:1 CA:1
-
- Page 3
-
-
-
-Smoothing: 29
-Face 57: A:44 B:60 C:61 AB:1 BC:1 CA:0
-Smoothing: 29
-Face 58: A:45 B:62 C:46 AB:0 BC:1 CA:1
-Smoothing: 30
-Face 59: A:45 B:61 C:62 AB:1 BC:1 CA:0
-Smoothing: 30
-Face 60: A:46 B:63 C:47 AB:0 BC:1 CA:1
-Smoothing: 31
-Face 61: A:46 B:62 C:63 AB:1 BC:1 CA:0
-Smoothing: 31
-Face 62: A:47 B:48 C:32 AB:0 BC:1 CA:1
-Smoothing: 32
-Face 63: A:47 B:63 C:48 AB:1 BC:1 CA:0
-Smoothing: 32
-Face 64: A:0 B:32 C:33 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 65: A:0 B:33 C:1 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 66: A:1 B:33 C:34 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 67: A:1 B:34 C:2 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 68: A:2 B:34 C:35 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 69: A:2 B:35 C:3 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 70: A:3 B:35 C:36 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 71: A:3 B:36 C:4 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 72: A:4 B:36 C:37 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 73: A:4 B:37 C:5 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 74: A:5 B:37 C:38 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 75: A:5 B:38 C:6 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 76: A:6 B:38 C:39 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 77: A:6 B:39 C:7 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 78: A:7 B:39 C:40 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 79: A:7 B:40 C:8 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 80: A:8 B:40 C:41 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 81: A:8 B:41 C:9 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 82: A:9 B:41 C:42 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 83: A:9 B:42 C:10 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 84: A:10 B:42 C:43 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 85: A:10 B:43 C:11 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 86: A:11 B:43 C:44 AB:0 BC:1 CA:0
-Smoothing: 1
-
- Page 4
-
-
-
-Face 87: A:11 B:44 C:12 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 88: A:12 B:44 C:45 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 89: A:12 B:45 C:13 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 90: A:13 B:45 C:46 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 91: A:13 B:46 C:14 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 92: A:14 B:46 C:47 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 93: A:14 B:47 C:15 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 94: A:15 B:47 C:32 AB:0 BC:1 CA:0
-Smoothing: 1
-Face 95: A:15 B:32 C:0 AB:0 BC:0 CA:1
-Smoothing: 1
-Face 96: A:16 B:17 C:49 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 97: A:16 B:49 C:48 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 98: A:17 B:18 C:50 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 99: A:17 B:50 C:49 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 100: A:18 B:19 C:51 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 101: A:18 B:51 C:50 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 102: A:19 B:20 C:52 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 103: A:19 B:52 C:51 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 104: A:20 B:21 C:53 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 105: A:20 B:53 C:52 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 106: A:21 B:22 C:54 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 107: A:21 B:54 C:53 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 108: A:22 B:23 C:55 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 109: A:22 B:55 C:54 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 110: A:23 B:24 C:56 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 111: A:23 B:56 C:55 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 112: A:24 B:25 C:57 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 113: A:24 B:57 C:56 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 114: A:25 B:26 C:58 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 115: A:25 B:58 C:57 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 116: A:26 B:27 C:59 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 117: A:26 B:59 C:58 AB:0 BC:1 CA:0
-
- Page 5
-
-
-
-Smoothing: 2
-Face 118: A:27 B:28 C:60 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 119: A:27 B:60 C:59 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 120: A:28 B:29 C:61 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 121: A:28 B:61 C:60 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 122: A:29 B:30 C:62 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 123: A:29 B:62 C:61 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 124: A:30 B:31 C:63 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 125: A:30 B:63 C:62 AB:0 BC:1 CA:0
-Smoothing: 2
-Face 126: A:31 B:16 C:48 AB:1 BC:0 CA:0
-Smoothing: 2
-Face 127: A:31 B:48 C:63 AB:0 BC:1 CA:0
-Smoothing: 2
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 6
-
-
-
+++ /dev/null
-# Makefile for GLUT for ggi
-
-TOP = ../../..
-
-include $(TOP)/configs/current
-
-
-##### MACROS #####
-
-GLUT_MAJOR = 3
-GLUT_MINOR = 7
-GLUT_TINY = 1
-
-SOURCES = \
- ggiglut.c
-
-
-OBJECTS = $(SOURCES:.c=.o)
-
-
-##### RULES #####
-
-.c.o:
- $(CC) -c -I$(TOP)/include $(CFLAGS) $(GLUT_CFLAGS) $<
-
-
-
-##### TARGETS #####
-
-default: $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
-
-
-# Make the library
-$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
- $(MKLIB) -o $(GLUT_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
- -major $(GLUT_MAJOR) -minor $(GLUT_MINOR) \
- -patch $(GLUT_TINY) $(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \
- $(GLUT_LIB_DEPS) $(OBJECTS)
-
-
-clean:
- -rm -f *.o *~
- -rm -f *.lo
- -rm -f *.la
- -rm -rf .libs
-
-
-depend: $(SOURCES)
- rm -f depend
- touch depend
- $(MKDEP) $(MKDEP_OPTIONS) -I$(TOP)/include $(SOURCES)
-
-include depend
+++ /dev/null
-/*
-******************************************************************************
-
- GGIMesa debugging macros
-
- Copyright (C) 1998-1999 Marcus Sundberg [marcus@ggi-project.org]
- Copyright (C) 1999-2000 Jon Taylor [taylorj@ggi-project.org]
-
- 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
- THE AUTHOR(S) 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 _GGI_GLUT_INTERNAL_DEBUG_H
-#define _GGI_GLUT_INTERNAL_DEBUG_H
-
-#define DEBUG
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <ggi/types.h>
-#include <ggi/gg.h>
-
-
-__BEGIN_DECLS
-
-/* Exported variables */
-#ifdef BUILDING_GGIGLUT
-extern uint32 _ggiglutDebugState;
-extern int _ggiglutDebugSync;
-#else
-IMPORTVAR uint32 _ggiglutDebugState;
-IMPORTVAR int _ggiglutDebugSync;
-#endif
-
-__END_DECLS
-
-
-/* Debugging types
- * bit 0 is reserved! */
-
-#define GGIGLUTDEBUG_CORE (1<<1) /* 2 */
-#define GGIGLUTDEBUG_MODE (1<<2) /* 4 */
-#define GGIGLUTDEBUG_COLOR (1<<3) /* 8 */
-#define GGIGLUTDEBUG_DRAW (1<<4) /* 16 */
-#define GGIGLUTDEBUG_MISC (1<<5) /* 32 */
-#define GGIGLUTDEBUG_LIBS (1<<6) /* 64 */
-#define GGIGLUTDEBUG_EVENTS (1<<7) /* 128 */
-
-#define GGIGLUTDEBUG_ALL 0xffffffff
-
-#ifdef __GNUC__
-
-#ifdef DEBUG
-#define GGIGLUTDPRINT(form,args...) if (_ggiglutDebugState) { ggDPrintf(_ggiglutDebugSync, "GGIGLUT",form, ##args); }
-#define GGIGLUTDPRINT_CORE(form,args...) if (_ggiglutDebugState & GGIGLUTDEBUG_CORE) { ggDPrintf(_ggiglutDebugSync,"GGIGLUT",form, ##args); }
-#define GGIGLUTDPRINT_MODE(form,args...) if (_ggiglutDebugState & GGIGLUTDEBUG_MODE) { ggDPrintf(_ggiglutDebugSync,"GGIGLUT",form, ##args); }
-#define GGIGLUTDPRINT_COLOR(form,args...) if (_ggiglutDebugState & GGIGLUTDEBUG_COLOR) { ggDPrintf(_ggiglutDebugSync,"GGIGLUT",form, ##args); }
-#define GGIGLUTDPRINT_DRAW(form,args...) if (_ggiglutDebugState & GGIGLUTDEBUG_DRAW) { ggDPrintf(_ggiglutDebugSync,"GGIGLUT",form, ##args); }
-#define GGIGLUTDPRINT_MISC(form,args...) if (_ggiglutDebugState & GGIGLUTDEBUG_MISC) { ggDPrintf(_ggiglutDebugSync,"GGIGLUT",form, ##args); }
-#define GGIGLUTDPRINT_LIBS(form,args...) if (_ggiglutDebugState & GGIGLUTDEBUG_LIBS) { ggDPrintf(_ggiglutDebugSync,"GGIGLUT",form, ##args); }
-#define GGIGLUTDPRINT_EVENTS(form,args...) if (_ggiglutDebugState & GGIGLUTDEBUG_EVENTS) { ggDPrintf(_ggiglutDebugSync,"GGIGLUT",form, ##args); }
-#else /* DEBUG */
-#define GGIGLUTDPRINT(form,args...) do{}while(0)
-#define GGIGLUTDPRINT_CORE(form,args...) do{}while(0)
-#define GGIGLUTDPRINT_MODE(form,args...) do{}while(0)
-#define GGIGLUTDPRINT_COLOR(form,args...) do{}while(0)
-#define GGIGLUTDPRINT_DRAW(form,args...) do{}while(0)
-#define GGIGLUTDPRINT_MISC(form,args...) do{}while(0)
-#define GGIGLUTDPRINT_LIBS(form,args...) do{}while(0)
-#define GGIGLUTDPRINT_EVENTS(form,args...) do{}while(0)
-#endif /* DEBUG */
-
-#else /* __GNUC__ */
-
-__BEGIN_DECLS
-
-static inline void GGIGLUTDPRINT(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState) {
- va_list args;
-
- fprintf(stderr, "GGIGLUT: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggiglutDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIGLUTDPRINT_CORE(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_CORE) {
- va_list args;
-
- fprintf(stderr, "GGIGLUT: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggiglutDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIGLUTDPRINT_MODE(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_MODE) {
- va_list args;
-
- fprintf(stderr, "GGIGLUT: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggiglutDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIGLUTDPRINT_COLOR(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_COLOR) {
- va_list args;
-
- fprintf(stderr, "GGIGLUT: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggiglutDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIGLUTDPRINT_DRAW(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_DRAW) {
- va_list args;
-
- fprintf(stderr, "GGIGLUT: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggiglutDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIGLUTDPRINT_MISC(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_MISC) {
- va_list args;
-
- fprintf(stderr, "GGIGLUT: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggiglutDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIGLUTDPRINT_LIBS(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_LIBS) {
- va_list args;
-
- fprintf(stderr, "GGIGLUT: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggiglutDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIGLUTDPRINT_EVENTS(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_EVENTS) {
- va_list args;
-
- fprintf(stderr, "GGIGLUT: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggiglutDebugSync) fflush(stderr);
- }
-#endif
-}
-
-__END_DECLS
-
-#endif /* __GNUC__ */
-
-#ifdef DEBUG
-#define GGIGLUT_ASSERT(x,str) \
-{ if (!(x)) { \
- fprintf(stderr,"GGIGLUT:%s:%d: INTERNAL ERROR: %s\n",__FILE__,__LINE__,str); \
- exit(1); \
-} }
-#define GGIGLUT_APPASSERT(x,str) \
-{ if (!(x)) { \
- fprintf(stderr,"GGIGLUT:%s:%d: APPLICATION ERROR: %s\n",__FILE__,__LINE__,str); \
- exit(1); \
-} }
-#else /* DEBUG */
-#define GGIGLUT_ASSERT(x,str) do{}while(0)
-#define GGIGLUT_APPASSERT(x,str) do{}while(0)
-#endif /* DEBUG */
-
-#ifdef DEBUG
-# define GGIGLUTD0(x) x
-#else
-# define GGIGLUTD0(x) /* empty */
-#endif
-
-#ifdef GGIGLUTDLEV
-# if GGIGLUTDLEV == 1
-# define GGIGLUTD1(x) x
-# define GGIGLUTD2(x) /* empty */
-# define GGIGLUTD3(x) /* empty */
-# elif GGIGLUTDLEV == 2
-# define GGIGLUTD1(x) x
-# define GGIGLUTD2(x) x
-# define GGIGLUTD3(x) /* empty */
-# elif GGIGLUTDLEV > 2
-# define GGIGLUTD1(x) x
-# define GGIGLUTD2(x) x
-# define GGIGLUTD3(x) x
-# endif
-#else
-# define GGIGLUTD1(x) /* empty */
-# define GGIGLUTD2(x) /* empty */
-# define GGIGLUTD3(x) /* empty */
-#endif
-
-#endif /* _GGI_MESA_INTERNAL_DEBUG_H */
+++ /dev/null
-/* **************************************************************************
- * ggiglut.c
- * **************************************************************************
- *
- * Copyright (C) 1998 Uwe Maurer - uwe_maurer@t-online.de
- * Copyright (C) 1999 James Simmons
- * Copyright (C) 1999 Jon Taylor
- *
- * 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.
- *
- * **************************************************************************
- * To-do:
- * - Make everything use the portable ggi_* types
- *
- */
-
-#define BUILDING_GGIGLUT
-
-#define WIDTH 640
-#define HEIGHT 480
-#define GRAPHTYPE_RGB GT_16BIT
-#define GRAPHTYPE_INDEX GT_8BIT
-
-/*************************************************************************/
-
-#include <GL/gl.h>
-#include <GL/glu.h>
-#include <GL/glut.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include "GL/ggimesa.h"
-#include "debug.h"
-
-#include <ggi/ggi.h>
-#include <ggi/gii.h>
-
-int _ggiglutDebugSync = 0;
-uint32 _ggiglutDebugState = 0;
-
-char *__glutProgramName = "GGI";
-
-static ggi_visual_t __glut_vis;
-
-static ggi_mesa_context_t __glut_ctx;
-
-//static int __glut_width = WIDTH;
-//static int __glut_height = HEIGHT;
-//static ggi_graphtype __glut_gt_rgb = GRAPHTYPE_RGB;
-//static ggi_graphtype __glut_gt_index = GRAPHTYPE_INDEX;
-static int __glut_width = GGI_AUTO;
-static int __glut_height = GGI_AUTO;
-static ggi_graphtype __glut_gt_rgb = GT_AUTO;
-static ggi_graphtype __glut_gt_index = GT_8BIT;
-static int __glut_init = GL_FALSE;
-
-static int mousex = WIDTH / 2;
-static int mousey = HEIGHT / 2;
-static int mouse_moved = GL_FALSE;
-static int mouse_down = GL_FALSE;
-static int mouse_showcursor = GL_FALSE;
-
-static void (*__glut_reshape)(int, int);
-static void (*__glut_display)(void);
-static void (*__glut_idle)(void);
-static void (*__glut_keyboard)(unsigned char, int, int);
-static void (*__glut_special)(int, int, int);
-static void (*__glut_mouse)(int, int, int, int);
-static void (*__glut_motion)(int, int);
-static void (*__glut_passive_motion)(int, int);
-static void (*__glut_visibility)(int);
-
-static unsigned int __glut_mode = GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH;
-
-static int __glut_mod_keys = 0;
-
-static int __glut_redisplay = GL_FALSE;
-
-/* Menu */
-static int __glut_menubutton = -1;
-static int __glut_menuactive = GL_FALSE;
-
-#define MAX_ENTRIES 64
-
-typedef struct menu_s
-{
- char *label[MAX_ENTRIES];
- int value[MAX_ENTRIES];
- struct menu_s * submenu[MAX_ENTRIES];
- void (*func)(int);
- int max_strlen;
- int num_entries;
-} menu_t;
-
-static menu_t *mainmenu;
-static menu_t *curmenu;
-static menu_t *activemenu;
-
-void glutInit(int *argc, char **argv)
-{
- ggi_graphtype gt;
- int i, k;
- char *str;
-
- GGIGLUTDPRINT_CORE("glutInit() called\n");
-
- #define REMOVE {for (k=i;k<*argc-1;k++) argv[k]=argv[k+1]; \
- (*argc)--; i--; }
-
- if (__glut_init) return;
-
- str = getenv("GGIGLUT_DEBUG");
- if (str != NULL) {
- _ggiglutDebugState = atoi(str);
- fprintf(stderr, "Debugging=%d\n", _ggiglutDebugState);
- GGIGLUTDPRINT_CORE("Debugging=%d\n", _ggiglutDebugState);
- }
-
- str = getenv("GGIGLUT_DEBUGSYNC");
- if (str != NULL) {
- _ggiglutDebugSync = 1;
- }
-
- if (argc && argv)
- {
-
- for (i = 1; i < *argc; i++)
- {
- if (strcmp(argv[i], "-mouse") == 0)
- {
- mouse_showcursor = GL_TRUE;
- REMOVE;
- }
- else
- if (strcmp(argv[i], "-bpp") == 0 && (i + 1) < (*argc))
- {
- switch(atoi(argv[i + 1]))
- {
- case 4: gt = GT_4BIT; break;
- case 8: gt = GT_8BIT; break;
- case 15: gt = GT_15BIT; break;
- case 16: gt = GT_16BIT; break;
- case 24: gt = GT_24BIT; break;
- case 32: gt = GT_32BIT; break;
- default:
- ggiPanic("\"%s\" bits per pixel?\n", argv[i+1]);
- }
- __glut_gt_rgb = __glut_gt_index = gt;
- REMOVE;
- REMOVE;
- }
- else
- if (strcmp(argv[i], "-size") == 0 && (i + 2) < (*argc))
- {
- __glut_width = atoi(argv[i + 1]);
- __glut_height = atoi(argv[i + 2]);
- REMOVE;
- REMOVE;
- REMOVE;
- }
- }
- }
-
- if (ggiInit() < 0)
- {
- ggiPanic("ggiInit() failed!\n");
- }
- __glut_init = GL_TRUE;
-
-#undef REMOVE
-}
-
-void glutInitWindowPosition(int x, int y)
-{
- GGIGLUTDPRINT_CORE("glutInitWindowPosition() called\n");
-}
-
-void glutInitWindowSize(int x, int y)
-{
- GGIGLUTDPRINT_CORE("glutInitWindowsSize() called\n");
-}
-
-void glutFullScreen(void)
-{
- GGIGLUTDPRINT_CORE("glutFullScreen() called\n");
-}
-
-void glutInitDisplayMode(unsigned int mode)
-{
- GGIGLUTDPRINT_CORE("glutInitDisplayMode() called\n");
-
- __glut_mode = mode;
-}
-
-void glutInitDisplayString(const char *string)
-{
- GGIGLUTDPRINT_CORE("glutInitDisplayString(%s) called\n", string);
-}
-
-int glutCreateWindow(const char *title)
-{
- ggi_graphtype gt;
- ggi_mode mode =
- {
- 1,
- { GGI_AUTO, GGI_AUTO },
- { GGI_AUTO, GGI_AUTO },
- { 0, 0 },
- GT_AUTO,
- { GGI_AUTO, GGI_AUTO }
- };
- int frames;
- int rgb;
- int err;
-
- GGIGLUTDPRINT_CORE("glutCreateWindow() called\n");
-
- if (!__glut_init)
- glutInit(NULL, NULL);
-
- GGIGLUTDPRINT("GGIGLUT: %s\n", title);
-
- rgb = !(__glut_mode & GLUT_INDEX);
- frames = (__glut_mode & GLUT_DOUBLE) ? 2 : 1;
-
- gt = (rgb) ? __glut_gt_rgb : __glut_gt_index;
-
- __glut_vis = ggiOpen(NULL);
- if (__glut_vis == NULL)
- {
- ggiPanic("ggiOpen() failed!\n");
- /* return GL_FALSE; */
- }
-
- ggiSetFlags(__glut_vis, GGIFLAG_ASYNC);
-
- ggiCheckMode(__glut_vis, &mode);
-
- err = ggiSetMode(__glut_vis, &mode);
- if (err < 0)
- {
- ggiPanic("Can't set graphic mode!\n");
- /* return GL_FALSE; */
- }
-
- if (ggiMesaExtendVisual(__glut_vis, GL_FALSE, GL_FALSE,
- 16, 0, 0, 0, 0, 0, 1) < 0)
- {
- ggiPanic("GGIMesaSetVisual failed!\n");
- }
-
- __glut_ctx = ggiMesaCreateContext(__glut_vis);
-
- if (__glut_ctx == NULL)
- ggiPanic("Can't create mesa-context\n");
-
- ggiGetMode(__glut_vis, &mode);
-
-
- __glut_width = mode.visible.x;
- __glut_height = mode.visible.y;
-
- mousex = mode.visible.x / 2;
- mousey = mode.visible.y / 2;
-
- ggiMesaMakeCurrent(__glut_ctx, __glut_vis);
-
- if (__glut_reshape)
- __glut_reshape(__glut_width, __glut_height);
-
- return GL_TRUE;
-}
-
-void glutReshapeFunc(void (*func)(int, int))
-{
- GGIGLUTDPRINT_CORE("glutReshapeFunc() called\n");
-
- __glut_reshape = func;
- if (__glut_vis && __glut_reshape)
- __glut_reshape(__glut_width, __glut_height);
-}
-
-void glutKeyboardFunc(void (*keyboard)(unsigned char key, int x, int y))
-{
- GGIGLUTDPRINT_CORE("glutKeyBoardFunc() called\n");
-
- __glut_keyboard = keyboard;
-}
-
-int glutGetModifiers(void)
-{
- GGIGLUTDPRINT_CORE("glutGetModifiers() called\n");
-
- return __glut_mod_keys;
-}
-
-void glutEntryFunc(void (*func)(int state))
-{
- GGIGLUTDPRINT_CORE("glutEntryFunc() called\n");
-}
-
-void glutVisibilitFunc(void (*func)(int state))
-{
- GGIGLUTDPRINT_CORE("glutVisibilityFunc() called\n");
-}
-
-void glutTimerFunc(unsigned int millis, void (*func)(int value), int value)
-{
- GGIGLUTDPRINT_CORE("glutTimerFunc() called\n");
-}
-
-void glutMenuStateFunc(void (*func)(int state))
-{
- GGIGLUTDPRINT_CORE("glutMenuStateFunc() called\n");
-}
-
-int glutGet(GLenum type)
-{
- GGIGLUTDPRINT_CORE("glutGet() called\n");
-
- switch(type)
- {
- case GLUT_WINDOW_X:
- return 0;
- case GLUT_WINDOW_Y:
- return 0;
- case GLUT_WINDOW_WIDTH:
- return __glut_width;
- case GLUT_WINDOW_HEIGHT:
- return __glut_height;
- case GLUT_MENU_NUM_ITEMS:
- if (curmenu)
- return curmenu->num_entries;
- else
- return 0;
- default:
- GGIGLUTDPRINT("glutGet: unknown type %i\n", type);
- }
- return 0;
-}
-
-void glutSpecialFunc(void (*special)(int key, int x, int y))
-{
- GGIGLUTDPRINT_CORE("glutSpecialFunc() called\n");
-
- __glut_special=special;
-}
-
-void glutDisplayFunc(void (*disp)(void))
-{
- GGIGLUTDPRINT_CORE("glutDisplayFunc() called\n");
- __glut_display=disp;
-}
-
-void glutSetColor(int index, GLfloat red, GLfloat green, GLfloat blue)
-{
- ggi_color c;
- GLfloat max;
-
- GGIGLUTDPRINT_CORE("glutSetColor() called\n");
-
- if (red > 1.0) red = 1.0;
- if (red < 0.0) red = 0.0;
- if (green > 1.0) green = 1.0;
- if (green < 0.0) green = 0.0;
- if (blue > 1.0) blue = 1.0;
- if (blue < 0.0) blue = 0.0;
-
- max = (float)((1 << GGI_COLOR_PRECISION) - 1);
-
- c.r = (int)(max * red);
- c.g = (int)(max * green);
- c.b = (int)(max * blue);
- ggiSetPalette(__glut_vis, index, 1, &c);
-}
-
-void glutPostRedisplay(void)
-{
- GGIGLUTDPRINT_CORE("glutPostRedisplay() called\n");
-
- __glut_redisplay = GL_TRUE;
-}
-
-void glutPostWindowRedisplay(int win)
-{
- GGIGLUTDPRINT_CORE("glutPostWindowRedisplay() called\n");
-
- __glut_redisplay = GL_TRUE;
-}
-
-void glutSwapBuffers(void)
-{
- GGIGLUTDPRINT_CORE("glutSwapBuffers() called\n");
-
- ggiMesaSwapBuffers();
-}
-
-void glutIdleFunc(void (*idle)(void))
-{
- GGIGLUTDPRINT_CORE("glutIdleFunc() called\n");
-
- __glut_idle = idle;
-}
-
-static void keyboard(ggi_event *ev)
-{
- int sym;
- int modifer = 0, key = 0;
-
- GGIGLUTDPRINT_CORE("keyboard() called\n");
-
- sym = ev->key.sym;
-
- modifer = ev->key.modifiers;
- if (modifer == GII_KM_SHIFT)
- __glut_mod_keys |= GLUT_ACTIVE_SHIFT;
- if (modifer == GII_KM_CTRL)
- __glut_mod_keys |= GLUT_ACTIVE_CTRL;
- if (modifer == GII_KM_ALT)
- __glut_mod_keys |= GLUT_ACTIVE_ALT;
-
- /* if (__glut_special && key) __glut_special(GII_KTYP(key),0,0); */
-
- if (__glut_keyboard)
-// __glut_keyboard(GII_UNICODE(sym), 0, 0);
- __glut_keyboard(sym, 0, 0);
-}
-
-static void mouseabs(ggi_event *ev)
-{
- int oldx = mousex;
- int oldy = mousey;
-
- mousex = ev->pmove.x;
- mousey = ev->pmove.y;
-
- if (mousex < 0) mousex = 0;
- if (mousey < 0) mousey = 0;
- if (mousex >= __glut_width) mousex = __glut_width - 1;
- if (mousey >= __glut_height) mousey = __glut_height - 1;
-
- if (mousex != oldx || mousey != oldy) mouse_moved = GL_TRUE;
-}
-
-static void mouse(ggi_event *ev)
-{
- int oldx = mousex;
- int oldy = mousey;
-
- GGIGLUTDPRINT_CORE("mouse() called\n");
-
- mousex += ev->pmove.x >> 1;
- mousey += ev->pmove.y >> 1;
-
- if (mousex < 0) mousex = 0;
- if (mousey < 0) mousey = 0;
- if (mousex >= __glut_width) mousex = __glut_width - 1;
- if (mousey >= __glut_height) mousey = __glut_height - 1;
-
- if (mousex != oldx || mousey != oldy) mouse_moved = GL_TRUE;
-
-}
-
-static void showmenu(void);
-static int clickmenu(void);
-static void updatemouse(void);
-static void drawmouse(void);
-
-static void mousemove(void)
-{
- GGIGLUTDPRINT_CORE("mousemove() called\n");
-
- if (mouse_moved) {
- if (__glut_motion && mouse_down) {
- __glut_motion(mousex,mousey);
- }
-
- if (__glut_passive_motion && (!mouse_down)) {
- __glut_passive_motion(mousex,mousey);
- }
-
- if (__glut_menuactive) updatemouse();
- mouse_moved=GL_FALSE;
- }
-}
-
-static void button(ggi_event *ev)
-{
- int i;
- int btn[4] = {
- 0,
- GLUT_LEFT_BUTTON,
- GLUT_RIGHT_BUTTON,
- GLUT_MIDDLE_BUTTON
- };
-
- GGIGLUTDPRINT_CORE("button() called\n");
-
- mousemove();
-
- if (ev->pbutton.button <= 3) { /* GGI can have >3 buttons ! */
- char state = ev->any.type == evPtrButtonPress ? GLUT_DOWN : GLUT_UP;
- if (__glut_menuactive) {
- if (state == GLUT_UP && clickmenu()) {
- glutPostRedisplay();
- __glut_menuactive = GL_FALSE;
- }
- } else
- if (btn[ev->pbutton.button] == __glut_menubutton) {
- __glut_menuactive = GL_TRUE;
- activemenu = mainmenu;
- showmenu();
- } else
- if (__glut_mouse) {
- __glut_mouse(btn[ev->pbutton.button], state, mousex, mousey);
- }
- if (state == GLUT_DOWN) {
- mouse_down |= (1 << (ev->pbutton.button - 1));
- }
- else mouse_down &= ~( 1 << (ev->pbutton.button - 1));
- }
-}
-
-void glutMainLoop(void)
-{
- ggi_event ev;
- ggi_event_mask evmask = (emKeyPress | emKeyRepeat | emPtrMove | emPtrButton);
-
- GGIGLUTDPRINT_CORE("glutMainLoop() called\n");
-
- ggiSetEventMask(__glut_vis, evmask);
-
- glutPostRedisplay();
-
- if (__glut_visibility)
- __glut_visibility(GLUT_VISIBLE);
-
- while (1)
- {
- if (!__glut_menuactive)
- {
- if (__glut_idle)
- __glut_idle();
- if (__glut_redisplay && __glut_display)
- {
- __glut_redisplay = GL_FALSE;
- __glut_display();
- }
- }
-
- while (1)
- {
- struct timeval t = {0, 0};
-
- if (ggiEventPoll(__glut_vis, evmask, &t) == 0)
- break;
-
- ggiEventRead(__glut_vis, &ev, evmask);
-
- switch (ev.any.type)
- {
- case evKeyPress:
- case evKeyRepeat:
- keyboard(&ev);
- break;
- case evPtrAbsolute:
- mouseabs(&ev);
- break;
- case evPtrRelative:
- mouse(&ev);
- break;
- case evPtrButtonPress:
- case evPtrButtonRelease:
- button(&ev);
- break;
- }
- }
- mousemove();
- }
-}
-
-static void showmenu()
-{
- int y,i;
- ggi_color col = { 0xffff, 0xffff, 0xffff };
-
- GGIGLUTDPRINT_CORE("showmenu() called\n");
-
- ggiSetGCForeground(__glut_vis,ggiMapColor(__glut_vis,&col));
- ggiSetOrigin(__glut_vis,0,0);
-
- for (y = i = 0; i < activemenu->num_entries; i++, y += 8) {
- ggiPuts(__glut_vis, 0, y, activemenu->label[i]);
- }
- drawmouse();
-}
-
-static int clickmenu(void)
-{
- int i;
- int w, h;
-
- GGIGLUTDPRINT_CORE("clickmenu() called\n");
-
- i = mousey / 8;
-
- if (i >= activemenu->num_entries) return GL_TRUE;
- if (mousex >= 8 * strlen(activemenu->label[i])) return GL_TRUE;
-
- if (activemenu->submenu[i]) {
- ggi_color col={0,0,0};
- ggiSetGCForeground(__glut_vis,ggiMapColor(__glut_vis,&col));
- h=activemenu->num_entries*8;
- w=activemenu->max_strlen*8;
- ggiDrawBox(__glut_vis,0,0,w,h);
- activemenu=activemenu->submenu[i];
- showmenu();
- return GL_FALSE;
- }
- curmenu=activemenu;
- activemenu->func(activemenu->value[i]);
- return GL_TRUE;
-}
-
-static int oldx=-1;
-static int oldy=-1;
-static char buffer[16*16*4];
-
-static void updatemouse()
-{
- GGIGLUTDPRINT_CORE("updatemouse() called\n");
-
- ggiPutBox(__glut_vis,oldx,oldy,16,16,buffer);
- drawmouse();
-}
-
-static void drawmouse()
-{
- int x,y;
-
- GGIGLUTDPRINT_CORE("drawmouse() called\n");
-
- x=mousex-8;
- if (x<0) x=0;
- y=mousey-8;
- if (y<0) y=0;
- ggiGetBox(__glut_vis,x,y,16,16,buffer);
- ggiDrawLine(__glut_vis,mousex-2,mousey,mousex+2,mousey);
- ggiDrawLine(__glut_vis,mousex,mousey-2,mousex,mousey+2);
- oldx=x;
- oldy=y;
-}
-
-int glutCreateMenu(void(*func)(int))
-{
- menu_t *m;
-
- GGIGLUTDPRINT_CORE("glutCreateMenu() called\n");
-
- m=malloc(sizeof(menu_t));
- memset(m,0,sizeof(menu_t));
- curmenu=m;
- curmenu->func=func;
- return (int)curmenu;
-}
-
-static void addEntry(const char *label,int value,menu_t *submenu)
-{
- int i=curmenu->num_entries;
-
- GGIGLUTDPRINT_CORE("addEntry() called\n");
-
- /* printf("%i %i %s %p\n",i,value,label,submenu); */
- if (i<MAX_ENTRIES) {
- curmenu->label[i]=strdup(label);
- curmenu->value[i]=value;
- curmenu->submenu[i]=submenu;
-
- if (strlen(label)>curmenu->max_strlen)
- curmenu->max_strlen=strlen(label);
- curmenu->num_entries++;
- }
-}
-
-void glutAddMenuEntry(const char *label,int value)
-{
- GGIGLUTDPRINT_CORE("glutAddMenuEntry() called\n");
-
- addEntry(label,value,NULL);
-}
-
-void glutAddSubMenu(const char *label,int submenu)
-{
- char text[100];
-
- GGIGLUTDPRINT_CORE("glutAddSubMenu() called\n");
-
- if (!curmenu) return;
- strncpy(text,label,98);
- text[98]=0;
- text[strlen(text)+1]=0;
- text[strlen(text)]='>';
-
- addEntry(text,0,(menu_t *) submenu);
-}
-
-void glutAttachMenu(int button)
-{
- GGIGLUTDPRINT_CORE("glutAttachMenu() called\n");
-
- mainmenu=curmenu;
- __glut_menubutton=button;
-}
-
-void glutDetachMenu(int button)
-{
- GGIGLUTDPRINT_CORE("glutDetachMenu() called\n");
-}
-
-void glutVisibilityFunc(void (*func)(int state))
-{
- GGIGLUTDPRINT_CORE("glutVisibilityFunc() called\n");
-
- __glut_visibility=func;
-}
-
-void glutMouseFunc(void (*mouse)(int, int, int, int))
-{
- GGIGLUTDPRINT_CORE("glutMouseFunc() called\n");
-
- __glut_mouse=mouse;
-}
-
-void glutMotionFunc(void (*motion)(int,int))
-{
- GGIGLUTDPRINT_CORE("glutMotionFunc() called\n");
-
- __glut_motion=motion;
-}
-
-void glutPassiveMotionFunc(void (*motion)(int,int))
-{
- GGIGLUTDPRINT_CORE("glutPassiveMotionFunc() called\n");
-
- __glut_passive_motion=motion;
-}
-
-void glutSetWindowTitle(const char *title)
-{
- GGIGLUTDPRINT_CORE("glutSetWindowTitle() called\n");
-}
-
-void glutSetIconTitle(const char *title)
-{
- GGIGLUTDPRINT_CORE("glutSetIconTitle() called\n");
-}
-
-void glutChangeToMenuEntry(int item,const char *label,int value)
-{
- GGIGLUTDPRINT_CORE("glutChangeToMenuEntry() called\n");
-
- if (item>0 && item<=curmenu->num_entries) {
- item--;
- free(curmenu->label[item]);
- curmenu->label[item]=strdup(label);
- curmenu->value[item]=value;
- curmenu->submenu[item]=NULL;
- }
-}
-void glutChangeToSubMenu(int item,const char *label,int submenu)
-{
- GGIGLUTDPRINT_CORE("glutChengeToSubMenu() called\n");
-
- if (item>0 && item<=curmenu->num_entries) {
- item--;
- free(curmenu->label[item]);
- curmenu->label[item]=strdup(label);
- curmenu->value[item]=0;
- curmenu->submenu[item]=(menu_t *)submenu;
- }
-}
-
-void glutDestroyMenu(int menu)
-{
- menu_t *m=(menu_t *)menu;
- int i;
-
- GGIGLUTDPRINT_CORE("glutDestroyMenu() called\n");
-
- for (i=0;i<m->num_entries;i++) {
- free(m->label[i]);
- }
- free(m);
-}
-
-int glutCreateSubWindow(int win,int x,int y,int w,int h)
-{
- GGIGLUTDPRINT_CORE("glutCreateSubWindow() called\n");
-
- return 0;
-}
-
-void glutDestroyWindow(int win)
-{
- GGIGLUTDPRINT_CORE("glutDestroyWindow() called\n");
-}
-
-int glutGetWindow(void)
-{
- GGIGLUTDPRINT_CORE("glutGetWindow() called\n");
-
- return 0;
-}
-
-void glutSetWindow(int win)
-{
- GGIGLUTDPRINT_CORE("glutSetWindow() called\n");
-}
-
-void glutPositionWindow(int x,int y)
-{
- GGIGLUTDPRINT_CORE("glutPositionWindow() called\n");
-}
-
-void glutReshapeWindow(int x,int y)
-{
- GGIGLUTDPRINT_CORE("glutReshapeWindow() called\n");
-}
-
-void glutPushWindow(void)
-{
- GGIGLUTDPRINT_CORE("glutPushWindow() called\n");
-}
-
-void glutPopWindow(void)
-{
- GGIGLUTDPRINT_CORE("glutPopWindow() called\n");
-}
-
-void glutIconifyWindow(void)
-{
- GGIGLUTDPRINT_CORE("glutIconifyWindow() called\n");
-}
-
-void glutShowWindow()
-{
- GGIGLUTDPRINT_CORE("glutShowWindow() called\n");
-}
-
-void glutHideWindow()
-{
- GGIGLUTDPRINT_CORE("glutHideWindow() called\n");
-}
-
-void glutSetCursor(int cursor)
-{
- GGIGLUTDPRINT_CORE("glutSetCursor() called\n");
-}
-
-void glutWarpPointer(int x,int y)
-{
- GGIGLUTDPRINT_CORE("glutWarpPointer() called\n");
-}
-
-void glutEstablishOverlay(void)
-{
- GGIGLUTDPRINT_CORE("glutEstablishOverlay() called\n");
-}
-
-void glutRemoveOverlay(void)
-{
- GGIGLUTDPRINT_CORE("glutRemoveOverlay() called\n");
-}
-
-void glutUseLayer(GLenum layer)
-{
- GGIGLUTDPRINT_CORE("glutUseLayer() called\n");
-}
-
-int glutLayerGet(GLenum type)
-{
- GGIGLUTDPRINT_CORE("glutLayerGet() called\n");
- return 0;
-}
-
-void glutPostOverlayRedisplay(void)
-{
- GGIGLUTDPRINT_CORE("glutPostOverlayRedisplay() called\n");
-}
-
-void glutPostWindowOverlayRedisplay(int w)
-{
- GGIGLUTDPRINT_CORE("glutPostWindowOverlayRedisplay() called\n");
-}
-
-void glutShowOverlay(void)
-{
- GGIGLUTDPRINT_CORE("glutShowOverlay() called\n");
-}
-
-void glutHideOverlay(void)
-{
- GGIGLUTDPRINT_CORE("glutHideOverlay() called\n");
-}
-
-int glutGetMenu(void)
-{
- GGIGLUTDPRINT_CORE("glutGetMenu() called\n");
- return 0;
-}
-
-void glutSetMenu(int menu)
-{
- GGIGLUTDPRINT_CORE("glutSetMenu() called\n");
-}
-
-void glutRemoveMenuItem(int item)
-{
- GGIGLUTDPRINT_CORE("glutRemoveMenuItem() called\n");
-}
-
-void glutSpaceBallMotionFunc(void (*func)(int key,int x,int y))
-{
- GGIGLUTDPRINT_CORE("glutSpaceBallMotionFunc() called\n");
-}
-
-void glutSpaceBallRotateFunc(void (*func)(int x,int y,int z))
-{
- GGIGLUTDPRINT_CORE("glutSpaceBallRotateFunc() called\n");
-}
-
-void glutSpaceBallButtonFunc(void (*func)(int button,int state))
-{
- GGIGLUTDPRINT_CORE("glutSpaceBallButtonFunc() called\n");
-}
-
-void glutCopyColormap(int win)
-{
- GGIGLUTDPRINT_CORE("glutCopyColormap() called\n");
-}
-
-int glutDeviceGet(GLenum param)
-{
- GGIGLUTDPRINT_CORE("glutDeviceGet() called\n");
-
- return 0;
-}
+++ /dev/null
-genkgi.conf
+++ /dev/null
-# GGIMesa genkgi helper configuration
-.root: @ggi_libdir@/ggi/mesa/default
-
-tgt-fbdev-kgicon-d3dim-mesa d3dim.so
+++ /dev/null
-/*
-******************************************************************************
-
- GGIMesa - KGIcon specific overrides for fbcon-mesa
- API header
-
- Copyright (C) 1999 Jon Taylor [taylorj@ggi-project.org]
-
- 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
- THE AUTHOR(S) 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 _GENKGI_MESA_H
-#define _GENKGI_MESA_H
-
-#undef KGI_USE_PPBUFS
-
-#include <unistd.h>
-#include <sys/mman.h>
-
-#include <ggi/internal/ggi-dl.h>
-#include <ggi/mesa/display_fbdev.h>
-#include <kgi/kgi.h>
-
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void *)-1)
-#endif
-
-/* FIXME: LibGGI needs to export its genkgi.h */
-struct genkgi_priv
-{
- ggi_gc *mapped_gc;
- unsigned int gc_size;
- ggifunc_drawline *drawline;
- ggifunc_drawbox *drawbox;
- ggifunc_fillscreen *fillscreen;
- int fd_gc;
- int close_gc;
- int fd_kgicommand;
- uint8 *mapped_kgicommand;
- uint8 *kgicommand_ptr;
- unsigned int kgicommand_buffersize;
-};
-
-#define GENKGI_PRIV(vis) ((struct genkgi_priv *)FBDEV_PRIV(vis)->accelpriv)
-
-extern ggifunc_getapi GGIMesa_genkgi_getapi;
-extern ggifunc_flush GGIMesa_genkgi_flush;
-
-struct genkgi_priv_mesa
-{
- char accel[100];
- int have_accel;
- void *accelpriv; /* Private data of subdrivers */
- struct genkgi_priv *oldpriv; /* LibGGI's private data */
-};
-
-#define GENKGI_PRIV_MESA(vis) ((struct genkgi_priv_mesa *)FBDEV_PRIV_MESA(vis)->accelpriv)
-
-#endif /* _GENKHI_MESA_H */
+++ /dev/null
-/*
-******************************************************************************
-
- display-fbdev-kgicon-generic-mesa
-
- Copyright (C) 1999 Jon Taylor [taylorj@ggi-project.org]
-
- 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
- THE AUTHOR(S) 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 <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-
-#include <ggi/internal/ggi-dl.h>
-#include <ggi/mesa/ggimesa_int.h>
-#include <ggi/mesa/debug.h>
-#include "genkgi.h"
-
-int GGIMesa_genkgi_getapi(ggi_visual *vis, int num, char *apiname, char *arguments)
-{
- struct genkgi_priv_mesa *priv = GENKGI_PRIV_MESA(vis);
-
- GGIMESADPRINT_CORE("Entered mesa_genkgi_getapi, num=%d\n", num);
-
- strcpy(arguments, "");
-
- switch(num)
- {
- case 0:
- if (priv->have_accel)
- {
- strcpy(apiname, priv->accel);
- return 0;
- }
- break;
- }
- return -1;
-}
-
-int GGIMesa_genkgi_flush(ggi_visual *vis, int x, int y, int w, int h, int tryflag)
-{
- struct genkgi_priv_mesa *priv = GENKGI_PRIV_MESA(vis);
- int junkval;
-
- priv->oldpriv->kgicommand_ptr += getpagesize();
- (kgiu32)(priv->oldpriv->kgicommand_ptr) &= 0xfffff000;
- junkval = *((int *)(priv->oldpriv->kgicommand_ptr));
-
- /* Check if we are now in the last page, and reset the
- * FIFO if so. We can't use the last page to send
- * more commands, since there's no page after it that
- * we can touch to fault in the last page's commands.
- *
- * FIXME: This will be replaced with a flush-and-reset handler
- * on the end-of-buffer pagefault at some point....
- *
- */
- if ((priv->oldpriv->kgicommand_ptr - priv->oldpriv->mapped_kgicommand)
- >= (priv->oldpriv->kgicommand_buffersize - getpagesize()))
- {
- munmap(priv->oldpriv->mapped_kgicommand, priv->oldpriv->kgicommand_buffersize);
- if ((priv->oldpriv->mapped_kgicommand =
- mmap(NULL,
- priv->oldpriv->kgicommand_buffersize,
- PROT_READ | PROT_WRITE,
- MAP_SHARED,
- priv->oldpriv->fd_kgicommand,
- 0)) == MAP_FAILED)
- {
- ggiPanic("Failed to remap kgicommand!");
- }
- priv->oldpriv->kgicommand_ptr = priv->oldpriv->mapped_kgicommand;
- }
- return 0;
-}
+++ /dev/null
-/*
-******************************************************************************
-
- genkgi_visual.c: visual handling for the generic KGI helper
-
- Copyright (C) 1999 Jon Taylor [taylorj@ggi-project.org]
-
- 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
- THE AUTHOR(S) 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 <ggi/internal/ggi-dl.h>
-#include <ggi/mesa/ggimesa_int.h>
-#include <ggi/mesa/display_fbdev.h>
-#include <ggi/mesa/debug.h>
-#include "genkgi.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-#ifdef HAVE_SYS_VT_H
-#include <sys/vt.h>
-#else
-#include <linux/vt.h>
-#endif
-#ifdef HAVE_LINUX_KDEV_T_H
-#include <linux/kdev_t.h>
-#endif
-#include <linux/tty.h>
-
-#define DEFAULT_FBNUM 0
-
-static char accel_prefix[] = "tgt-fbdev-kgicon-";
-#define PREFIX_LEN (sizeof(accel_prefix))
-
-typedef struct {
- int async;
- char *str;
-} accel_info;
-
-static accel_info accel_strings[] =
-{
- { 0, "d3dim" }, /* Direct3D Immediate Mode */
-};
-
-#define NUM_ACCELS (sizeof(accel_strings)/sizeof(accel_info))
-
-/* FIXME: These should be defined in the makefile system */
-#define CONF_FILE "/usr/local/etc/ggi/mesa/targets/genkgi.conf"
-void *_configHandle;
-char confstub[512] = CONF_FILE;
-char *conffile = confstub;
-
-static int changed(ggi_visual_t vis, int whatchanged)
-{
- GGIMESADPRINT_CORE("Entered ggimesa_genkgi_changed\n");
-
- switch (whatchanged)
- {
- case GGI_CHG_APILIST:
- {
- char api[256];
- char args[256];
- int i;
- const char *fname;
- ggi_dlhandle *lib;
-
- for (i = 0; ggiGetAPI(vis, i, api, args) == 0; i++)
- {
- strcat(api, "-mesa");
- GGIMESADPRINT_CORE("ggimesa_genkgi_changed: api=%s, i=%d\n", api, i);
- fname = ggMatchConfig(_configHandle, api, NULL);
- if (fname == NULL)
- {
- /* No special implementation for this sublib */
- continue;
- }
-
- lib = ggiExtensionLoadDL(vis, fname, args, NULL);
- }
- }
- break;
- }
- return 0;
-}
-
-static int GGIdlinit(ggi_visual *vis, struct ggi_dlhandle *dlh,
- const char *args, void *argptr, uint32 *dlret)
-{
- struct genkgi_priv_mesa *priv;
- char libname[256], libargs[256];
- int id, err;
- struct stat junk;
- ggifunc_getapi *oldgetapi;
-
- GGIMESADPRINT_CORE("display-fbdev-kgicon-mesa: GGIdlinit start\n");
-
- GENKGI_PRIV_MESA(vis) = priv = malloc(sizeof(struct genkgi_priv_mesa));
- if (priv == NULL)
- {
- fprintf(stderr, "Failed to allocate genkgi private data\n");
- return GGI_DL_ERROR;
- }
-
- priv->oldpriv = GENKGI_PRIV(vis);
-#if 0
- err = ggLoadConfig(conffile, &_configHandle);
- if (err != GGI_OK)
- {
- gl_ggiPrint("display-fbdev-kgicon-mesa: Couldn't open %s\n", conffile);
- return err;
- }
-
- /* Hack city here. We need to probe the KGI driver properly for
- * suggest-strings to discover the acceleration type(s).
- */
- priv->have_accel = 0;
-
- if (stat("/proc/gfx0", &junk) == 0)
- {
- sprintf(priv->accel, "%s%s", accel_prefix, "d3dim");
- priv->have_accel = 1;
- GGIMESADPRINT_CORE("display-fbdev-kgicon-mesa: Using accel: \"%s\"\n", priv->accel);
- }
-
- /* Mode management */
- vis->opdisplay->getapi = GGIMesa_genkgi_getapi;
- ggiIndicateChange(vis, GGI_CHG_APILIST);
-
- /* Give the accel sublibs a chance to set up a driver */
- if (priv->have_accel == 1)
- {
- oldgetapi = vis->opdisplay->getapi;
- vis->opdisplay->getapi = GGIMesa_genkgi_getapi;
- changed(vis, GGI_CHG_APILIST);
- /* If the accel sublibs didn't produce, back up
- * and keep looking */
- if ((LIBGGI_MESAEXT(vis)->update_state == NULL) ||
- (LIBGGI_MESAEXT(vis)->setup_driver == NULL))
- vis->opdisplay->getapi = oldgetapi;
- }
-
- LIBGGI_MESAEXT(vis)->update_state = genkgi_update_state;
- LIBGGI_MESAEXT(vis)->setup_driver = genkgi_setup_driver;
-#endif
- GGIMESADPRINT_CORE("display-fbdev-kgicon-mesa: GGIdlinit finished\n");
-
- *dlret = GGI_DL_OPDRAW;
- return 0;
-}
-
-int MesaGGIdl_fbdev(int func, void **funcptr)
-{
- switch (func) {
- case GGIFUNC_open:
- *funcptr = GGIopen;
- return 0;
- case GGIFUNC_exit:
- case GGIFUNC_close:
- *funcptr = NULL;
- return 0;
- default:
- *funcptr = NULL;
- }
- return GGI_ENOTFOUND;
-}
-
-#include <ggi/internal/ggidlinit.h>
+++ /dev/null
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * 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.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <ggi/mesa/ggimesa.h>
-#include <ggi/mesa/ggimesa_int.h>
-#include <ggi/mesa/debug.h>
-#include "swrast/swrast.h"
-
-#define RMASK ((1<<R)-1)
-#define GMASK ((1<<G)-1)
-#define BMASK ((1<<B)-1)
-
-#define RS (8-R)
-#define GS (8-G)
-#define BS (8-B)
-
-#define PACK(color) (((color[RCOMP]>>RS) << (G+B)) | \
- ((color[GCOMP]>>GS) << B) | \
- ((color[BCOMP]>>BS)))
-
-#define FLIP(coord) (LIBGGI_VIRTY(ggi_ctx->ggi_visual) - (coord) - 1)
-
-
-/**********************************************************************/
-/***** Write spans of pixels *****/
-/**********************************************************************/
-
-void GGIwrite_ci32_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLuint ci[], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- if (mask) {
- while (n--) {
- if (*mask++)
- *fb = *ci;
- fb++;
- ci++;
- }
- } else {
- while (n--) *fb++ = *ci++;
- }
-}
-
-void GGIwrite_ci8_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLubyte ci[], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- if (mask) {
- while (n--) {
- if (*mask++)
- *fb = *ci;
- fb++;
- ci++;
- }
- } else {
- while (n--) *fb++ = *ci++;
- }
-}
-
-
-void GGIwrite_rgba_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLchan rgba[][4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- if (mask) {
- while (n--) {
- if (*mask++)
- *fb = PACK(rgba[0]);
- fb++;
- rgba++;
- }
- } else {
- while (n--) {
- *fb++ = PACK(rgba[0]);
- rgba++;
- }
- }
-}
-
-void GGIwrite_rgb_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLchan rgba[][3], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- if (mask) {
- while (n--) {
- if (*mask++)
- *fb = PACK(rgba[0]);
- fb++;
- rgba++;
- }
- } else {
- while (n--) {
- *fb++ = PACK(rgba[0]);
- rgba++;
- }
- }
-}
-
-
-void GGIwrite_mono_rgba_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLchan color[4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- if (mask) {
- while (n--){
- if (*mask++)
- *fb = PACK(color);
- ++fb;
- }
- } else {
- while (n--)
- *fb++ = PACK(color);
-
- /* Alternatively we could write a potentialy faster HLine
- ggiSetGCForeground(ggi_ctx->ggi_visual, color);
- ggiDrawHLine(ggi_ctx->ggi_visual,x,FLIP(y),n);
- */
- }
-}
-
-void GGIwrite_mono_ci_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLuint ci, const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- if (mask){
- while (n--){
- if (*mask++)
- *fb = ci;
- ++fb;
- }
- } else {
- while (n--)
- *fb++ = ci;
-
- /* Alternatively we could write a potentialy faster HLine
- ggiSetGCForeground(ggi_ctx->ggi_visual, ci);
- ggiDrawHLine(ggi_ctx->ggi_visual, x, FLIP(y), n);
- */
- }
-}
-
-
-/**********************************************************************/
-/***** Read spans of pixels *****/
-/**********************************************************************/
-
-
-void GGIread_ci32_span(const GLcontext *ctx,
- GLuint n, GLint x, GLint y, GLuint ci[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- while (n--)
- *ci++ = (GLuint)*fb++;
-}
-
-void GGIread_rgba_span(const GLcontext *ctx,
- GLuint n, GLint x, GLint y, GLchan rgba[][4])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- FB_TYPE color;
- FB_TYPE *fb;
- fb = (FB_TYPE *)((char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual) +
- FLIP(y)*LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual)) + x;
-
- while (n--) {
- color = *fb++;
- rgba[0][RCOMP] = (GLubyte) (color>>(G+B))<<RS;
- rgba[0][GCOMP] = (GLubyte) ((color>>B)& ((1<<G)-1))<<GS;
- rgba[0][BCOMP] = (GLubyte) (color & ((1<<B)-1))<<BS;
- rgba[0][ACOMP] = 0;
- rgba++;
- }
-}
-
-/**********************************************************************/
-/***** Write arrays of pixels *****/
-/**********************************************************************/
-
-void GGIwrite_ci32_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLuint ci[], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual);
- char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual);
-
- while (n--) {
- if (*mask++){
- FB_TYPE *dst = (FB_TYPE*)(fb + FLIP(*y)*stride) + *x;
- *dst = *ci;
- }
- ci++;
- x++;
- y++;
- }
-}
-
-void GGIwrite_mono_ci_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint ci, const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual);
- char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual);
-
- while (n--) {
- if (*mask++){
- FB_TYPE *dst = (FB_TYPE*)(fb + FLIP(*y)*stride) + *x;
- *dst = ci;
- }
- x++;
- y++;
- }
-}
-
-void GGIwrite_rgba_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLchan rgba[][4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual);
- char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual);
-
- while (n--) {
- if (*mask++){
- FB_TYPE *dst = (FB_TYPE*)(fb + FLIP(*y)*stride) + *x;
- *dst = PACK(rgba[0]);
- }
- x++;
- y++;
- rgba++;
- }
-}
-
-void GGIwrite_mono_rgba_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLchan rgba[4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual);
- char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual);
-
- while (n--) {
- if (*mask++){
- FB_TYPE *dst = (FB_TYPE*)(fb + FLIP(*y)*stride) + *x;
- *dst = PACK(rgba);
- }
-
- x++;
- y++;
- }
-}
-
-/**********************************************************************/
-/***** Read arrays of pixels *****/
-/**********************************************************************/
-
-void GGIread_ci32_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint ci[], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual);
- char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual);
-
- while (n--) {
- if (*mask++){
- FB_TYPE *src = (FB_TYPE*)(fb + FLIP(*y)*stride) + *x;
- *ci = *src;
- }
- ci++;
- x++;
- y++;
- }
-}
-
-void GGIread_rgba_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- int stride = LIBGGI_FB_W_STRIDE(ggi_ctx->ggi_visual);
- char *fb = (char *)LIBGGI_CURWRITE(ggi_ctx->ggi_visual);
- FB_TYPE color;
-
- while (n--) {
- if (*mask++) {
- FB_TYPE *src = (FB_TYPE*)(fb + FLIP(*y)*stride) + *x;
- color = *src;
-
- rgba[0][RCOMP] = (GLubyte)(color>>(G+B))<<RS;
- rgba[0][GCOMP] = (GLubyte)((color>>B)& ((1<<G)-1))<<GS;
- rgba[0][BCOMP] = (GLubyte) (color & ((1<<B)-1))<<BS;
- rgba[0][ACOMP] = 0;
- }
- x++;
- y++;
- rgba++;
- }
-}
-
-void GGIset_buffer(GLcontext *ctx, GLframebuffer *buffer, GLenum mode)
-{
-}
-
-int GGIsetup_driver(ggi_mesa_context_t ggi_ctx)
-{
- struct swrast_device_driver *swdd =
- _swrast_GetDeviceDriverReference(ggi_ctx->gl_ctx);
-
- GGIMESADPRINT_LIBS("linear_%d: GGIsetup_driver\n", sizeof(FB_TYPE)*8);
-
- swdd->WriteRGBASpan = GGIwrite_rgba_span;
- swdd->WriteRGBSpan = GGIwrite_rgb_span;
- swdd->WriteMonoRGBASpan = GGIwrite_mono_rgba_span;
- swdd->WriteRGBAPixels = GGIwrite_rgba_pixels;
- swdd->WriteMonoRGBAPixels = GGIwrite_mono_rgba_pixels;
-
- swdd->WriteCI32Span = GGIwrite_ci32_span;
- swdd->WriteCI8Span = GGIwrite_ci8_span;
- swdd->WriteMonoCISpan = GGIwrite_mono_ci_span;
- swdd->WriteCI32Pixels = GGIwrite_ci32_pixels;
- swdd->WriteMonoCIPixels = GGIwrite_mono_ci_pixels;
-
- swdd->ReadCI32Span = GGIread_ci32_span;
- swdd->ReadRGBASpan = GGIread_rgba_span;
- swdd->ReadCI32Pixels = GGIread_ci32_pixels;
- swdd->ReadRGBAPixels = GGIread_rgba_pixels;
-
- swdd->SetBuffer = GGIset_buffer;
-
- return 0;
-}
-
-static int GGIopen(ggi_visual_t vis,struct ggi_dlhandle *dlh,
- const char *args,void *argptr, uint32 *dlret)
-{
- GGIMESADPRINT_CORE("linear_%d: GGIOpen\n", sizeof(FB_TYPE)*8);
- LIBGGI_MESAEXT(vis)->setup_driver = GGIsetup_driver;
-
- *dlret = GGI_DL_OPDRAW;
- return 0;
-}
-
-int DLOPENFUNC(int func, void **funcptr)
-{
- switch (func) {
- case GGIFUNC_open:
- *funcptr = GGIopen;
- return 0;
- case GGIFUNC_exit:
- case GGIFUNC_close:
- *funcptr = NULL;
- return 0;
- default:
- *funcptr = NULL;
- }
- return GGI_ENOTFOUND;
-}
-
+++ /dev/null
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * 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.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <ggi/mesa/ggimesa.h>
-
-#define R 5
-#define G 5
-#define B 5
-
-#define FB_TYPE uint16
-#define FB_BITS 15
-#define DLOPENFUNC MesaGGIdl_linear_15
-
-#include "linear.c"
-
+++ /dev/null
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * 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.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <ggi/mesa/ggimesa.h>
-
-#define R 5
-#define G 6
-#define B 5
-
-#define FB_TYPE uint16
-#define FB_BITS 16
-#define DLOPENFUNC MesaGGIdl_linear_16
-
-#include "linear.c"
-
+++ /dev/null
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * 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.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <ggi/mesa/ggimesa.h>
-
-#define R 8
-#define G 8
-#define B 8
-
-#define FB_TYPE uint32
-#define FB_BITS 24
-#define DLOPENFUNC MesaGGIdl_linear_24
-
-#include "linear.c"
-
+++ /dev/null
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * 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.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <ggi/mesa/ggimesa.h>
-
-#define R 8
-#define G 8
-#define B 8
-
-#define FB_TYPE uint32
-#define FB_BITS 32
-#define DLOPENFUNC MesaGGIdl_linear_32
-
-#include "linear.c"
-
+++ /dev/null
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * 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.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <ggi/mesa/ggimesa.h>
-
-#define R 3
-#define G 3
-#define B 2
-
-#define FB_TYPE uint8
-#define FB_BITS 8
-#define DLOPENFUNC MesaGGIdl_linear_8
-
-#include "linear.c"
-
+++ /dev/null
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * 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.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#include <stdio.h>
-
-#include <ggi/internal/ggi-dl.h>
-#include <ggi/mesa/ggimesa_int.h>
-#include <ggi/mesa/debug.h>
-
-#include "swrast/swrast.h"
-//#include "swrast_setup/swrast_setup.h"
-//#include "swrast/s_context.h"
-//#include "swrast/s_depth.h"
-//#include "swrast/s_triangle.h"
-
-#define FLIP(coord) (LIBGGI_MODE(ggi_ctx->ggi_visual)->visible.y-(coord)-1)
-
-/**********************************************************************/
-/***** Write spans of pixels *****/
-/**********************************************************************/
-
-void GGIwrite_ci32_span(const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLuint ci[],
- const GLubyte mask[] )
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- y = FLIP(y);
- if (mask)
- {
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, x, y, *ci);
- x++;
- ci++;
- }
- }
- else
- {
- while (n--)
- ggiPutPixel(ggi_ctx->ggi_visual, x++, y, *ci++);
- }
-}
-
-void GGIwrite_ci8_span(const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte ci[],
- const GLubyte mask[] )
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- y = FLIP(y);
- if (mask)
- {
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, x, y, *ci);
- x++;
- ci++;
- }
- }
- else
- {
- while (n--)
- ggiPutPixel(ggi_ctx->ggi_visual, x++, y, *ci++);
- }
-}
-
-void GGIwrite_mono_ci_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLuint ci, const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- y = FLIP(y);
- if (mask)
- {
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, x, y, ci);
- x++;
- }
- }
- else
- {
- while (n--)
- ggiPutPixel(ggi_ctx->ggi_visual, x++, y, ci);
- }
-}
-
-void GGIwrite_mono_rgba_span(const GLcontext *ctx, GLuint n, GLint x, GLint y,
- const GLchan rgba[4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_color rgb;
- ggi_pixel col;
-
- y = FLIP(y);
-
- rgb.r = (uint16)(rgba[RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
-
- if (mask)
- {
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, x, y, col);
- x++;
- }
- }
- else
- {
- ggiDrawHLine(ggi_ctx->ggi_visual, x, y, n);
- }
-}
-
-void GGIwrite_rgba_span( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte rgba[][4],
- const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_color rgb;
- ggi_pixel col;
- y = FLIP(y);
-
- if (mask)
- {
- while (n--) {
- if (*mask++)
- {
- rgb.r = (uint16)(rgba[0][RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[0][GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[0][BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
- ggiPutPixel(ggi_ctx->ggi_visual, x, y, col);
- }
- x++;
- rgba++;
- }
- }
- else
- {
- while (n--)
- {
- rgb.r = (uint16)(rgba[0][RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[0][GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[0][BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
- ggiPutPixel(ggi_ctx->ggi_visual, x++, y, col);
- rgba++;
- }
- }
-}
-
-void GGIwrite_rgb_span( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- const GLubyte rgba[][3],
- const GLubyte mask[] )
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_color rgb;
- ggi_pixel col;
- y = FLIP(y);
-
- if (mask)
- {
- while (n--) {
- if (*mask++)
- {
- rgb.r = (uint16)(rgba[0][RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[0][GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[0][BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
- ggiPutPixel(ggi_ctx->ggi_visual, x, y, col);
- }
- x++;
- rgba++;
- }
- }
- else
- {
- while (n--)
- {
- rgb.r = (uint16)(rgba[0][RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[0][GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[0][BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
- ggiPutPixel(ggi_ctx->ggi_visual, x++, y, col);
- rgba++;
- }
- }
-}
-
-
-
-/**********************************************************************/
-/***** Read spans of pixels *****/
-/**********************************************************************/
-
-
-void GGIread_ci32_span( const GLcontext *ctx,
- GLuint n, GLint x, GLint y, GLuint ci[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- y = FLIP(y);
- while (n--)
- ggiGetPixel(ggi_ctx->ggi_visual, x++, y, ci++);
-}
-
-void GGIread_rgba_span( const GLcontext *ctx,
- GLuint n, GLint x, GLint y,
- GLubyte rgba[][4])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_color rgb;
- ggi_pixel col;
-
- y = FLIP(y);
-
- while (n--)
- {
- ggiGetPixel(ggi_ctx->ggi_visual, x++, y, &col);
- ggiUnmapPixel(ggi_ctx->ggi_visual, col, &rgb);
- rgba[0][RCOMP] = (GLubyte) (rgb.r >> SHIFT);
- rgba[0][GCOMP] = (GLubyte) (rgb.g >> SHIFT);
- rgba[0][BCOMP] = (GLubyte) (rgb.b >> SHIFT);
- rgba[0][ACOMP] = 0;
- rgba++;
- }
-}
-
-/**********************************************************************/
-/***** Write arrays of pixels *****/
-/**********************************************************************/
-
-void GGIwrite_ci32_pixels( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLuint ci[], const GLubyte mask[] )
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, *x, FLIP(*y), *ci);
- ci++;
- x++;
- y++;
- }
-}
-
-void GGIwrite_mono_ci_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint ci, const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, *x, FLIP(*y), ci);
- x++;
- y++;
- }
-}
-
-void GGIwrite_rgba_pixels( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLubyte rgba[][4],
- const GLubyte mask[] )
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_pixel col;
- ggi_color rgb;
- while (n--) {
- if (*mask++) {
- rgb.r = (uint16)(rgba[0][RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[0][GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[0][BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
- ggiPutPixel(ggi_ctx->ggi_visual, *x, FLIP(*y), col);
- }
- x++;
- y++;
- rgba++;
- }
-}
-
-void GGIwrite_mono_rgba_pixels(const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- const GLchan rgba[4], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_color rgb;
- ggi_pixel col;
-
- rgb.r = (uint16)(rgba[RCOMP]) << SHIFT;
- rgb.g = (uint16)(rgba[GCOMP]) << SHIFT;
- rgb.b = (uint16)(rgba[BCOMP]) << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
-
- while (n--) {
- if (*mask++)
- ggiPutPixel(ggi_ctx->ggi_visual, *x, FLIP(*y), col);
- x++;
- y++;
- }
-}
-
-/**********************************************************************/
-/***** Read arrays of pixels *****/
-/**********************************************************************/
-
-void GGIread_ci32_pixels( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLuint ci[], const GLubyte mask[])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- while (n--) {
- if (*mask++)
- ggiGetPixel(ggi_ctx->ggi_visual, *x, FLIP(*y), ci);
- ci++;
- x++;
- y++;
- }
-}
-
-void GGIread_rgba_pixels( const GLcontext *ctx,
- GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4],
- const GLubyte mask[] )
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_color rgb;
- ggi_pixel col;
-
- while (n--)
- {
- if (*mask++)
- {
- ggiGetPixel(ggi_ctx->ggi_visual, *x, FLIP(*y), &col);
- ggiUnmapPixel(ggi_ctx->ggi_visual, col, &rgb);
- rgba[0][RCOMP] = rgb.r >> SHIFT;
- rgba[0][GCOMP] = rgb.g >> SHIFT;
- rgba[0][BCOMP] = rgb.b >> SHIFT;
- rgba[0][ACOMP] = 0;
- }
- x++;
- y++;
- rgba++;
- }
-}
-
-int GGIextend_visual(ggi_visual_t vis)
-{
- return 0;
-}
-
-//static swrast_tri_func ggimesa_stubs_get_triangle_func(GLcontext *ctx);
-
-int GGIsetup_driver(ggi_mesa_context_t ggi_ctx)
-{
- struct swrast_device_driver *swdd =
- _swrast_GetDeviceDriverReference(ggi_ctx->gl_ctx);
-
- GGIMESADPRINT_CORE("stubs: setup_driver\n");
-
- swdd->WriteRGBASpan = GGIwrite_rgba_span;
- swdd->WriteRGBSpan = GGIwrite_rgb_span;
- swdd->WriteMonoRGBASpan = GGIwrite_mono_rgba_span;
- swdd->WriteRGBAPixels = GGIwrite_rgba_pixels;
- swdd->WriteMonoRGBAPixels = GGIwrite_mono_rgba_pixels;
-
- swdd->WriteCI32Span = GGIwrite_ci32_span;
- swdd->WriteCI8Span = GGIwrite_ci8_span;
- swdd->WriteMonoCISpan = GGIwrite_mono_ci_span;
- swdd->WriteCI32Pixels = GGIwrite_ci32_pixels;
- swdd->WriteMonoCIPixels = GGIwrite_mono_ci_pixels;
-
- swdd->ReadCI32Span = GGIread_ci32_span;
- swdd->ReadRGBASpan = GGIread_rgba_span;
- swdd->ReadCI32Pixels = GGIread_ci32_pixels;
- swdd->ReadRGBAPixels = GGIread_rgba_pixels;
-
- return 0;
-}
-
-void GGIupdate_state(ggi_mesa_context_t *ctx)
-{
- //ctx->Driver.TriangleFunc = _swsetup_Triangle;
-}
-
-/*
-void GGItriangle_flat(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2)
-{
-//#define INTERP_Z 1
-#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-
-#define SETUP_CODE \
- ggi_color color; \
- color.r = v0->color[0]; \
- color.g = v0->color[1]; \
- color.b = v0->color[2]; \
- color.a = v0->color[3]; \
- ggiSetGCForeground(VIS, ggiMapColor(VIS, &color));
-
-#define INNER_LOOP(LEFT,RIGHT,Y) \
- ggiDrawHLine(VIS,LEFT,FLIP(Y),RIGHT-LEFT);
-
-#include "swrast/s_tritemp.h"
-}
-
-
-static void GGItriangle_flat_depth(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2)
-{
-#define INTERP_Z 1
-#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
-
-#define SETUP_CODE \
- ggi_color color; \
- color.r = v0->color[0]; \
- color.g = v0->color[1]; \
- color.b = v0->color[2]; \
- color.a = v0->color[3]; \
- ggiSetGCForeground(VIS, ggiMapColor(VIS, &color));
-
-#define INNER_LOOP(LEFT,RIGHT,Y) \
- { \
- GLint i,xx=LEFT,yy=FLIP(Y),n=RIGHT-LEFT,length=0; \
- GLint startx=xx; \
- for (i=0;i<n;i++){ \
- GLdepth z=FixedToDepth(ffz); \
- if (z<zRow[i]) \
- { \
- zRow[i]=z; \
- length++; \
- } \
- else \
- { \
- if (length) \
- { \
- ggiDrawHLine(VIS,startx,yy,length); \
- length=0; \
- } \
- startx=xx+i+1; \
- } \
- ffz+=fdzdx; \
- } \
- if (length) ggiDrawHLine(VIS,startx,yy,length); \
- }
-
-#include "swrast/s_tritemp.h"
-}
-
-
-static swrast_tri_func ggimesa_stubs_get_triangle_func(GLcontext *ctx)
-{
- if (ctx->Stencil._Enabled) return NULL;
- if (ctx->Polygon.SmoothFlag) return NULL;
- if (ctx->Polygon.StippleFlag) return NULL;
- if (ctx->Texture._ReallyEnabled) return NULL;
- if (ctx->Light.ShadeModel==GL_SMOOTH) return NULL;
- if (ctx->Depth.Test && ctx->Depth.Func != GL_LESS) return NULL;
-
- if (ctx->Depth.Test)
- return GGItriangle_flat_depth;
-
- return GGItriangle_flat;
-}
-*/
-static int GGIopen(ggi_visual_t vis, struct ggi_dlhandle *dlh,
- const char *args, void *argptr, uint32 *dlret)
-{
- LIBGGI_MESAEXT(vis)->update_state = GGIupdate_state;
- LIBGGI_MESAEXT(vis)->setup_driver = GGIsetup_driver;
-
- *dlret = GGI_DL_OPDRAW;
- return 0;
-}
-
-int MesaGGIdl_stubs(int func, void **funcptr)
-{
- switch (func) {
- case GGIFUNC_open:
- *funcptr = GGIopen;
- return 0;
- case GGIFUNC_exit:
- case GGIFUNC_close:
- *funcptr = NULL;
- return 0;
- default:
- *funcptr = NULL;
- }
- return GGI_ENOTFOUND;
-}
+++ /dev/null
-fbdev.conf
+++ /dev/null
-# GGIMesa fbdev target configuration
-.root: @ggi_libdir@/ggi/mesa/default
-
-tgt-fbdev-kgicon-generic-mesa genkgi.so
+++ /dev/null
-/******************************************************************************
-
- display-fbdev-mesa
-
- Copyright (C) 1999 Jon Taylor [taylorj@ggi-project.org]
-
- 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
- THE AUTHOR(S) 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 <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-
-#include <linux/fb.h>
-
-#include <ggi/internal/ggi-dl.h>
-#include <ggi/mesa/ggimesa_int.h>
-#include <ggi/mesa/display_fbdev.h>
-#include <ggi/mesa/debug.h>
-
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void*)-1)
-#endif
-
-#define FB_KLUDGE_FONTX 8
-#define FB_KLUDGE_FONTY 16
-#define FB_KLUDGE_TEXTMODE 13
-#define TIMINGFILE "/etc/fb.modes"
-
-int GGIMesa_fbdev_getapi(ggi_visual *vis, int num, char *apiname, char *arguments)
-{
- struct fbdev_priv_mesa *priv = GGIMESA_PRIV(vis);
-
- arguments = '\0';
-
- switch(num) {
- case 0:
- if (priv->oldpriv->have_accel) {
- strcpy(apiname, priv->oldpriv->accel);
- return 0;
- }
- break;
- }
-
- return -1;
-}
-
-static int do_setmode(ggi_visual *vis)
-{
- struct fbdev_priv_mesa *priv = GGIMESA_PRIV(vis);
- int err, id;
- char libname[GGI_API_MAXLEN], libargs[GGI_API_MAXLEN];
- ggi_graphtype gt;
-
- _ggiZapMode(vis, ~GGI_DL_OPDISPLAY);
- priv->have_accel = 0;
-
- for (id = 1; GGIMesa_fbdev_getapi(vis, id, libname, libargs) == 0; id++) {
- if (_ggiOpenDL(vis, libname, libargs, NULL) == 0) {
- GGIMESADPRINT_LIBS(stderr, "display-fbdev-mesa: Error opening the "
- "%s (%s) library.\n", libname, libargs);
- return GGI_EFATAL;
- }
-
- GGIMESADPRINT_CORE("Success in loading %s (%s)\n",
- libname, libargs);
- }
-
- if (priv->oldpriv->accel &&
- _ggiOpenDL(vis, priv->accel, NULL, NULL) != 0) {
- priv->have_accel = 1;
- } else {
- priv->have_accel = 0;
- }
- vis->accelactive = 0;
-
- ggiIndicateChange(vis, GGI_CHG_APILIST);
-
- GGIMESADPRINT_CORE("display-fbdev-mesa: do_setmode SUCCESS\n");
-
- return 0;
-}
-
-
-int GGIMesa_fbdev_setmode(ggi_visual *vis, ggi_mode *mode)
-{
- int err;
-
- if ((err = ggiCheckMode(vis, mode)) != 0) {
- return err;
- }
-
- GGIMESADPRINT_CORE("display-fbdev-mesa: setmode %dx%d#%dx%dF%d[0x%02x]\n",
- mode->visible.x, mode->visible.y,
- mode->virt.x, mode->virt.y,
- mode->frames, mode->graphtype);
-
- memcpy(LIBGGI_MODE(vis), mode, sizeof(ggi_mode));
-
- /* Now actually set the mode */
- err = do_setmode(vis);
- if (err != 0) {
- return err;
- }
-
- GGIMESADPRINT_CORE("display-fbdev-mesa: setmode success.\n");
-
- return 0;
-}
+++ /dev/null
-/******************************************************************************
-
- display-fbdev-mesa: visual handling
-
- Copyright (C) 1999 Jon Taylor [taylorj@ggi-project.org]
-
- 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
- THE AUTHOR(S) 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 <ggi/internal/ggi-dl.h>
-#include <ggi/mesa/ggimesa_int.h>
-#include <ggi/mesa/display_fbdev.h>
-#include <ggi/mesa/debug.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-
-#ifdef HAVE_SYS_VT_H
-#include <sys/vt.h>
-#else
-#include <linux/vt.h>
-#endif
-#ifdef HAVE_LINUX_KDEV_T_H
-#include <linux/kdev_t.h>
-#endif
-#include <linux/tty.h>
-
-#define MAX_DEV_LEN 63
-#define DEFAULT_FBNUM 0
-
-static char accel_prefix[] = "tgt-fbdev-";
-#define PREFIX_LEN (sizeof(accel_prefix))
-
-typedef struct {
- int async;
- char *str;
-} accel_info;
-
-static accel_info accel_strings[] = {
- { 0, "kgicon-generic",}, /* no accel - check for KGIcon */
- { 0, NULL }, /* Atari Blitter */
-};
-
-#define NUM_ACCELS (sizeof(accel_strings)/sizeof(accel_info))
-
-
-
-static int GGIopen(ggi_visual *vis, struct ggi_dlhandle *dlh,
- const char *args, void *argptr, uint32 *dlret)
-{
- int err;
- struct fbdev_priv_mesa *priv;
- ggifunc_getapi *oldgetapi;
-
-
- priv->oldpriv = LIBGGI_PRIVATE(vis); /* Hook back */
-
- GGIMESA_PRIV(vis) = priv = malloc(sizeof(struct fbdev_priv_mesa));
- if (priv == NULL) {
- fprintf(stderr, "GGIMesa: Failed to allocate fbdev private data\n");
- return GGI_ENOMEM;
- }
-
- oldgetapi = vis->opdisplay->getapi;
- vis->opdisplay->getapi = GGIMesa_fbdev_getapi;
- changed(vis, GGI_CHG_APILIST);
-
- /* If the accel sublibs didn't sucessfuly hook a driver,
- * back up and keep looking */
- if ((LIBGGI_MESAEXT(vis)->update_state == NULL) ||
- (LIBGGI_MESAEXT(vis)->setup_driver == NULL))
- {
- vis->opdisplay->getapi = oldgetapi;
- }
-
- *dlret = GGI_DL_EXTENSION;
- return 0;
-}
-
-
-static int GGIclose(ggi_visual *vis, struct ggi_dlhandle *dlh)
-{
- struct fbdev_priv_mesa *priv = GGIMESA_PRIV(vis);
-
- if (priv) {
- LIBGGI_PRIVATE(vis) = priv->oldpriv;
- free(priv);
- }
-
- return 0;
-}
-
-
-int MesaGGIdl_fbdev_mesa(int func, void **funcptr)
-{
- switch (func) {
- case GGIFUNC_open:
- *funcptr = GGIopen;
- return 0;
- case GGIFUNC_exit:
- *funcptr = NULL;
- return 0;
- case GGIFUNC_close:
- *funcptr = GGIclose;
- return 0;
- default:
- *funcptr = NULL;
- }
-
- return GGI_ENOTFOUND;
-}
-
-
-#include <ggi/internal/ggidlinit.h>
+++ /dev/null
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997-1998 Uwe Maurer - uwe_maurer@t-online.de
- * 2002 Filip Spacek
- *
- * 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.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include "conf.h"
-#endif
-
-#include <ggi/mesa/ggimesa_int.h>
-#include <ggi/mesa/debug.h>
-#include "main/extensions.h"
-#include "main/buffers.h"
-#include "main/colormac.h"
-#include "main/imports.h"
-#include "main/matrix.h"
-#include "main/teximage.h"
-#include "main/texformat.h"
-#include "main/texstore.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "tnl/tnl.h"
-#include "tnl/t_context.h"
-#include "tnl/t_pipeline.h"
-#include "vbo/vbo.h"
-
-/* We use LibGG to manage config files */
-#include <ggi/gg.h>
-
-
-/* XXX: Those #defines should be provided via
- * config.h
- */
-#define GGIMESAPATHTAG "pAtHTAg"
-#define GGIMESACONFDIR "pAtHTAg/usr/local/etc/ggi"
-#define GGIMESATAGLEN 7
-#define GGIMESACONFFILE "ggimesa.conf"
-
-
-/* Static variables
- */
-static int _ggimesaLibIsUp = 0;
-static void *_ggimesaConfigHandle;
-static char _ggimesaconfstub[512] = GGIMESACONFDIR;
-static char *_ggimesaconfdir = _ggimesaconfstub+GGIMESATAGLEN;
-
-int _ggimesaDebugSync = 0;
-uint32 _ggimesaDebugState = 0;
-
-
-
-/* Extension ID. Defaulting to -1 should make segfault on abuse more likely...
- */
-ggi_extid _ggiMesaID = -1;
-
-
-#define SUBLIB_PREFIX "MesaGGIdl_"
-
-
-/*
- * Returns the directory where global config files are kept
- */
-
-const char *ggiMesaGetConfDir(void)
-{
-#ifdef __WIN32__
- /* On Win32 we allow overriding of the compiled in path. */
- const char *envdir = getenv("GGI_CONFDIR");
- if (envdir) return envdir;
-#endif
- return _ggimesaconfdir;
-}
-
-
-/* Dummy function which returns -1
- We use this to reset the function pointers */
-static int _ggi_error(void)
-{
- GGIMESADPRINT_CORE("_ggi_error() called\n");
-
- return -1;
-}
-
-
-static int changed(ggi_visual_t vis, int whatchanged)
-{
- GLcontext *ctx;
- ctx = _mesa_get_current_context();
-
- GGIMESADPRINT_CORE("changed() called\n");
-
- switch (whatchanged) {
- case GGI_CHG_APILIST:
- {
- char api[GGI_MAX_APILEN];
- char args[GGI_MAX_APILEN];
- int i;
- const char *fname;
- ggi_dlhandle *lib;
-
- GLvisual *gl_vis = &(LIBGGI_MESAEXT(vis)->mesa_visual.gl_visual);
- GLframebuffer *gl_fb = &(LIBGGI_MESAEXT(vis)->mesa_buffer);
-
- /* Initialize the framebuffer to provide all necessary
- buffers in software. The target libraries that are loaded
- next are free to modify this according to their
- capabilities.
- */
- /* FIXME: if the target changes capabilities we'll leak
- swrast's memory !!! Need to deallocate first */
- _mesa_initialize_framebuffer(gl_fb, gl_vis,
- gl_vis->depthBits > 0,
- gl_vis->stencilBits > 0,
- gl_vis->accumRedBits > 0,
- gl_vis->alphaBits > 0);
-
- for (i = 0; ggiGetAPI(vis, i, api, args) == 0; i++) {
- strcat(api, "-mesa");
- GGIMESADPRINT_CORE("GGIMesa: looking for"
- "a sublib named %s\n", api);
- fname = ggMatchConfig(_ggimesaConfigHandle, api, NULL);
- if (fname == NULL) {
- /* No special implementation for this sublib */
- continue;
- }
- lib = ggiExtensionLoadDL(vis, fname, args, NULL,
- SUBLIB_PREFIX);
- }
-
- /* The targets have cleared everything they can do from
- the framebuffer structure so we provide the rest in sw
- */
- /*_swrast_alloc_buffers(gl_fb);*/
-
- break;
- }
- }
- return 0;
-}
-
-
-int ggiMesaInit()
-{
- int err;
- char *str;
- char *conffile;
-
- GGIMESADPRINT_CORE("ggiMesaInit() called\n");
-
- _ggimesaLibIsUp++;
- if (_ggimesaLibIsUp > 1) return 0; /* Initialize only at first call */
-
- str = getenv("GGIMESA_DEBUGSYNC");
- if (str != NULL) {
- _ggimesaDebugSync = 1;
- }
-
- str = getenv("GGIMESA_DEBUG");
- if (str != NULL) {
- _ggimesaDebugState = atoi(str);
- GGIMESADPRINT_CORE("%s Debugging=%d\n",
- _ggimesaDebugSync ? "sync" : "async",
- _ggimesaDebugState);
- }
-
-
- conffile = malloc(strlen(ggiMesaGetConfDir()) + 1
- + strlen(GGIMESACONFFILE) +1);
- if (conffile == NULL) {
- fprintf(stderr, "GGIMesa: unable to allocate memory for config filename.\n");
- return GGI_ENOMEM;
- }
- sprintf(conffile, "%s%c%s",
- ggiMesaGetConfDir(), '/', GGIMESACONFFILE);
- err = ggLoadConfig(conffile, &_ggimesaConfigHandle);
- if (err != GGI_OK) {
- fprintf(stderr, "GGIMesa: Couldn't open %s\n",
- conffile);
- free(conffile);
- _ggimesaLibIsUp--;
- return err;
- }
- free(conffile);
-
- _ggiMesaID = ggiExtensionRegister("GGIMesa",
- sizeof(struct ggi_mesa_ext), changed);
- if (_ggiMesaID < 0) {
- fprintf(stderr, "GGIMesa: failed to register as extension\n");
- _ggimesaLibIsUp--;
- ggFreeConfig(_ggimesaConfigHandle);
- return _ggiMesaID;
- }
-
- return 0;
-}
-
-int ggiMesaExit(void)
-{
- int rc;
-
- GGIMESADPRINT_CORE("ggiMesaExit() called\n");
-
- if (!_ggimesaLibIsUp) return -1;
-
- if (_ggimesaLibIsUp > 1) {
- /* Exit only at last call */
- _ggimesaLibIsUp--;
- return 0;
- }
-
- rc = ggiExtensionUnregister(_ggiMesaID);
- ggFreeConfig(_ggimesaConfigHandle);
-
- _ggimesaLibIsUp = 0;
-
- return rc;
-}
-
-
-
-
-static void gl_ggiUpdateState(GLcontext *ctx, GLuint new_state);
-
-
-static void gl_ggiGetSize(GLframebuffer *fb, GLuint *width, GLuint *height)
-{
- /* FIXME: this is a hack to work around the new interface */
- GLcontext *ctx;
- ggi_mesa_context_t ggi_ctx;
- ctx = _mesa_get_current_context();
- ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
-
- GGIMESADPRINT_CORE("gl_ggiGetSize() called\n");
-
- *width = LIBGGI_VIRTX(ggi_ctx->ggi_visual);
- *height = LIBGGI_VIRTY(ggi_ctx->ggi_visual);
- printf("returning %d, %d\n", *width, *height);
-}
-
-/**
- * We only implement this function as a mechanism to check if the
- * framebuffer size has changed (and update corresponding state).
- */
-static void gl_ggiViewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
-{
- GLuint newWidth, newHeight;
- GLframebuffer *buffer = ctx->WinSysDrawBuffer;
- gl_ggiGetSize( buffer, &newWidth, &newHeight );
- if (buffer->Width != newWidth || buffer->Height != newHeight) {
- _mesa_resize_framebuffer(ctx, buffer, newWidth, newHeight );
- }
-}
-
-
-static void gl_ggiSetIndex(GLcontext *ctx, GLuint ci)
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
-
- GGIMESADPRINT_CORE("gl_ggiSetIndex() called\n");
-
- ggiSetGCForeground(ggi_ctx->ggi_visual, ci);
- ggi_ctx->color = (ggi_pixel)ci;
-}
-
-static void gl_ggiSetClearIndex(GLcontext *ctx, GLuint ci)
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
-
- GGIMESADPRINT_CORE("gl_ggiSetClearIndex() called\n");
-
- ggiSetGCForeground(ggi_ctx->ggi_visual, ci);
- ggi_ctx->clearcolor = (ggi_pixel)ci;
-}
-
-static void gl_ggiSetClearColor(GLcontext *ctx, const GLfloat color[4])
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- ggi_color rgb;
- ggi_pixel col;
- GLubyte byteColor[3];
-
- GGIMESADPRINT_CORE("gl_ggiSetClearColor() called\n");
-
- CLAMPED_FLOAT_TO_UBYTE(byteColor[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(byteColor[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(byteColor[2], color[2]);
-
- rgb.r = (uint16)byteColor[0] << SHIFT;
- rgb.g = (uint16)byteColor[1] << SHIFT;
- rgb.b = (uint16)byteColor[2] << SHIFT;
- col = ggiMapColor(ggi_ctx->ggi_visual, &rgb);
- ggiSetGCForeground(ggi_ctx->ggi_visual, col);
- ggi_ctx->clearcolor = col;
-}
-
-static void gl_ggiClear(GLcontext *ctx, GLbitfield mask)
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
- int x = ctx->DrawBuffer->_Xmin;
- int y = ctx->DrawBuffer->_Ymin;
- int w = ctx->DrawBuffer->_Xmax - x;
- int h = ctx->DrawBuffer->_Ymax - y;
- GLboolean all = (w == ctx->DrawBuffer->Width && h == ctx->DrawBuffer->height)
-
- GGIMESADPRINT_CORE("gl_ggiClear() called\n");
-
- if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) {
- ggiSetGCForeground(ggi_ctx->ggi_visual, ggi_ctx->clearcolor);
-
- if (all) {
- int w, h;
- w = LIBGGI_VIRTX(ggi_ctx->ggi_visual);
- h = LIBGGI_VIRTX(ggi_ctx->ggi_visual);
- ggiDrawBox(ggi_ctx->ggi_visual, 0, 0, w, h);
- } else {
- ggiDrawBox(ggi_ctx->ggi_visual, x, y, //FLIP(y),
- width, height);
- }
- ggiSetGCForeground(ggi_ctx->ggi_visual, ggi_ctx->color);
-
- mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT);
- }
- _swrast_Clear(ctx, mask);
-
-}
-
-
-/* Set the buffer used for reading */
-/* XXX support for separate read/draw buffers hasn't been tested */
-static GLboolean gl_ggiSetBuffer(GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit)
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
-
- printf("set read %d\n", bufferBit);
- GGIMESADPRINT_CORE("gl_ggiSetBuffer() called\n");
-
- if (bufferBit == DD_FRONT_LEFT_BIT)
- {
- ggiSetReadFrame(ggi_ctx->ggi_visual,
- ggiGetDisplayFrame(ggi_ctx->ggi_visual));
- ggiSetWriteFrame(ggi_ctx->ggi_visual,
- ggiGetDisplayFrame(ggi_ctx->ggi_visual));
- return GL_TRUE;
- }
- else if (bufferBit == DD_BACK_LEFT_BIT)
- {
- ggiSetReadFrame(ggi_ctx->ggi_visual,
- ggiGetDisplayFrame(ggi_ctx->ggi_visual)?0 : 1);
- ggiSetWriteFrame(ggi_ctx->ggi_visual,
- ggiGetDisplayFrame(ggi_ctx->ggi_visual)?0 : 1);
- return GL_TRUE;
- }
- else
- return GL_FALSE;
-}
-
-
-static const GLubyte * gl_ggiGetString(GLcontext *ctx, GLenum name)
-{
- GGIMESADPRINT_CORE("gl_ggiGetString() called\n");
-
- if (name == GL_RENDERER) {
- return (GLubyte *) "Mesa GGI";
- } else {
- return NULL;
- }
-}
-
-static void gl_ggiFlush(GLcontext *ctx)
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
-
- GGIMESADPRINT_CORE("gl_ggiFlush() called\n");
-
- ggiFlush(ggi_ctx->ggi_visual);
-}
-
-static void gl_ggiIndexMask(GLcontext *ctx, GLuint mask)
-{
- GGIMESADPRINT_CORE("gl_ggiIndexMask() called\n");
-}
-
-static void gl_ggiColorMask(GLcontext *ctx, GLboolean rmask, GLboolean gmask,
- GLboolean bmask, GLboolean amask)
-{
- GGIMESADPRINT_CORE("gl_ggiColorMask() called\n");
-}
-
-static void gl_ggiEnable(GLcontext *ctx, GLenum pname, GLboolean state)
-{
- GGIMESADPRINT_CORE("gl_ggiEnable() called\n");
-}
-
-static void gl_ggiSetupPointers(GLcontext *ctx)
-{
- TNLcontext *tnl;
-
- GGIMESADPRINT_CORE("gl_ggiSetupPointers() called\n");
-
- /* Plug in default driver functions */
- _mesa_init_driver_functions(&ctx->Driver);
-
- /* Plug in ggi-specific functions */
- ctx->Driver.GetString = gl_ggiGetString;
- ctx->Driver.GetBufferSize = gl_ggiGetSize;
- ctx->Driver.Viewport = gl_ggiViewport;
- ctx->Driver.Finish = gl_ggiFlush;
- ctx->Driver.Flush = gl_ggiFlush;
- ctx->Driver.Clear = gl_ggiClear;
- ctx->Driver.ClearIndex = gl_ggiSetClearIndex;
- ctx->Driver.ClearColor = gl_ggiSetClearColor;
- ctx->Driver.IndexMask = gl_ggiIndexMask;
- ctx->Driver.ColorMask = gl_ggiColorMask;
- ctx->Driver.Enable = gl_ggiEnable;
- ctx->Driver.UpdateState = gl_ggiUpdateState;
-
- /* Initialize TNL driver interface */
- tnl = TNL_CONTEXT(ctx);
- tnl->Driver.RunPipeline = _tnl_run_pipeline;
-
- /* Install setup for tnl */
- _swsetup_Wakeup(ctx);
-}
-
-static void get_mode_info(ggi_visual_t vis, int *r, int *g, int *b,
- GLboolean *rgb, GLboolean *db, int *ci)
-{
- unsigned int i;
-
- *r = 0;
- *g = 0;
- *b = 0;
-
- for(i = 0; i < sizeof(ggi_pixel)*8; ++i) {
- int mask = 1 << i;
- if (LIBGGI_PIXFMT(vis)->red_mask & mask)
- ++(*r);
- if (LIBGGI_PIXFMT(vis)->green_mask & mask)
- ++(*g);
- if (LIBGGI_PIXFMT(vis)->blue_mask & mask)
- ++(*b);
- }
-
- *rgb = GT_SCHEME(LIBGGI_MODE(vis)->graphtype) == GT_TRUECOLOR;
- *db = LIBGGI_MODE(vis)->frames > 1;
- *ci = GT_SIZE(LIBGGI_MODE(vis)->graphtype);
-
- printf("rgb (%d, %d, %d) db %d, rgb %d ci %d\n",*r,*g,*b,*db,*rgb,*ci);
-}
-
-
-int ggiMesaAttach(ggi_visual_t vis)
-{
- int rc;
-
- GGIMESADPRINT_CORE("ggiMesaAttach() called\n");
-
- rc = ggiExtensionAttach(vis, _ggiMesaID);
- if (rc == 0)
- {
- int r, g, b, ci;
- GLboolean rgb, db;
- GLvisual *gl_visual;
-
- /* We are creating the primary instance */
- memset(LIBGGI_MESAEXT(vis), 0, sizeof(struct ggi_mesa_ext));
- LIBGGI_MESAEXT(vis)->update_state = (void *)_ggi_error;
- LIBGGI_MESAEXT(vis)->setup_driver = (void *)_ggi_error;
-
- /* Initialize default mesa visual */
- get_mode_info(vis, &r, &g, &b, &rgb, &db, &ci);
- gl_visual = &(LIBGGI_MESAEXT(vis)->mesa_visual.gl_visual);
- _mesa_initialize_visual(gl_visual,
- rgb, db, 0 /* No stereo */,
- r, g, b, 0 /* No alpha */, ci,
- 0 /* No depth */, 0 /* No stencil */,
- 0, 0, 0, 0 /* No accum */, 0);
-
- /* Now fake an "API change" so the right libs get loaded */
- changed(vis, GGI_CHG_APILIST);
- }
-
- return rc;
-}
-
-int ggiMesaDetach(ggi_visual_t vis)
-{
- GGIMESADPRINT_CORE("ggiMesaDetach() called\n");
-
- return ggiExtensionDetach(vis, _ggiMesaID);
-}
-
-int ggiMesaExtendVisual(ggi_visual_t vis, GLboolean alpha_flag,
- GLboolean stereo_flag, GLint depth_size,
- GLint stencil_size, GLint accum_red_size,
- GLint accum_green_size, GLint accum_blue_size,
- GLint accum_alpha_size, GLint num_samples)
-{
- GLvisual *gl_vis = &(LIBGGI_MESAEXT(vis)->mesa_visual.gl_visual);
- int r, g, b, ci;
- GLboolean db, rgb;
-
- get_mode_info(vis, &r, &g, &b, &rgb, &db, &ci);
-
- /* Initialize the visual with the provided information */
- _mesa_initialize_visual(gl_vis,
- rgb, db, stereo_flag,
- r, g, b, 0 /* FIXME */, ci,
- depth_size, stencil_size,
- accum_red_size, accum_green_size,
- accum_blue_size, accum_alpha_size, 0);
-
- /* Now fake an "API change" so the right libs get loaded. After all,
- extending the visual by all these new buffers could be considered
- a "mode change" which requires an "API change".
- */
- changed(vis, GGI_CHG_APILIST);
-
- return 0;
-}
-
-
-ggi_mesa_context_t ggiMesaCreateContext(ggi_visual_t vis)
-{
- ggi_mesa_context_t ctx;
- int err;
-
- GGIMESADPRINT_CORE("ggiMesaCreateContext() called\n");
-
- ctx = (ggi_mesa_context_t)malloc(sizeof(struct ggi_mesa_context));
- if (!ctx)
- return NULL;
-
- ctx->ggi_visual = vis;
- ctx->color = 0;
-
- ctx->gl_ctx =
- _mesa_create_context(&(LIBGGI_MESAEXT(vis)->mesa_visual.gl_visual),
- NULL, (void *) ctx, GL_FALSE);
- if (!ctx->gl_ctx)
- goto free_context;
-
- _mesa_enable_sw_extensions(ctx->gl_ctx);
-
- _swrast_CreateContext(ctx->gl_ctx);
- _vbo_CreateContext(ctx->gl_ctx);
- _tnl_CreateContext(ctx->gl_ctx);
- _swsetup_CreateContext(ctx->gl_ctx);
-
- gl_ggiSetupPointers(ctx->gl_ctx);
-
- /* Make sure that an appropriate sublib has been loaded */
- if (!LIBGGI_MESAEXT(ctx->ggi_visual)->setup_driver){
- GGIMESADPRINT_CORE("setup_driver==NULL!\n");
- GGIMESADPRINT_CORE("Please check your config files!\n");
- goto free_context;
- }
-
- /* Set up the sublib driver */
- err = LIBGGI_MESAEXT(ctx->ggi_visual)->setup_driver(ctx);
- if (err){
- GGIMESADPRINT_CORE("setup_driver failed (err = %d)", err);
- goto free_gl_context;
- }
-
- return ctx;
-
-free_gl_context:
- _mesa_destroy_context(ctx->gl_ctx);
-free_context:
- free(ctx);
-
- return NULL;
-}
-
-void ggiMesaDestroyContext(ggi_mesa_context_t ctx)
-{
- GGIMESADPRINT_CORE("ggiMesaDestroyContext() called\n");
-
- if(!ctx)
- return;
-
- _mesa_destroy_context(ctx->gl_ctx);
- free(ctx);
-}
-
-void ggiMesaMakeCurrent(ggi_mesa_context_t ctx, ggi_visual_t vis)
-{
- GGIMESADPRINT_CORE("ggiMesaMakeCurrent(ctx = %p) called\n", ctx);
-
- /* FIXME: clean up where are ggi_vis */
- if (ctx->ggi_visual != vis) {
- GGIMESADPRINT_CORE("Cannot migrate GL contexts\n");
- return;
- }
-
- _mesa_make_current(ctx->gl_ctx, &LIBGGI_MESAEXT(vis)->mesa_buffer);
-}
-
-
-/*
- * Swap front/back buffers for current context if double buffered.
- */
-void ggiMesaSwapBuffers(void)
-{
- GLcontext *ctx;
- ggi_mesa_context_t ggi_ctx;
- ctx = _mesa_get_current_context();
- ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
-
- GGIMESADPRINT_CORE("ggiMesaSwapBuffers() called\n");
-
- _mesa_notifySwapBuffers(ctx);
- gl_ggiFlush(ctx);
-
- ggiSetDisplayFrame(ggi_ctx->ggi_visual,
- !ggiGetDisplayFrame(ggi_ctx->ggi_visual));
- ggiSetWriteFrame(ggi_ctx->ggi_visual,
- !ggiGetWriteFrame(ggi_ctx->ggi_visual));
- ggiSetReadFrame(ggi_ctx->ggi_visual,
- !ggiGetReadFrame(ggi_ctx->ggi_visual));
-
- GGIMESADPRINT_CORE("swap disp: %d, write %d\n",
- ggiGetDisplayFrame(ggi_ctx->ggi_visual),
- ggiGetWriteFrame(ggi_ctx->ggi_visual));
-}
-
-static void gl_ggiUpdateState(GLcontext *ctx, GLuint new_state)
-{
- ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx;
-
- GGIMESADPRINT_CORE("gl_ggiUpdateState() called\n");
-
- /* Propogate statechange information to swrast and swrast_setup
- * modules. The GGI driver has no internal GL-dependent state.
- */
- _swrast_InvalidateState(ctx, new_state);
- _swsetup_InvalidateState(ctx, new_state);
- _tnl_InvalidateState(ctx, new_state);
-
- /* XXX: Better use an assertion that bails out here on failure */
- if (!LIBGGI_MESAEXT(ggi_ctx->ggi_visual)->update_state) {
- GGIMESADPRINT_CORE("update_state == NULL!\n");
- GGIMESADPRINT_CORE("Please check your config files!\n");
- ggiPanic("");
- }
-
- LIBGGI_MESAEXT(ggi_ctx->ggi_visual)->update_state(ggi_ctx);
-}
-
+++ /dev/null
-# GGIMesa global configuration
-.root: @ggi_libdir@/ggi/mesa
-
-generic-stubs-mesa default/stubs.so
-generic-linear-8-mesa default/linear_8.so
-generic-linear-15-mesa default/linear_15.so
-generic-linear-16-mesa default/linear_16.so
-generic-linear-24-mesa default/linear_24.so
-generic-linear-32-mesa default/linear_32.so
-
-display-fbdev-mesa display/fbdev.so
-
-# .include @ggi_confdir@/ggi/mesa/targets/fbdev.conf
+++ /dev/null
-/*
-******************************************************************************
-
- GGIMesa debugging macros
-
- Copyright (C) 1998-1999 Marcus Sundberg [marcus@ggi-project.org]
- Copyright (C) 1999-2000 Jon Taylor [taylorj@ggi-project.org]
-
- 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
- THE AUTHOR(S) 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 _GGI_MESA_INTERNAL_DEBUG_H
-#define _GGI_MESA_INTERNAL_DEBUG_H
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <ggi/types.h>
-#include <ggi/gg.h>
-
-#ifndef DEBUG
-#define DEBUG
-#endif
-
-__BEGIN_DECLS
-
-/* Exported variables */
-#ifdef BUILDING_GGIMESA
-extern uint32 _ggimesaDebugState;
-extern int _ggimesaDebugSync;
-#else
-IMPORTVAR uint32 _ggimesaDebugState;
-IMPORTVAR int _ggimesaDebugSync;
-#endif
-
-__END_DECLS
-
-
-/* Debugging types
- * bit 0 is reserved! */
-
-#define GGIMESADEBUG_CORE (1<<1) /* 2 */
-#define GGIMESADEBUG_MODE (1<<2) /* 4 */
-#define GGIMESADEBUG_COLOR (1<<3) /* 8 */
-#define GGIMESADEBUG_DRAW (1<<4) /* 16 */
-#define GGIMESADEBUG_MISC (1<<5) /* 32 */
-#define GGIMESADEBUG_LIBS (1<<6) /* 64 */
-#define GGIMESADEBUG_EVENTS (1<<7) /* 128 */
-
-#define GGIMESADEBUG_ALL 0xffffffff
-
-#ifdef __GNUC__
-
-#ifdef DEBUG
-#define GGIMESADPRINT(args...) if (_ggimesaDebugState) { ggDPrintf(_ggimesaDebugSync, "GGIMesa",args); }
-#define GGIMESADPRINT_CORE(args...) if (_ggimesaDebugState & GGIMESADEBUG_CORE) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); }
-#define GGIMESADPRINT_MODE(args...) if (_ggimesaDebugState & GGIMESADEBUG_MODE) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); }
-#define GGIMESADPRINT_COLOR(args...) if (_ggimesaDebugState & GGIMESADEBUG_COLOR) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); }
-#define GGIMESADPRINT_DRAW(args...) if (_ggimesaDebugState & GGIMESADEBUG_DRAW) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); }
-#define GGIMESADPRINT_MISC(args...) if (_ggimesaDebugState & GGIMESADEBUG_MISC) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); }
-#define GGIMESADPRINT_LIBS(args...) if (_ggimesaDebugState & GGIMESADEBUG_LIBS) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); }
-#define GGIMESADPRINT_EVENTS(args...) if (_ggimesaDebugState & GGIMESADEBUG_EVENTS) { ggDPrintf(_ggimesaDebugSync,"GGIMesa",args); }
-#else /* DEBUG */
-#define GGIMESADPRINT(args...) do{}while(0)
-#define GGIMESADPRINT_CORE(args...) do{}while(0)
-#define GGIMESADPRINT_MODE(args...) do{}while(0)
-#define GGIMESADPRINT_COLOR(args...) do{}while(0)
-#define GGIMESADPRINT_DRAW(args...) do{}while(0)
-#define GGIMESADPRINT_MISC(args...) do{}while(0)
-#define GGIMESADPRINT_LIBS(args...) do{}while(0)
-#define GGIMESADPRINT_EVENTS(args...) do{}while(0)
-#endif /* DEBUG */
-
-#else /* __GNUC__ */
-
-__BEGIN_DECLS
-
-static inline void GGIMESADPRINT(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState) {
- va_list args;
-
- fprintf(stderr, "GGIMesa: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggimesaDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIMESADPRINT_CORE(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_CORE) {
- va_list args;
-
- fprintf(stderr, "GGIMesa: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggimesaDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIMESADPRINT_MODE(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_MODE) {
- va_list args;
-
- fprintf(stderr, "GGIMesa: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggimesaDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIMESADPRINT_COLOR(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_COLOR) {
- va_list args;
-
- fprintf(stderr, "GGIMesa: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggimesaDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIMESADPRINT_DRAW(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_DRAW) {
- va_list args;
-
- fprintf(stderr, "GGIMesa: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggimesaDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIMESADPRINT_MISC(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_MISC) {
- va_list args;
-
- fprintf(stderr, "GGIMesa: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggimesaDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIMESADPRINT_LIBS(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_LIBS) {
- va_list args;
-
- fprintf(stderr, "GGIMesa: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggimesaDebugSync) fflush(stderr);
- }
-#endif
-}
-
-static inline void GGIMESADPRINT_EVENTS(const char *form,...)
-{
-#ifdef DEBUG
- if (_ggiDebugState & GGIDEBUG_EVENTS) {
- va_list args;
-
- fprintf(stderr, "GGIMesa: ");
- va_start(args, form);
- vfprintf(stderr, form, args);
- va_end(args);
- if (_ggimesaDebugSync) fflush(stderr);
- }
-#endif
-}
-
-__END_DECLS
-
-#endif /* __GNUC__ */
-
-#ifdef DEBUG
-#define GGIMESA_ASSERT(x,str) \
-{ if (!(x)) { \
- fprintf(stderr,"GGIMESA:%s:%d: INTERNAL ERROR: %s\n",__FILE__,__LINE__,str); \
- exit(1); \
-} }
-#define GGIMESA_APPASSERT(x,str) \
-{ if (!(x)) { \
- fprintf(stderr,"GGIMESA:%s:%d: APPLICATION ERROR: %s\n",__FILE__,__LINE__,str); \
- exit(1); \
-} }
-#else /* DEBUG */
-#define GGIMESA_ASSERT(x,str) do{}while(0)
-#define GGIMESA_APPASSERT(x,str) do{}while(0)
-#endif /* DEBUG */
-
-#ifdef DEBUG
-# define GGIMESAD0(x) x
-#else
-# define GGIMESAD0(x) /* empty */
-#endif
-
-#ifdef GGIMESADLEV
-# if GGIMESADLEV == 1
-# define GGIMESAD1(x) x
-# define GGIMESAD2(x) /* empty */
-# define GGIMESAD3(x) /* empty */
-# elif GGIMESADLEV == 2
-# define GGIMESAD1(x) x
-# define GGIMESAD2(x) x
-# define GGIMESAD3(x) /* empty */
-# elif GGIMESADLEV > 2
-# define GGIMESAD1(x) x
-# define GGIMESAD2(x) x
-# define GGIMESAD3(x) x
-# endif
-#else
-# define GGIMESAD1(x) /* empty */
-# define GGIMESAD2(x) /* empty */
-# define GGIMESAD3(x) /* empty */
-#endif
-
-#endif /* _GGI_MESA_INTERNAL_DEBUG_H */
+++ /dev/null
-#ifndef _GGIMESA_DISPLAY_FBDEV_H
-#define _GGIMESA_DISPLAY_FBDEV_H
-
-#include <ggi/internal/ggi-dl.h>
-#include <ggi/display/fbdev.h>
-
-ggifunc_setmode GGIMesa_fbdev_setmode;
-ggifunc_getapi GGIMesa_fbdev_getapi;
-
-#define FBDEV_PRIV_MESA(vis) ((struct fbdev_priv_mesa *)(FBDEV_PRIV(vis)->accelpriv))
-
-struct fbdev_priv_mesa
-{
- char *accel;
- int have_accel;
- void *accelpriv;
- ggi_fbdev_priv *oldpriv; /* Hooks back to the LibGGI fbdev target's private data */
-};
-
-#endif /* _GGIMESA_DISPLAY_FBDEV_H */
+++ /dev/null
-/* GGI-Driver for MESA
- *
- * Copyright (C) 1997 Uwe Maurer
- *
- * 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.
- * ---------------------------------------------------------------------
- * This code was derived from the following source of information:
- *
- * svgamesa.c and ddsample.c by Brian Paul
- *
- */
-
-#ifndef _GGIMESA_H
-#define _GGIMESA_H
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include "config.h"
-#include "context.h"
-#include "drawpix.h"
-#include "imports.h"
-#include "matrix.h"
-#include "state.h"
-#include "mtypes.h"
-#include "macros.h"
-#include "depth.h"
-
-#undef ASSERT /* ASSERT is redefined */
-
-#include <ggi/internal/internal.h>
-#include <ggi/ggi_ext.h>
-#include <ggi/ggi.h>
-#include "GL/ggimesa.h"
-
-/*
- * GGIMesa visual configuration.
- *
- * This structure "derives" from Mesa's GLvisual and extends it by
- * GGI's visual. Combination of these two structures is enough to fully
- * describe the mode the application is currently running in. GGI
- * visual provides information about color configuration and buffering
- * method, GLvisual fills the rest.
- */
-struct ggi_mesa_visual {
- GLvisual gl_visual;
- ggi_visual_t ggi_visual;
-};
-
-/*
- * GGIMesa context.
- *
- * GGIMesa context expands the Mesa's context (it doesn't actualy derive
- * from it, but this ability isn't needed, and it is best if GL context
- * creation is left up to Mesa). It also contains a reference to the GGI
- * visual it is attached to, which is very useful for all Mesa callbacks.
- */
-struct ggi_mesa_context
-{
- GLcontext *gl_ctx;
- ggi_visual_t ggi_visual;
-
- ggi_pixel color; /* Current color or index*/
- ggi_pixel clearcolor;
-
- void *priv;
-};
-
-#define SHIFT (GGI_COLOR_PRECISION - 8)
-
-#endif
-
+++ /dev/null
-#ifndef _GGI_MESA_INT_H
-#define _GGI_MESA_INT_H
-
-#include <ggi/internal/internal.h>
-#include "ggimesa.h"
-
-
-extern ggi_extid _ggiMesaID;
-
-ggifunc_setmode GGIMesa_setmode;
-ggifunc_getapi GGIMesa_getapi;
-
-typedef struct ggi_mesa_ext
-{
- /*
- * How mesa extends this visual; i.e., size of the depth buffer etc.
- *
- * By default (upon attaching) this structure is initialized to what
- * libggi is guaranteed to handle without any help: single buffered
- * visual without any ancilary buffers.
- */
- struct ggi_mesa_visual mesa_visual;
-
- /*
- * Mesa framebuffer is a collection of all ancilary buffers required.
- *
- * This structure contains the ancilary buffers provided in in
- * software. On each mode change it is loaded with the list of
- * required buffers and the target is expected to clear the ones
- * it can provide in hw. The remaining ones are then provided in sw.
- *
- */
- GLframebuffer mesa_buffer;
-
- void (*update_state)(ggi_mesa_context_t ctx);
- int (*setup_driver)(ggi_mesa_context_t ctx);
-
- void *private;
-} ggi_mesa_ext_t;
-
-#define LIBGGI_MESAEXT(vis) ((ggi_mesa_ext_t *)LIBGGI_EXT(vis,_ggiMesaID))
-#define GGIMESA_PRIV(vis) ((LIBGGI_MESAEXT(vis)->priv))
-
-#endif /* _GGI_MISC_INT_H */