summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile8
-rw-r--r--configs/linux-directfb38
-rw-r--r--configure.ac2
-rw-r--r--docs/README.directfb29
-rw-r--r--include/GL/directfbgl.h89
-rw-r--r--progs/directfb/.gitignore4
-rw-r--r--progs/directfb/Makefile38
-rw-r--r--progs/directfb/df_gears.c480
-rw-r--r--progs/directfb/df_morph3d.c1013
-rw-r--r--progs/directfb/df_reflect.c489
-rw-r--r--progs/directfb/multi_window.c240
-rw-r--r--src/glut/directfb/Makefile87
-rw-r--r--src/glut/directfb/NOTES9
-rw-r--r--src/glut/directfb/callback.c300
-rw-r--r--src/glut/directfb/color.c39
-rw-r--r--src/glut/directfb/cursor.c175
-rw-r--r--src/glut/directfb/cursors.h306
-rw-r--r--src/glut/directfb/events.c492
-rw-r--r--src/glut/directfb/ext.c202
-rw-r--r--src/glut/directfb/font.c213
-rw-r--r--src/glut/directfb/font.h58
-rw-r--r--src/glut/directfb/game.c153
-rw-r--r--src/glut/directfb/globals.c63
-rw-r--r--src/glut/directfb/init.c128
-rw-r--r--src/glut/directfb/internal.h188
-rw-r--r--src/glut/directfb/menu.c87
-rw-r--r--src/glut/directfb/models.c599
-rw-r--r--src/glut/directfb/overlay.c62
-rw-r--r--src/glut/directfb/state.c219
-rw-r--r--src/glut/directfb/teapot.c212
-rw-r--r--src/glut/directfb/window.c597
-rw-r--r--src/mesa/drivers/directfb/Makefile67
-rw-r--r--src/mesa/drivers/directfb/idirectfbgl_mesa.c982
33 files changed, 2 insertions, 7666 deletions
diff --git a/Makefile b/Makefile
index 3e92e1312e..0527fa0d82 100644
--- a/Makefile
+++ b/Makefile
@@ -48,7 +48,7 @@ install:
done
-.PHONY: default doxygen clean realclean distclean install linux-directfb-install
+.PHONY: default doxygen clean realclean distclean install
# If there's no current configuration file
$(TOP)/configs/current:
@@ -109,7 +109,6 @@ linux-alpha-static \
linux-cell \
linux-cell-debug \
linux-debug \
-linux-directfb \
linux-dri \
linux-dri-debug \
linux-dri-x86 \
@@ -271,8 +270,6 @@ MAIN_FILES = \
$(DIRECTORY)/src/mesa/drivers/beos/Makefile \
$(DIRECTORY)/src/mesa/drivers/common/*.[ch] \
$(DIRECTORY)/src/mesa/drivers/common/descrip.mms \
- $(DIRECTORY)/src/mesa/drivers/directfb/*.[ch] \
- $(DIRECTORY)/src/mesa/drivers/directfb/Makefile \
$(DIRECTORY)/src/mesa/drivers/dos/*.[chS] \
$(DIRECTORY)/src/mesa/drivers/fbdev/Makefile \
$(DIRECTORY)/src/mesa/drivers/fbdev/glfbdev.c \
@@ -483,9 +480,6 @@ GLUT_FILES = \
$(DIRECTORY)/src/glut/fbdev/*[ch] \
$(DIRECTORY)/src/glut/mini/*[ch] \
$(DIRECTORY)/src/glut/mini/glut.pc.in \
- $(DIRECTORY)/src/glut/directfb/Makefile \
- $(DIRECTORY)/src/glut/directfb/NOTES \
- $(DIRECTORY)/src/glut/directfb/*[ch]
DEPEND_FILES = \
$(TOP)/src/mesa/depend \
diff --git a/configs/linux-directfb b/configs/linux-directfb
deleted file mode 100644
index 9ae3de96d1..0000000000
--- a/configs/linux-directfb
+++ /dev/null
@@ -1,38 +0,0 @@
-# Configuration for DirectFB
-
-include $(TOP)/configs/default
-
-CONFIG_NAME = linux-directfb
-
-# Compiler and flags
-CC = gcc
-CXX = g++
-
-CFLAGS = -Wall -O3 -ffast-math -fPIC -std=c99 -D_GNU_SOURCE -D_POSIX_SOURCE -D_SVID_SOURCE \
- -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -DPTHREADS
-
-CXXFLAGS = -Wall -O3 -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE
-
-# Work around aliasing bugs - developers should comment this out
-CFLAGS += -fno-strict-aliasing
-CXXFLAGS += -fno-strict-aliasing
-
-HAVE_X86 = $(shell uname -m | grep 'i[3-6]86' >/dev/null && echo yes)
-ifeq ($(HAVE_X86), yes)
- CFLAGS += -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM
- CXXFLAGS += -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM
- MESA_ASM_SOURCES = $(X86_SOURCES)
- GLAPI_ASM_SOURCES = $(X86_API)
-endif
-
-# Directories
-SRC_DIRS = gallium mesa glu glut/directfb glew
-GLU_DIRS = sgi
-DRIVER_DIRS = directfb
-PROGRAM_DIRS = demos directfb
-
-# Library/program dependencies
-GL_LIB_DEPS = -lm -lpthread
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -l$(GLU_LIB)
-APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -l$(GLU_LIB) -l$(GLUT_LIB)
-
diff --git a/configure.ac b/configure.ac
index 485836a428..b4561000d2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -395,7 +395,7 @@ fi
dnl
dnl Driver configuration. Options are xlib, dri and osmesa right now.
-dnl More later: directfb, fbdev, ...
+dnl More later: fbdev, ...
dnl
default_driver="xlib"
diff --git a/docs/README.directfb b/docs/README.directfb
deleted file mode 100644
index d66ca8d3ca..0000000000
--- a/docs/README.directfb
+++ /dev/null
@@ -1,29 +0,0 @@
-
- Mesa DirectFB Information
-
-
-Requirements
-============
-
- To build Mesa with DirectFB (DirectFBGL) support you need:
- - DirectFB at least 1.0.0 (http://directfb.org)
- - pkg-config at least 0.9 (http://pkgconfig.sf.net)
-
-
-Installation
-============
- Run
-
- make linux-directfb
-
- to build Mesa and DirectFBGL module,
-
- make install
-
- to install OpenGL libraries and
-
- cd src/mesa/drivers/directfb ; make install
-
- to install DirectFBGL module in the proper location.
- Actually, that last command may not be needed. Please provide feedback.
-
diff --git a/include/GL/directfbgl.h b/include/GL/directfbgl.h
deleted file mode 100644
index 984c4b1427..0000000000
--- a/include/GL/directfbgl.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- (c) Copyright 2001 convergence integrated media GmbH.
- All rights reserved.
-
- Written by Denis Oliver Kropp <dok@convergence.de> and
- Andreas Hundt <andi@convergence.de>.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#ifndef __DIRECTFBGL_H__
-#define __DIRECTFBGL_H__
-
-#include <directfb.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-
-typedef struct {
- int buffer_size;
- int depth_size;
- int stencil_size;
- int aux_buffers;
-
- int red_size;
- int green_size;
- int blue_size;
- int alpha_size;
-
- int accum_red_size;
- int accum_green_size;
- int accum_blue_size;
- int accum_alpha_size;
-
- DFBBoolean double_buffer;
- DFBBoolean stereo;
-} DFBGLAttributes;
-
-
-DEFINE_INTERFACE( IDirectFBGL,
-
- /** Context handling **/
-
- /*
- * Acquire the hardware lock.
- */
- DFBResult (*Lock) (
- IDirectFBGL *thiz
- );
-
- /*
- * Release the lock.
- */
- DFBResult (*Unlock) (
- IDirectFBGL *thiz
- );
-
- /*
- * Query the OpenGL attributes.
- */
- DFBResult (*GetAttributes) (
- IDirectFBGL *thiz,
- DFBGLAttributes *attributes
- );
-)
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/progs/directfb/.gitignore b/progs/directfb/.gitignore
deleted file mode 100644
index 55d65fb5b0..0000000000
--- a/progs/directfb/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-df_gears
-df_morph3d
-df_reflect
-multi_window
diff --git a/progs/directfb/Makefile b/progs/directfb/Makefile
deleted file mode 100644
index 93c2a7df14..0000000000
--- a/progs/directfb/Makefile
+++ /dev/null
@@ -1,38 +0,0 @@
-# progs/directfb/Makefile
-
-TOP = ../..
-include $(TOP)/configs/current
-
-
-INCDIR = $(TOP)/include -I$(TOP)/progs
-
-LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME)
-
-CFLAGS += $(shell pkg-config --cflags directfb)
-APP_LIB_DEPS += $(shell pkg-config --libs directfb)
-
-LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
-
-PROGS = df_gears \
- df_reflect \
- df_morph3d \
- multi_window
-
-##### RULES #####
-
-.SUFFIXES:
-.SUFFIXES: .c
-
-.c: $(LIB_DEP)
- $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@
-
-
-##### TARGETS #####
-
-default: $(PROGS)
-
-
-clean:
- -rm -f $(PROGS)
- -rm -f *.o *~
-
diff --git a/progs/directfb/df_gears.c b/progs/directfb/df_gears.c
deleted file mode 100644
index c480767bd3..0000000000
--- a/progs/directfb/df_gears.c
+++ /dev/null
@@ -1,480 +0,0 @@
-/*
- (c) Copyright 2001 convergence integrated media GmbH.
- All rights reserved.
-
- Written by Denis Oliver Kropp <dok@convergence.de> and
- Andreas Hundt <andi@convergence.de>.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#include <directfb.h>
-#include <directfbgl.h>
-
-#include <GL/gl.h>
-
-
-/* the super interface */
-IDirectFB *dfb;
-
-/* the primary surface (surface of primary layer) */
-IDirectFBSurface *primary;
-
-/* the GL context */
-IDirectFBGL *primary_gl;
-
-/* our font */
-IDirectFBFont *font;
-
-/* event buffer */
-IDirectFBEventBuffer *events;
-
-/* macro for a safe call to DirectFB functions */
-#define DFBCHECK(x...) \
- { \
- err = x; \
- if (err != DFB_OK) { \
- fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
- DirectFBErrorFatal( #x, err ); \
- } \
- }
-
-static int screen_width, screen_height;
-
-static unsigned long T0 = 0;
-static GLint Frames = 0;
-static GLfloat fps = 0;
-
-static inline unsigned long get_millis()
-{
- struct timeval tv;
-
- gettimeofday (&tv, NULL);
- return (tv.tv_sec * 1000 + tv.tv_usec / 1000);
-}
-
-
-#ifndef M_PI
-#define M_PI 3.14159265
-#endif
-
-/**
-
- 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 GLfloat inc_rotx = 0, inc_roty = 0, inc_rotz = 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();
-}
-
-/* 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(int argc, char *argv[])
-{
- 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};
- GLint i;
-
- 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);
-
- for ( i=1; i<argc; i++ ) {
- if (strcmp(argv[i], "-info")==0) {
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
- printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
- printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
- }
- }
-}
-
-int main( int argc, char *argv[] )
-{
- int quit = 0;
- DFBResult err;
- DFBSurfaceDescription dsc;
-
- DFBCHECK(DirectFBInit( &argc, &argv ));
-
- /* create the super interface */
- DFBCHECK(DirectFBCreate( &dfb ));
-
- /* create an event buffer for all devices with these caps */
- DFBCHECK(dfb->CreateInputEventBuffer( dfb, DICAPS_KEYS | DICAPS_AXES,
- DFB_FALSE, &events ));
-
- /* set our cooperative level to DFSCL_FULLSCREEN
- for exclusive access to the primary layer */
- dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN );
-
- /* get the primary surface, i.e. the surface of the
- primary layer we have exclusive access to */
- dsc.flags = DSDESC_CAPS;
- dsc.caps = DSCAPS_PRIMARY | DSCAPS_DOUBLE;
-
- DFBCHECK(dfb->CreateSurface( dfb, &dsc, &primary ));
-
- /* get the size of the surface and fill it */
- DFBCHECK(primary->GetSize( primary, &screen_width, &screen_height ));
- DFBCHECK(primary->FillRectangle( primary, 0, 0,
- screen_width, screen_height ));
- primary->Flip( primary, NULL, 0 );
-
- /* create the default font and set it */
- DFBCHECK(dfb->CreateFont( dfb, NULL, NULL, &font ));
- DFBCHECK(primary->SetFont( primary, font ));
-
- /* get the GL context */
- DFBCHECK(primary->GetGL( primary, &primary_gl ));
-
- DFBCHECK(primary_gl->Lock( primary_gl ));
-
- init(argc, argv);
- reshape(screen_width, screen_height);
-
- DFBCHECK(primary_gl->Unlock( primary_gl ));
-
- T0 = get_millis();
-
- while (!quit) {
- DFBInputEvent evt;
- unsigned long t;
-
- DFBCHECK(primary_gl->Lock( primary_gl ));
-
- draw();
-
- DFBCHECK(primary_gl->Unlock( primary_gl ));
-
- if (fps) {
- char buf[64];
-
- snprintf(buf, 64, "%4.1f FPS\n", fps);
-
- primary->SetColor( primary, 0xff, 0, 0, 0xff );
- primary->DrawString( primary, buf, -1, screen_width - 5, 5, DSTF_TOPRIGHT );
- }
-
- primary->Flip( primary, NULL, 0 );
- Frames++;
-
-
- t = get_millis();
- if (t - T0 >= 2000) {
- GLfloat seconds = (t - T0) / 1000.0;
-
- fps = Frames / seconds;
-
- T0 = t;
- Frames = 0;
- }
-
-
- while (events->GetEvent( events, DFB_EVENT(&evt) ) == DFB_OK) {
- switch (evt.type) {
- case DIET_KEYPRESS:
- switch (evt.key_symbol) {
- case DIKS_ESCAPE:
- quit = 1;
- break;
- case DIKS_CURSOR_UP:
- inc_rotx = 5.0;
- break;
- case DIKS_CURSOR_DOWN:
- inc_rotx = -5.0;
- break;
- case DIKS_CURSOR_LEFT:
- inc_roty = 5.0;
- break;
- case DIKS_CURSOR_RIGHT:
- inc_roty = -5.0;
- break;
- case DIKS_PAGE_UP:
- inc_rotz = 5.0;
- break;
- case DIKS_PAGE_DOWN:
- inc_rotz = -5.0;
- break;
- default:
- ;
- }
- break;
- case DIET_KEYRELEASE:
- switch (evt.key_symbol) {
- case DIKS_CURSOR_UP:
- inc_rotx = 0;
- break;
- case DIKS_CURSOR_DOWN:
- inc_rotx = 0;
- break;
- case DIKS_CURSOR_LEFT:
- inc_roty = 0;
- break;
- case DIKS_CURSOR_RIGHT:
- inc_roty = 0;
- break;
- case DIKS_PAGE_UP:
- inc_rotz = 0;
- break;
- case DIKS_PAGE_DOWN:
- inc_rotz = 0;
- break;
- default:
- ;
- }
- break;
- case DIET_AXISMOTION:
- if (evt.flags & DIEF_AXISREL) {
- switch (evt.axis) {
- case DIAI_X:
- view_roty += evt.axisrel / 2.0;
- break;
- case DIAI_Y:
- view_rotx += evt.axisrel / 2.0;
- break;
- case DIAI_Z:
- view_rotz += evt.axisrel / 2.0;
- break;
- default:
- ;
- }
- }
- break;
- default:
- ;
- }
- }
-
- angle += 2.0;
-
- view_rotx += inc_rotx;
- view_roty += inc_roty;
- view_rotz += inc_rotz;
- }
-
- /* release our interfaces to shutdown DirectFB */
- primary_gl->Release( primary_gl );
- primary->Release( primary );
- font->Release( font );
- events->Release( events );
- dfb->Release( dfb );
-
- return 0;
-}
-
diff --git a/progs/directfb/df_morph3d.c b/progs/directfb/df_morph3d.c
deleted file mode 100644
index 2730fa6156..0000000000
--- a/progs/directfb/df_morph3d.c
+++ /dev/null
@@ -1,1013 +0,0 @@
-/*
- (c) Copyright 2001 convergence integrated media GmbH.
- All rights reserved.
-
- Written by Denis Oliver Kropp <dok@convergence.de> and
- Andreas Hundt <andi@convergence.de>.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-/*-
- * morph3d.c - Shows 3D morphing objects
- *
- * Converted to GLUT by brianp on 1/1/98
- *
- * This program was inspired on a WindowsNT(R)'s screen saver. It was written
- * from scratch and it was not based on any other source code.
- *
- * Porting it to xlock (the final objective of this code since the moment I
- * decided to create it) was possible by comparing the original Mesa's gear
- * demo with it's ported version, so thanks for Danny Sung for his indirect
- * help (look at gear.c in xlock source tree). NOTE: At the moment this code
- * was sent to Brian Paul for package inclusion, the XLock Version was not
- * available. In fact, I'll wait it to appear on the next Mesa release (If you
- * are reading this, it means THIS release) to send it for xlock package
- * inclusion). It will probably there be a GLUT version too.
- *
- * Thanks goes also to Brian Paul for making it possible and inexpensive
- * to use OpenGL at home.
- *
- * Since I'm not a native english speaker, my apologies for any gramatical
- * mistake.
- *
- * My e-mail addresses are
- *
- * vianna@cat.cbpf.br
- * and
- * marcelo@venus.rdc.puc-rio.br
- *
- * Marcelo F. Vianna (Feb-13-1997)
- */
-
-/*
-This document is VERY incomplete, but tries to describe the mathematics used
-in the program. At this moment it just describes how the polyhedra are
-generated. On futhurer versions, this document will be probabbly improved.
-
-Since I'm not a native english speaker, my apologies for any gramatical
-mistake.
-
-Marcelo Fernandes Vianna
-- Undergraduate in Computer Engeneering at Catholic Pontifical University
-- of Rio de Janeiro (PUC-Rio) Brasil.
-- e-mail: vianna@cat.cbpf.br or marcelo@venus.rdc.puc-rio.br
-- Feb-13-1997
-
-POLYHEDRA GENERATION
-
-For the purpose of this program it's not sufficient to know the polyhedra
-vertexes coordinates. Since the morphing algorithm applies a nonlinear
-transformation over the surfaces (faces) of the polyhedron, each face has
-to be divided into smaller ones. The morphing algorithm needs to transform
-each vertex of these smaller faces individually. It's a very time consoming
-task.
-
-In order to reduce calculation overload, and since all the macro faces of
-the polyhedron are transformed by the same way, the generation is made by
-creating only one face of the polyhedron, morphing it and then rotating it
-around the polyhedron center.
-
-What we need to know is the face radius of the polyhedron (the radius of
-the inscribed sphere) and the angle between the center of two adjacent
-faces using the center of the sphere as the angle's vertex.
-
-The face radius of the regular polyhedra are known values which I decided
-to not waste my time calculating. Following is a table of face radius for
-the regular polyhedra with edge length = 1:
-
- TETRAHEDRON : 1/(2*sqrt(2))/sqrt(3)
- CUBE : 1/2
- OCTAHEDRON : 1/sqrt(6)
- DODECAHEDRON : T^2 * sqrt((T+2)/5) / 2 -> where T=(sqrt(5)+1)/2
- ICOSAHEDRON : (3*sqrt(3)+sqrt(15))/12
-
-I've not found any reference about the mentioned angles, so I needed to
-calculate them, not a trivial task until I figured out how :)
-Curiously these angles are the same for the tetrahedron and octahedron.
-A way to obtain this value is inscribing the tetrahedron inside the cube
-by matching their vertexes. So you'll notice that the remaining unmatched
-vertexes are in the same straight line starting in the cube/tetrahedron
-center and crossing the center of each tetrahedron's face. At this point
-it's easy to obtain the bigger angle of the isosceles triangle formed by
-the center of the cube and two opposite vertexes on the same cube face.
-The edges of this triangle have the following lenghts: sqrt(2) for the base
-and sqrt(3)/2 for the other two other edges. So the angle we want is:
- +-----------------------------------------------------------+
- | 2*ARCSIN(sqrt(2)/sqrt(3)) = 109.47122063449069174 degrees |
- +-----------------------------------------------------------+
-For the cube this angle is obvious, but just for formality it can be
-easily obtained because we also know it's isosceles edge lenghts:
-sqrt(2)/2 for the base and 1/2 for the other two edges. So the angle we
-want is:
- +-----------------------------------------------------------+
- | 2*ARCSIN((sqrt(2)/2)/1) = 90.000000000000000000 degrees |
- +-----------------------------------------------------------+
-For the octahedron we use the same idea used for the tetrahedron, but now
-we inscribe the cube inside the octahedron so that all cubes's vertexes
-matches excatly the center of each octahedron's face. It's now clear that
-this angle is the same of the thetrahedron one:
- +-----------------------------------------------------------+
- | 2*ARCSIN(sqrt(2)/sqrt(3)) = 109.47122063449069174 degrees |
- +-----------------------------------------------------------+
-For the dodecahedron it's a little bit harder because it's only relationship
-with the cube is useless to us. So we need to solve the problem by another
-way. The concept of Face radius also exists on 2D polygons with the name
-Edge radius:
- Edge Radius For Pentagon (ERp)
- ERp = (1/2)/TAN(36 degrees) * VRp = 0.6881909602355867905
- (VRp is the pentagon's vertex radio).
- Face Radius For Dodecahedron
- FRd = T^2 * sqrt((T+2)/5) / 2 = 1.1135163644116068404
-Why we need ERp? Well, ERp and FRd segments forms a 90 degrees angle,
-completing this triangle, the lesser angle is a half of the angle we are
-looking for, so this angle is:
- +-----------------------------------------------------------+
- | 2*ARCTAN(ERp/FRd) = 63.434948822922009981 degrees |
- +-----------------------------------------------------------+
-For the icosahedron we can use the same method used for dodecahedron (well
-the method used for dodecahedron may be used for all regular polyhedra)
- Edge Radius For Triangle (this one is well known: 1/3 of the triangle height)
- ERt = sin(60)/3 = sqrt(3)/6 = 0.2886751345948128655
- Face Radius For Icosahedron
- FRi= (3*sqrt(3)+sqrt(15))/12 = 0.7557613140761707538
-So the angle is:
- +-----------------------------------------------------------+
- | 2*ARCTAN(ERt/FRi) = 41.810314895778596167 degrees |
- +-----------------------------------------------------------+
-
-*/
-
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include <unistd.h>
-
-#include <directfb.h>
-#include <directfbgl.h>
-
-#include <GL/gl.h>
-
-
-/* the super interface */
-IDirectFB *dfb;
-
-/* the primary surface (surface of primary layer) */
-IDirectFBSurface *primary;
-
-/* the GL context */
-IDirectFBGL *primary_gl;
-
-/* our font */
-IDirectFBFont *font;
-
-/* event buffer */
-IDirectFBEventBuffer *events;
-
-/* macro for a safe call to DirectFB functions */
-#define DFBCHECK(x...) \
- { \
- err = x; \
- if (err != DFB_OK) { \
- fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
- DirectFBErrorFatal( #x, err ); \
- } \
- }
-
-static int screen_width, screen_height;
-
-static unsigned long T0 = 0;
-static GLint Frames = 0;
-static GLfloat fps = 0;
-
-static inline unsigned long get_millis()
-{
- struct timeval tv;
-
- gettimeofday (&tv, NULL);
- return (tv.tv_sec * 1000 + tv.tv_usec / 1000);
-}
-
-
-
-#define Scale 0.3
-
-#define VectMul(X1,Y1,Z1,X2,Y2,Z2) (Y1)*(Z2)-(Z1)*(Y2),(Z1)*(X2)-(X1)*(Z2),(X1)*(Y2)-(Y1)*(X2)
-#define sqr(A) ((A)*(A))
-
-/* Increasing this values produces better image quality, the price is speed. */
-/* Very low values produces erroneous/incorrect plotting */
-#define tetradivisions 23
-#define cubedivisions 20
-#define octadivisions 21
-#define dodecadivisions 10
-#define icodivisions 15
-
-#define tetraangle 109.47122063449069174
-#define cubeangle 90.000000000000000000
-#define octaangle 109.47122063449069174
-#define dodecaangle 63.434948822922009981
-#define icoangle 41.810314895778596167
-
-#ifndef Pi
-#define Pi 3.1415926535897932385
-#endif
-#define SQRT2 1.4142135623730951455
-#define SQRT3 1.7320508075688771932
-#define SQRT5 2.2360679774997898051
-#define SQRT6 2.4494897427831778813
-#define SQRT15 3.8729833462074170214
-#define cossec36_2 0.8506508083520399322
-#define cos72 0.3090169943749474241
-#define sin72 0.9510565162951535721
-#define cos36 0.8090169943749474241
-#define sin36 0.5877852522924731292
-
-/*************************************************************************/
-
-static int mono=0;
-static int smooth=1;
-static GLint WindH, WindW;
-static GLfloat step=0;
-static GLfloat seno;
-static int object;
-static int edgedivisions;
-static void (*draw_object)( void );
-static float Magnitude;
-static float *MaterialColor[20];
-
-static float front_shininess[] = {60.0};
-static float front_specular[] = { 0.7, 0.7, 0.7, 1.0 };
-static float ambient[] = { 0.0, 0.0, 0.0, 1.0 };
-static float diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
-static float position0[] = { 1.0, 1.0, 1.0, 0.0 };
-static float position1[] = {-1.0,-1.0, 1.0, 0.0 };
-static float lmodel_ambient[] = { 0.5, 0.5, 0.5, 1.0 };
-static float lmodel_twoside[] = {GL_TRUE};
-
-static float MaterialRed[] = { 0.7, 0.0, 0.0, 1.0 };
-static float MaterialGreen[] = { 0.1, 0.5, 0.2, 1.0 };
-static float MaterialBlue[] = { 0.0, 0.0, 0.7, 1.0 };
-static float MaterialCyan[] = { 0.2, 0.5, 0.7, 1.0 };
-static float MaterialYellow[] = { 0.7, 0.7, 0.0, 1.0 };
-static float MaterialMagenta[] = { 0.6, 0.2, 0.5, 1.0 };
-static float MaterialWhite[] = { 0.7, 0.7, 0.7, 1.0 };
-static float MaterialGray[] = { 0.2, 0.2, 0.2, 1.0 };
-
-#define TRIANGLE(Edge, Amp, Divisions, Z) \
-{ \
- GLfloat Xf,Yf,Xa,Yb,Xf2,Yf2; \
- GLfloat Factor,Factor1,Factor2; \
- GLfloat VertX,VertY,VertZ,NeiAX,NeiAY,NeiAZ,NeiBX,NeiBY,NeiBZ; \
- GLfloat Ax,Ay,Bx; \
- int Ri,Ti; \
- GLfloat Vr=(Edge)*SQRT3/3; \
- GLfloat AmpVr2=(Amp)/sqr(Vr); \
- GLfloat Zf=(Edge)*(Z); \
- \
- Ax=(Edge)*(+0.5/(Divisions)), Ay=(Edge)*(-SQRT3/(2*Divisions)); \
- Bx=(Edge)*(-0.5/(Divisions)); \
- \
- for (Ri=1; Ri<=(Divisions); Ri++) { \
- glBegin(GL_TRIANGLE_STRIP); \
- for (Ti=0; Ti<Ri; Ti++) { \
- Xf=(float)(Ri-Ti)*Ax + (float)Ti*Bx; \
- Yf=Vr+(float)(Ri-Ti)*Ay + (float)Ti*Ay; \
- Xa=Xf+0.001; Yb=Yf+0.001; \
- Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \
- Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
- Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
- VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
- NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
- NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
- glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
- glVertex3f(VertX, VertY, VertZ); \
- \
- Xf=(float)(Ri-Ti-1)*Ax + (float)Ti*Bx; \
- Yf=Vr+(float)(Ri-Ti-1)*Ay + (float)Ti*Ay; \
- Xa=Xf+0.001; Yb=Yf+0.001; \
- Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \
- Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
- Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
- VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
- NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
- NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
- glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
- glVertex3f(VertX, VertY, VertZ); \
- \
- } \
- Xf=(float)Ri*Bx; \
- Yf=Vr+(float)Ri*Ay; \
- Xa=Xf+0.001; Yb=Yf+0.001; \
- Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \
- Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
- Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
- VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
- NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
- NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
- glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
- glVertex3f(VertX, VertY, VertZ); \
- glEnd(); \
- } \
-}
-
-#define SQUARE(Edge, Amp, Divisions, Z) \
-{ \
- int Xi,Yi; \
- GLfloat Xf,Yf,Y,Xf2,Yf2,Y2,Xa,Yb; \
- GLfloat Factor,Factor1,Factor2; \
- GLfloat VertX,VertY,VertZ,NeiAX,NeiAY,NeiAZ,NeiBX,NeiBY,NeiBZ; \
- GLfloat Zf=(Edge)*(Z); \
- GLfloat AmpVr2=(Amp)/sqr((Edge)*SQRT2/2); \
- \
- for (Yi=0; Yi<(Divisions); Yi++) { \
- Yf=-((Edge)/2.0) + ((float)Yi)/(Divisions)*(Edge); \
- Yf2=sqr(Yf); \
- Y=Yf+1.0/(Divisions)*(Edge); \
- Y2=sqr(Y); \
- glBegin(GL_QUAD_STRIP); \
- for (Xi=0; Xi<=(Divisions); Xi++) { \
- Xf=-((Edge)/2.0) + ((float)Xi)/(Divisions)*(Edge); \
- Xf2=sqr(Xf); \
- \
- Xa=Xf+0.001; Yb=Y+0.001; \
- Factor=1-((Xf2+Y2)*AmpVr2); \
- Factor1=1-((sqr(Xa)+Y2)*AmpVr2); \
- Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
- VertX=Factor*Xf; VertY=Factor*Y; VertZ=Factor*Zf; \
- NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Y-VertY; NeiAZ=Factor1*Zf-VertZ; \
- NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
- glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
- glVertex3f(VertX, VertY, VertZ); \
- \
- Xa=Xf+0.001; Yb=Yf+0.001; \
- Factor=1-((Xf2+Yf2)*AmpVr2); \
- Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
- Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
- VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
- NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
- NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
- glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
- glVertex3f(VertX, VertY, VertZ); \
- } \
- glEnd(); \
- } \
-}
-
-#define PENTAGON(Edge, Amp, Divisions, Z) \
-{ \
- int Ri,Ti,Fi; \
- GLfloat Xf,Yf,Xa,Yb,Xf2,Yf2; \
- GLfloat x[6],y[6]; \
- GLfloat Factor,Factor1,Factor2; \
- GLfloat VertX,VertY,VertZ,NeiAX,NeiAY,NeiAZ,NeiBX,NeiBY,NeiBZ; \
- GLfloat Zf=(Edge)*(Z); \
- GLfloat AmpVr2=(Amp)/sqr((Edge)*cossec36_2); \
- \
- for(Fi=0;Fi<6;Fi++) { \
- x[Fi]=-cos( Fi*2*Pi/5 + Pi/10 )/(Divisions)*cossec36_2*(Edge); \
- y[Fi]=sin( Fi*2*Pi/5 + Pi/10 )/(Divisions)*cossec36_2*(Edge); \
- } \
- \
- for (Ri=1; Ri<=(Divisions); Ri++) { \
- for (Fi=0; Fi<5; Fi++) { \
- glBegin(GL_TRIANGLE_STRIP); \
- for (Ti=0; Ti<Ri; Ti++) { \
- Xf=(float)(Ri-Ti)*x[Fi] + (float)Ti*x[Fi+1]; \
- Yf=(float)(Ri-Ti)*y[Fi] + (float)Ti*y[Fi+1]; \
- Xa=Xf+0.001; Yb=Yf+0.001; \
- Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \
- Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
- Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
- VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
- NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
- NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
- glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
- glVertex3f(VertX, VertY, VertZ); \
- \
- Xf=(float)(Ri-Ti-1)*x[Fi] + (float)Ti*x[Fi+1]; \
- Yf=(float)(Ri-Ti-1)*y[Fi] + (float)Ti*y[Fi+1]; \
- Xa=Xf+0.001; Yb=Yf+0.001; \
- Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \
- Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
- Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
- VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
- NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
- NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
- glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
- glVertex3f(VertX, VertY, VertZ); \
- \
- } \
- Xf=(float)Ri*x[Fi+1]; \
- Yf=(float)Ri*y[Fi+1]; \
- Xa=Xf+0.001; Yb=Yf+0.001; \
- Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \
- Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
- Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
- VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
- NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
- NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
- glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
- glVertex3f(VertX, VertY, VertZ); \
- glEnd(); \
- } \
- } \
-}
-
-static void draw_tetra( void )
-{
- GLuint list;
-
- list = glGenLists( 1 );
- glNewList( list, GL_COMPILE );
- TRIANGLE(2,seno,edgedivisions,0.5/SQRT6);
- glEndList();
-
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,0,1);
- glRotatef(-tetraangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+tetraangle,0.5,SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+tetraangle,0.5,-SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]);
- glCallList(list);
-
- glDeleteLists(list,1);
-}
-
-static void draw_cube( void )
-{
- GLuint list;
-
- list = glGenLists( 1 );
- glNewList( list, GL_COMPILE );
- SQUARE(2, seno, edgedivisions, 0.5)
- glEndList();
-
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]);
- glCallList(list);
- glRotatef(cubeangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]);
- glCallList(list);
- glRotatef(cubeangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]);
- glCallList(list);
- glRotatef(cubeangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]);
- glCallList(list);
- glRotatef(cubeangle,0,1,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[4]);
- glCallList(list);
- glRotatef(2*cubeangle,0,1,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[5]);
- glCallList(list);
-
- glDeleteLists(list,1);
-}
-
-static void draw_octa( void )
-{
- GLuint list;
-
- list = glGenLists( 1 );
- glNewList( list, GL_COMPILE );
- TRIANGLE(2,seno,edgedivisions,1/SQRT6);
- glEndList();
-
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,0,1);
- glRotatef(-180+octaangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-octaangle,0.5,SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-octaangle,0.5,-SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[4]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,0,1);
- glRotatef(-180+octaangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[5]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-octaangle,0.5,SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[6]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-octaangle,0.5,-SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[7]);
- glCallList(list);
-
- glDeleteLists(list,1);
-}
-
-static void draw_dodeca( void )
-{
- GLuint list;
-
-#define TAU ((SQRT5+1)/2)
-
- list = glGenLists( 1 );
- glNewList( list, GL_COMPILE );
- PENTAGON(1,seno,edgedivisions,sqr(TAU) * sqrt((TAU+2)/5) / 2);
- glEndList();
-
- glPushMatrix();
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]);
- glCallList(list);
- glRotatef(180,0,0,1);
- glPushMatrix();
- glRotatef(-dodecaangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(-dodecaangle,cos72,sin72,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(-dodecaangle,cos72,-sin72,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(dodecaangle,cos36,-sin36,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[4]);
- glCallList(list);
- glPopMatrix();
- glRotatef(dodecaangle,cos36,sin36,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[5]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[6]);
- glCallList(list);
- glRotatef(180,0,0,1);
- glPushMatrix();
- glRotatef(-dodecaangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[7]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(-dodecaangle,cos72,sin72,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[8]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(-dodecaangle,cos72,-sin72,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[9]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(dodecaangle,cos36,-sin36,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[10]);
- glCallList(list);
- glPopMatrix();
- glRotatef(dodecaangle,cos36,sin36,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[11]);
- glCallList(list);
-
- glDeleteLists(list,1);
-}
-
-static void draw_ico( void )
-{
- GLuint list;
-
- list = glGenLists( 1 );
- glNewList( list, GL_COMPILE );
- TRIANGLE(1.5,seno,edgedivisions,(3*SQRT3+SQRT15)/12);
- glEndList();
-
- glPushMatrix();
-
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,0,1);
- glRotatef(-icoangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,-SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[4]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[5]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,0,0,1);
- glRotatef(-icoangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[6]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,-SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[7]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,-SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[8]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,0,0,1);
- glRotatef(-icoangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[9]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[10]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,0,1);
- glRotatef(-icoangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[11]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[12]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,-SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[13]);
- glCallList(list);
- glPopMatrix();
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[14]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[15]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,0,0,1);
- glRotatef(-icoangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[16]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,-SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[17]);
- glCallList(list);
- glPushMatrix();
- glRotatef(180,0,1,0);
- glRotatef(-180+icoangle,0.5,-SQRT3/2,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[18]);
- glCallList(list);
- glPopMatrix();
- glRotatef(180,0,0,1);
- glRotatef(-icoangle,1,0,0);
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[19]);
- glCallList(list);
-
- glDeleteLists(list,1);
-}
-
-static void draw ( void ) {
- glClear( /*GL_COLOR_BUFFER_BIT |*/ GL_DEPTH_BUFFER_BIT );
-
- glPushMatrix();
-
- glTranslatef( 0.0, 0.0, -10.0 );
- glScalef( Scale*WindH/WindW, Scale, Scale );
- glTranslatef(2.5*WindW/WindH*sin(step*1.11),2.5*cos(step*1.25*1.11),0);
- glRotatef(step*100,1,0,0);
- glRotatef(step*95,0,1,0);
- glRotatef(step*90,0,0,1);
-
- seno=(sin(step)+1.0/3.0)*(4.0/5.0)*Magnitude;
-
- draw_object();
-
- glPopMatrix();
-
- glFlush();
-
- step+=0.05;
-}
-
-static void reshape( int width, int height )
-{
- glViewport(0, 0, WindW=(GLint)width, WindH=(GLint)height);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 );
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void pinit(void)
-{
- switch(object) {
- case 1:
- draw_object=draw_tetra;
- MaterialColor[0]=MaterialRed;
- MaterialColor[1]=MaterialGreen;
- MaterialColor[2]=MaterialBlue;
- MaterialColor[3]=MaterialWhite;
- edgedivisions=tetradivisions;
- Magnitude=2.5;
- break;
- case 2:
- draw_object=draw_cube;
- MaterialColor[0]=MaterialRed;
- MaterialColor[1]=MaterialGreen;
- MaterialColor[2]=MaterialCyan;
- MaterialColor[3]=MaterialMagenta;
- MaterialColor[4]=MaterialYellow;
- MaterialColor[5]=MaterialBlue;
- edgedivisions=cubedivisions;
- Magnitude=2.0;
- break;
- case 3:
- draw_object=draw_octa;
- MaterialColor[0]=MaterialRed;
- MaterialColor[1]=MaterialGreen;
- MaterialColor[2]=MaterialBlue;
- MaterialColor[3]=MaterialWhite;
- MaterialColor[4]=MaterialCyan;
- MaterialColor[5]=MaterialMagenta;
- MaterialColor[6]=MaterialGray;
- MaterialColor[7]=MaterialYellow;
- edgedivisions=octadivisions;
- Magnitude=2.5;
- break;
- case 4:
- draw_object=draw_dodeca;
- MaterialColor[ 0]=MaterialRed;
- MaterialColor[ 1]=MaterialGreen;
- MaterialColor[ 2]=MaterialCyan;
- MaterialColor[ 3]=MaterialBlue;
- MaterialColor[ 4]=MaterialMagenta;
- MaterialColor[ 5]=MaterialYellow;
- MaterialColor[ 6]=MaterialGreen;
- MaterialColor[ 7]=MaterialCyan;
- MaterialColor[ 8]=MaterialRed;
- MaterialColor[ 9]=MaterialMagenta;
- MaterialColor[10]=MaterialBlue;
- MaterialColor[11]=MaterialYellow;
- edgedivisions=dodecadivisions;
- Magnitude=2.0;
- break;
- case 5:
- draw_object=draw_ico;
- MaterialColor[ 0]=MaterialRed;
- MaterialColor[ 1]=MaterialGreen;
- MaterialColor[ 2]=MaterialBlue;
- MaterialColor[ 3]=MaterialCyan;
- MaterialColor[ 4]=MaterialYellow;
- MaterialColor[ 5]=MaterialMagenta;
- MaterialColor[ 6]=MaterialRed;
- MaterialColor[ 7]=MaterialGreen;
- MaterialColor[ 8]=MaterialBlue;
- MaterialColor[ 9]=MaterialWhite;
- MaterialColor[10]=MaterialCyan;
- MaterialColor[11]=MaterialYellow;
- MaterialColor[12]=MaterialMagenta;
- MaterialColor[13]=MaterialRed;
- MaterialColor[14]=MaterialGreen;
- MaterialColor[15]=MaterialBlue;
- MaterialColor[16]=MaterialCyan;
- MaterialColor[17]=MaterialYellow;
- MaterialColor[18]=MaterialMagenta;
- MaterialColor[19]=MaterialGray;
- edgedivisions=icodivisions;
- Magnitude=2.5;
- break;
- }
- if (mono) {
- int loop;
- for (loop=0; loop<20; loop++) MaterialColor[loop]=MaterialGray;
- }
- if (smooth) {
- glShadeModel( GL_SMOOTH );
- } else {
- glShadeModel( GL_FLAT );
- }
-
-}
-
-static void init(void)
-{
- printf("Morph 3D - Shows morphing platonic polyhedra\n");
- printf("Author: Marcelo Fernandes Vianna (vianna@cat.cbpf.br)\n\n");
- printf(" [1] - Tetrahedron\n");
- printf(" [2] - Hexahedron (Cube)\n");
- printf(" [3] - Octahedron\n");
- printf(" [4] - Dodecahedron\n");
- printf(" [5] - Icosahedron\n");
- printf("[SPACE] - Toggle colored faces\n");
- printf("[RETURN] - Toggle smooth/flat shading\n");
- printf(" [ESC] - Quit\n");
-
- object=1;
-
- glClearDepth(1.0);
- glClearColor( 0.0, 0.0, 0.0, 0.0 );
- glColor3f( 1.0, 1.0, 1.0 );
-
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
- glFlush();
- primary->Flip( primary, NULL, 0 );
-
- glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
- glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
- glLightfv(GL_LIGHT0, GL_POSITION, position0);
- glLightfv(GL_LIGHT1, GL_AMBIENT, ambient);
- glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse);
- glLightfv(GL_LIGHT1, GL_POSITION, position1);
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
- glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_LIGHT1);
- glEnable(GL_DEPTH_TEST);
- glEnable(GL_NORMALIZE);
-
- glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, front_shininess);
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, front_specular);
-
- glHint(GL_FOG_HINT, GL_FASTEST);
- glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
- glHint(GL_POLYGON_SMOOTH_HINT, GL_FASTEST);
-
- pinit();
-}
-
-int main( int argc, char *argv[] )
-{
- int quit = 0;
- DFBResult err;
- DFBSurfaceDescription dsc;
-
- DFBCHECK(DirectFBInit( &argc, &argv ));
-
- /* create the super interface */
- DFBCHECK(DirectFBCreate( &dfb ));
-
- /* create an event buffer for all devices with these caps */
- DFBCHECK(dfb->CreateInputEventBuffer( dfb, DICAPS_KEYS, DFB_FALSE, &events ));
-
- /* set our cooperative level to DFSCL_FULLSCREEN
- for exclusive access to the primary layer */
- dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN );
-
- /* get the primary surface, i.e. the surface of the
- primary layer we have exclusive access to */
- dsc.flags = DSDESC_CAPS;
- dsc.caps = DSCAPS_PRIMARY | DSCAPS_DOUBLE;
-
- DFBCHECK(dfb->CreateSurface( dfb, &dsc, &primary ));
-
- /* get the size of the surface and fill it */
- DFBCHECK(primary->GetSize( primary, &screen_width, &screen_height ));
- DFBCHECK(primary->FillRectangle( primary, 0, 0,
- screen_width, screen_height ));
-
- /* create the default font and set it */
- DFBCHECK(dfb->CreateFont( dfb, NULL, NULL, &font ));
- DFBCHECK(primary->SetFont( primary, font ));
-
- /* get the GL context */
- DFBCHECK(primary->GetGL( primary, &primary_gl ));
-
- DFBCHECK(primary_gl->Lock( primary_gl ));
-
- init();
- reshape(screen_width, screen_height);
-
- DFBCHECK(primary_gl->Unlock( primary_gl ));
-
- T0 = get_millis();
-
- while (!quit) {
- DFBInputEvent evt;
- unsigned long t;
-
- primary->Clear( primary, 0, 0, 0, 0 );
-
- DFBCHECK(primary_gl->Lock( primary_gl ));
-
- draw();
-
- DFBCHECK(primary_gl->Unlock( primary_gl ));
-
- if (fps) {
- char buf[64];
-
- sprintf(buf, "%4.1f FPS\n", fps);
- primary->SetColor( primary, 0xff, 0, 0, 0xff );
- primary->DrawString( primary, buf, -1, screen_width - 5, 5, DSTF_TOPRIGHT );
- }
-
- primary->Flip( primary, NULL, 0 );
- Frames++;
-
-
- t = get_millis();
- if (t - T0 >= 1000) {
- GLfloat seconds = (t - T0) / 1000.0;
-
- fps = Frames / seconds;
-
- T0 = t;
- Frames = 0;
- }
-
-
- while (events->GetEvent( events, DFB_EVENT(&evt) ) == DFB_OK) {
- switch (evt.type) {
- case DIET_KEYPRESS:
- switch (evt.key_symbol) {
- case DIKS_ESCAPE:
- quit = 1;
- break;
- case DIKS_1: object=1; break;
- case DIKS_2: object=2; break;
- case DIKS_3: object=3; break;
- case DIKS_4: object=4; break;
- case DIKS_5: object=5; break;
- case DIKS_SPACE: mono^=1; break;
- case DIKS_ENTER: smooth^=1; break;
- default:
- ;
- }
- pinit();
- break;
- default:
- ;
- }
- }
- }
-
- /* release our interfaces to shutdown DirectFB */
- primary_gl->Release( primary_gl );
- primary->Release( primary );
- font->Release( font );
- events->Release( events );
- dfb->Release( dfb );
-
- return 0;
-}
-
diff --git a/progs/directfb/df_reflect.c b/progs/directfb/df_reflect.c
deleted file mode 100644
index a0e789c387..0000000000
--- a/progs/directfb/df_reflect.c
+++ /dev/null
@@ -1,489 +0,0 @@
-/*
- (c) Copyright 2001 convergence integrated media GmbH.
- All rights reserved.
-
- Written by Denis Oliver Kropp <dok@convergence.de> and
- Andreas Hundt <andi@convergence.de>.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#include <directfb.h>
-#include <directfbgl.h>
-
-#include <GL/glu.h>
-
-#include "util/showbuffer.c"
-#include "util/readtex.c"
-
-
-/* the super interface */
-IDirectFB *dfb;
-
-/* the primary surface (surface of primary layer) */
-IDirectFBSurface *primary;
-
-/* the GL context */
-IDirectFBGL *primary_gl;
-
-/* our font */
-IDirectFBFont *font;
-
-/* event buffer */
-IDirectFBEventBuffer *events;
-
-/* macro for a safe call to DirectFB functions */
-#define DFBCHECK(x...) \
- { \
- err = x; \
- if (err != DFB_OK) { \
- fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
- DirectFBErrorFatal( #x, err ); \
- } \
- }
-
-static int screen_width, screen_height;
-
-static unsigned long T0 = 0;
-static GLint Frames = 0;
-static GLfloat fps = 0;
-
-static inline unsigned long get_millis()
-{
- struct timeval tv;
-
- gettimeofday (&tv, NULL);
- return (tv.tv_sec * 1000 + tv.tv_usec / 1000);
-}
-
-/*******************************/
-
-#define DEG2RAD (3.14159/180.0)
-
-#define TABLE_TEXTURE "../images/tile.rgb"
-
-static GLint ImgWidth, ImgHeight;
-static GLenum ImgFormat;
-static GLubyte *Image = NULL;
-
-#define MAX_OBJECTS 2
-static GLint table_list;
-static GLint objects_list[MAX_OBJECTS];
-
-static GLfloat xrot, yrot;
-static GLfloat spin;
-
-static GLint Width = 400, Height = 300;
-static GLenum ShowBuffer = GL_NONE;
-
-
-static void make_table( void )
-{
- static GLfloat table_mat[] = { 1.0, 1.0, 1.0, 0.6 };
- static GLfloat gray[] = { 0.4, 0.4, 0.4, 1.0 };
-
- table_list = glGenLists(1);
- glNewList( table_list, GL_COMPILE );
-
- /* load table's texture */
- glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, table_mat );
-/* glMaterialfv( GL_FRONT, GL_EMISSION, gray );*/
- glMaterialfv( GL_FRONT, GL_DIFFUSE, table_mat );
- glMaterialfv( GL_FRONT, GL_AMBIENT, gray );
-
- /* draw textured square for the table */
- glPushMatrix();
- glScalef( 4.0, 4.0, 4.0 );
- glBegin( GL_POLYGON );
- glNormal3f( 0.0, 1.0, 0.0 );
- glTexCoord2f( 0.0, 0.0 ); glVertex3f( -1.0, 0.0, 1.0 );
- glTexCoord2f( 1.0, 0.0 ); glVertex3f( 1.0, 0.0, 1.0 );
- glTexCoord2f( 1.0, 1.0 ); glVertex3f( 1.0, 0.0, -1.0 );
- glTexCoord2f( 0.0, 1.0 ); glVertex3f( -1.0, 0.0, -1.0 );
- glEnd();
- glPopMatrix();
-
- glDisable( GL_TEXTURE_2D );
-
- glEndList();
-}
-
-
-static void make_objects( void )
-{
- GLUquadricObj *q;
-
- static GLfloat cyan[] = { 0.0, 1.0, 1.0, 1.0 };
- static GLfloat green[] = { 0.2, 1.0, 0.2, 1.0 };
- static GLfloat black[] = { 0.0, 0.0, 0.0, 0.0 };
-
- q = gluNewQuadric();
- gluQuadricDrawStyle( q, GLU_FILL );
- gluQuadricNormals( q, GLU_SMOOTH );
-
- objects_list[0] = glGenLists(1);
- glNewList( objects_list[0], GL_COMPILE );
- glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, cyan );
- glMaterialfv( GL_FRONT, GL_EMISSION, black );
- gluCylinder( q, 0.5, 0.5, 1.0, 15, 1 );
- glEndList();
-
- objects_list[1] = glGenLists(1);
- glNewList( objects_list[1], GL_COMPILE );
- glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green );
- glMaterialfv( GL_FRONT, GL_EMISSION, black );
- gluCylinder( q, 1.5, 0.0, 2.5, 15, 1 );
- glEndList();
-}
-
-
-static void init( void )
-{
- make_table();
- make_objects();
-
- Image = LoadRGBImage( TABLE_TEXTURE, &ImgWidth, &ImgHeight, &ImgFormat );
- if (!Image) {
- printf("Couldn't read %s\n", TABLE_TEXTURE);
- exit(0);
- }
-
- gluBuild2DMipmaps(GL_TEXTURE_2D, 3, ImgWidth, ImgHeight,
- ImgFormat, GL_UNSIGNED_BYTE, Image);
-
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
-
- xrot = 30.0;
- yrot = 50.0;
- spin = 0.0;
-
- glShadeModel( GL_FLAT );
-
- glEnable( GL_LIGHT0 );
- glEnable( GL_LIGHTING );
-
- glClearColor( 0.5, 0.5, 0.9, 0.0 );
-
- glEnable( GL_NORMALIZE );
-}
-
-
-
-static void reshape(int w, int h)
-{
- GLfloat yAspect = 2.5;
- GLfloat xAspect = yAspect * (float) w / (float) h;
- Width = w;
- Height = h;
- glViewport(0, 0, w, h);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glFrustum( -xAspect, xAspect, -yAspect, yAspect, 10.0, 30.0 );
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-}
-
-
-
-static void draw_objects( GLfloat eyex, GLfloat eyey, GLfloat eyez )
-{
- (void) eyex;
- (void) eyey;
- (void) eyez;
-#ifndef USE_ZBUFFER
- if (eyex<0.5) {
-#endif
- glPushMatrix();
- glTranslatef( 1.0, 1.5, 0.0 );
- glRotatef( spin, 1.0, 0.5, 0.0 );
- glRotatef( 0.5*spin, 0.0, 0.5, 1.0 );
- glCallList( objects_list[0] );
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef( -1.0, 0.85+3.0*fabs( cos(0.01*spin) ), 0.0 );
- glRotatef( 0.5*spin, 0.0, 0.5, 1.0 );
- glRotatef( spin, 1.0, 0.5, 0.0 );
- glScalef( 0.5, 0.5, 0.5 );
- glCallList( objects_list[1] );
- glPopMatrix();
-#ifndef USE_ZBUFFER
- }
- else {
- glPushMatrix();
- glTranslatef( -1.0, 0.85+3.0*fabs( cos(0.01*spin) ), 0.0 );
- glRotatef( 0.5*spin, 0.0, 0.5, 1.0 );
- glRotatef( spin, 1.0, 0.5, 0.0 );
- glScalef( 0.5, 0.5, 0.5 );
- glCallList( objects_list[1] );
- glPopMatrix();
-
- glPushMatrix();
- glTranslatef( 1.0, 1.5, 0.0 );
- glRotatef( spin, 1.0, 0.5, 0.0 );
- glRotatef( 0.5*spin, 0.0, 0.5, 1.0 );
- glCallList( objects_list[0] );
- glPopMatrix();
- }
-#endif
-}
-
-
-
-static void draw_table( void )
-{
- glCallList( table_list );
-}
-
-
-
-static void draw( void )
-{
- static GLfloat light_pos[] = { 0.0, 20.0, 0.0, 1.0 };
- GLfloat dist = 20.0;
- GLfloat eyex, eyey, eyez;
-
- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
-
-
- eyex = dist * cos(yrot*DEG2RAD) * cos(xrot*DEG2RAD);
- eyez = dist * sin(yrot*DEG2RAD) * cos(xrot*DEG2RAD);
- eyey = dist * sin(xrot*DEG2RAD);
-
- /* view from top */
- glPushMatrix();
- gluLookAt( eyex, eyey, eyez, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 );
-
- glLightfv( GL_LIGHT0, GL_POSITION, light_pos );
-
- /* draw table into stencil planes */
- glDisable( GL_DEPTH_TEST );
- glEnable( GL_STENCIL_TEST );
- glStencilFunc( GL_ALWAYS, 1, 0xffffffff );
- glStencilOp( GL_REPLACE, GL_REPLACE, GL_REPLACE );
- glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
- draw_table();
- glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
-
- glEnable( GL_DEPTH_TEST );
-
- /* render view from below (reflected viewport) */
- /* only draw where stencil==1 */
- if (eyey>0.0) {
- glPushMatrix();
-
- glStencilFunc( GL_EQUAL, 1, 0xffffffff ); /* draw if ==1 */
- glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP );
- glScalef( 1.0, -1.0, 1.0 );
-
- /* Reposition light in reflected space. */
- glLightfv(GL_LIGHT0, GL_POSITION, light_pos);
-
- draw_objects(eyex, eyey, eyez);
- glPopMatrix();
-
- /* Restore light's original unreflected position. */
- glLightfv(GL_LIGHT0, GL_POSITION, light_pos);
- }
-
- glDisable( GL_STENCIL_TEST );
-
- glEnable( GL_BLEND );
- glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
-
- glEnable( GL_TEXTURE_2D );
- draw_table();
- glDisable( GL_TEXTURE_2D );
- glDisable( GL_BLEND );
-
- /* view from top */
- glPushMatrix();
-
- draw_objects(eyex, eyey, eyez);
-
- glPopMatrix();
-
- glPopMatrix();
-
- if (ShowBuffer == GL_DEPTH) {
- ShowDepthBuffer(Width, Height, 1.0, 0.0);
- }
- else if (ShowBuffer == GL_STENCIL) {
- ShowStencilBuffer(Width, Height, 255.0, 0.0);
- }
- else if (ShowBuffer == GL_ALPHA) {
- ShowAlphaBuffer(Width, Height);
- }
-}
-
-/*******************************/
-
-int main( int argc, char *argv[] )
-{
- int quit = 0;
- DFBResult err;
- DFBSurfaceDescription dsc;
-
- DFBCHECK(DirectFBInit( &argc, &argv ));
-
- /* create the super interface */
- DFBCHECK(DirectFBCreate( &dfb ));
-
- /* create an event buffer for all devices with these caps */
- DFBCHECK(dfb->CreateInputEventBuffer( dfb, DICAPS_ALL, DFB_FALSE, &events ));
-
- /* set our cooperative level to DFSCL_FULLSCREEN
- for exclusive access to the primary layer */
- dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN );
-
- /* get the primary surface, i.e. the surface of the
- primary layer we have exclusive access to */
- dsc.flags = DSDESC_CAPS;
- dsc.caps = (DFBSurfaceCapabilities)(DSCAPS_PRIMARY | DSCAPS_DOUBLE);
-
- DFBCHECK(dfb->CreateSurface( dfb, &dsc, &primary ));
-
- /* get the size of the surface and fill it */
- DFBCHECK(primary->GetSize( primary, &screen_width, &screen_height ));
- DFBCHECK(primary->FillRectangle( primary, 0, 0,
- screen_width, screen_height ));
-
- /* create the default font and set it */
- DFBCHECK(dfb->CreateFont( dfb, NULL, NULL, &font ));
- DFBCHECK(primary->SetFont( primary, font ));
-
- /* get the GL context */
- DFBCHECK(primary->GetGL( primary, &primary_gl ));
-
- DFBCHECK(primary_gl->Lock( primary_gl ));
-
- init();
- reshape(screen_width, screen_height);
-
- DFBCHECK(primary_gl->Unlock( primary_gl ));
-
- T0 = get_millis();
-
- while (!quit) {
- DFBInputEvent evt;
- unsigned long t;
-
- DFBCHECK(primary_gl->Lock( primary_gl ));
-
- draw();
-
- DFBCHECK(primary_gl->Unlock( primary_gl ));
-
- if (fps) {
- char buf[64];
-
- sprintf(buf, "%4.1f FPS\n", fps);
- primary->SetColor( primary, 0xff, 0, 0, 0xff );
- primary->DrawString( primary, buf, -1, screen_width - 5, 5, DSTF_TOPRIGHT );
- }
-
- primary->Flip( primary, NULL, (DFBSurfaceFlipFlags)0 );
- Frames++;
-
-
- t = get_millis();
- if (t - T0 >= 1000) {
- GLfloat seconds = (t - T0) / 1000.0;
-
- fps = Frames / seconds;
-
- T0 = t;
- Frames = 0;
- }
-
-
- while (events->GetEvent( events, DFB_EVENT(&evt) ) == DFB_OK) {
- switch (evt.type) {
- case DIET_KEYPRESS:
- switch (DFB_LOWER_CASE(evt.key_symbol)) {
- case DIKS_ESCAPE:
- quit = 1;
- break;
- case DIKS_CURSOR_UP:
- xrot += 3.0;
- if ( xrot > 85 )
- xrot = 85;
- break;
- case DIKS_CURSOR_DOWN:
- xrot -= 3.0;
- if ( xrot < 5 )
- xrot = 5;
- break;
- case DIKS_CURSOR_LEFT:
- yrot += 3.0;
- break;
- case DIKS_CURSOR_RIGHT:
- yrot -= 3.0;
- break;
- case DIKS_SMALL_D:
- ShowBuffer = GL_DEPTH;
- break;
- case DIKS_SMALL_S:
- ShowBuffer = GL_STENCIL;
- break;
- case DIKS_SMALL_A:
- ShowBuffer = GL_ALPHA;
- break;
- default:
- ShowBuffer = GL_NONE;
- }
- break;
- case DIET_AXISMOTION:
- if (evt.flags & DIEF_AXISREL) {
- switch (evt.axis) {
- case DIAI_X:
- yrot += evt.axisrel / 2.0;
- break;
- case DIAI_Y:
- xrot += evt.axisrel / 2.0;
- break;
- default:
- ;
- }
- }
- break;
- default:
- ;
- }
- }
-
- spin += 2.0;
- yrot += 3.0;
- }
-
- /* release our interfaces to shutdown DirectFB */
- primary_gl->Release( primary_gl );
- primary->Release( primary );
- font->Release( font );
- events->Release( events );
- dfb->Release( dfb );
-
- return 0;
-}
-
diff --git a/progs/directfb/multi_window.c b/progs/directfb/multi_window.c
deleted file mode 100644
index 9bb0e4be8e..0000000000
--- a/progs/directfb/multi_window.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- (c) Copyright 2001 convergence integrated media GmbH.
- All rights reserved.
-
- Written by Denis Oliver Kropp <dok@convergence.de> and
- Andreas Hundt <andi@convergence.de>.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include <directfb.h>
-#include <directfbgl.h>
-
-
-typedef struct {
- IDirectFBWindow *window;
- IDirectFBSurface *surface;
- IDirectFBGL *gl;
-
- int width;
- int height;
-
- unsigned long last_time;
- int frames;
- float fps;
-} Context;
-
-static const GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0};
-
-static IDirectFB *dfb;
-static IDirectFBDisplayLayer *layer;
-static IDirectFBFont *font;
-static IDirectFBEventBuffer *events = NULL;
-
-/* macro for a safe call to DirectFB functions */
-#define DFBCHECK(x...) \
- do { \
- ret = x; \
- if (ret != DFB_OK) { \
- fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
- DirectFBErrorFatal( #x, ret ); \
- } \
- } while (0)
-
-
-static inline unsigned long get_millis()
-{
- struct timeval tv;
-
- gettimeofday (&tv, NULL);
- return (tv.tv_sec * 1000 + tv.tv_usec / 1000);
-}
-
-
-static void
-setup( Context *context )
-{
- GLfloat pos[4] = {5.0, 5.0, 10.0, 0.0};
-
- context->surface->GetSize( context->surface,
- &context->width, &context->height );
-
- context->gl->Lock( context->gl );
-
- glLightfv(GL_LIGHT0, GL_POSITION, pos);
- glEnable(GL_CULL_FACE);
- glEnable(GL_LIGHTING);
- glEnable(GL_LIGHT0);
- glEnable(GL_DEPTH_TEST);
-
- glViewport(0, 0, context->width, context->height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(70.0, context->width / (float) context->height, 1.0, 80.0);
-
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0, 0.0, -40.0);
-
- context->gl->Unlock( context->gl );
-}
-
-static void
-update( Context *context )
-{
- unsigned long t;
- IDirectFBSurface *surface = context->surface;
- static __u8 r = 0, g = 0, b = 0;
-
-
- context->gl->Lock( context->gl );
-
- glClearColor( r++/255.0, g++/255.0, b++/255.0, 1.0 );
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- context->gl->Unlock( context->gl );
-
- if (context->fps) {
- char buf[16];
-
- snprintf(buf, sizeof(buf), "%.1f FPS\n", context->fps);
-
- surface->SetColor( surface, 0xff, 0x00, 0x00, 0xff );
- surface->DrawString( surface, buf, -1,
- context->width - 5, 5, DSTF_TOPRIGHT );
- }
-
- surface->Flip( surface, NULL, 0 );
-
- context->frames++;
-
- t = get_millis();
- if (t - context->last_time >= 2000) {
- float seconds = (t - context->last_time) / 1000.0f;
-
- context->fps = context->frames / seconds;
-
- context->last_time = t;
- context->frames = 0;
- }
-}
-
-int
-main( int argc, char *argv[] )
-{
- DFBResult ret;
- int i;
- int quit = 0;
- const int num = 2;
- Context contexts[num];
-
- DFBCHECK(DirectFBInit( &argc, &argv ));
-
- /* create the super interface */
- DFBCHECK(DirectFBCreate( &dfb ));
-
- DFBCHECK(dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer ));
-
- /* create the default font */
- DFBCHECK(dfb->CreateFont( dfb, NULL, NULL, &font ));
-
- for (i=0; i<num; i++) {
- IDirectFBWindow *window;
- IDirectFBSurface *surface;
- IDirectFBGL *gl;
- DFBWindowDescription desc;
-
- desc.flags = DWDESC_POSX | DWDESC_POSY |
- DWDESC_WIDTH | DWDESC_HEIGHT;
- desc.posx = (i%3) * 200 + 10;
- desc.posy = (i/3) * 200 + 10;
- desc.width = 180;
- desc.height = 180;
-
- DFBCHECK(layer->CreateWindow( layer, &desc, &window ));
- DFBCHECK(window->GetSurface( window, &surface ));
- DFBCHECK(surface->GetGL( surface, &gl ));
-
- contexts[i].window = window;
- contexts[i].surface = surface;
- contexts[i].gl = gl;
-
- contexts[i].last_time = get_millis();
- contexts[i].frames = 0;
- contexts[i].fps = 0;
-
- setup( &contexts[i] );
-
- if (events)
- DFBCHECK(window->AttachEventBuffer( window, events ));
- else
- DFBCHECK(window->CreateEventBuffer( window, &events ));
-
- DFBCHECK(surface->SetFont( surface, font ));
-
- window->SetOpacity( window, 0xff );
- }
-
- while (!quit) {
- DFBWindowEvent evt;
-
- for (i=0; i<num; i++)
- update( &contexts[i] );
-
- while (events->GetEvent( events, DFB_EVENT(&evt) ) == DFB_OK) {
- switch (evt.type) {
- case DWET_KEYDOWN:
- switch (evt.key_symbol) {
- case DIKS_ESCAPE:
- quit = 1;
- break;
-
- default:
- break;
- }
- break;
-
- default:
- break;
- }
- }
- }
-
- events->Release( events );
-
- for (i=0; i<num; i++) {
- contexts[i].gl->Release( contexts[i].gl );
- contexts[i].surface->Release( contexts[i].surface );
- contexts[i].window->Release( contexts[i].window );
- }
-
- font->Release( font );
- layer->Release( layer );
- dfb->Release( dfb );
-
- return 0;
-}
-
diff --git a/src/glut/directfb/Makefile b/src/glut/directfb/Makefile
deleted file mode 100644
index bf93d63e30..0000000000
--- a/src/glut/directfb/Makefile
+++ /dev/null
@@ -1,87 +0,0 @@
-# subset glut
-
-TOP = ../../..
-include $(TOP)/configs/current
-
-MARK = $(TOP)/src/glut/glx
-
-GLUT_MAJOR = 3
-GLUT_MINOR = 7
-GLUT_TINY = 1
-
-INCLUDES = -I$(TOP)/include -I$(MARK) $(shell pkg-config --cflags directfb)
-
-GLUT_LIB_DEPS += $(shell pkg-config --libs directfb)
-
-CORE_SOURCES = \
- callback.c \
- color.c \
- cursor.c \
- ext.c \
- events.c \
- font.c \
- game.c \
- globals.c \
- init.c \
- menu.c \
- models.c \
- overlay.c \
- state.c \
- teapot.c \
- window.c \
-
-
-MARK_SOURCES = \
- $(MARK)/glut_8x13.c \
- $(MARK)/glut_9x15.c \
- $(MARK)/glut_hel10.c \
- $(MARK)/glut_hel12.c \
- $(MARK)/glut_hel18.c \
- $(MARK)/glut_tr10.c \
- $(MARK)/glut_tr24.c
-
-SOURCES = $(CORE_SOURCES) $(MARK_SOURCES)
-
-OBJECTS = $(SOURCES:.c=.o)
-
-
-##### RULES #####
-
-.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-.S.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
-
-
-##### TARGETS #####
-
-default: depend $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
-
-
-# Make the library
-$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
- $(MKLIB) -o $(GLUT_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
- -major $(GLUT_MAJOR) -minor $(GLUT_MINOR) -patch $(GLUT_TINY) \
- $(GLUT_LIB_DEPS) -install $(TOP)/$(LIB_DIR) \
- $(MKLIB_OPTIONS) $(OBJECTS)
-
-
-# Run 'make -f Makefile.solo dep' to update the dependencies if you change
-# what's included by any source file.
-depend: $(SOURCES)
- rm -f depend
- touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) > /dev/null
-
-# Emacs tags
-tags:
- etags `find . -name \*.[ch]` `find ../include`
-
-
-# Remove .o and backup files
-clean: depend
- -rm -f depend depend.bak
- -rm -f *.o *~ *.o *~ *.so libglut.so.3.7
-
-include depend
diff --git a/src/glut/directfb/NOTES b/src/glut/directfb/NOTES
deleted file mode 100644
index af917c6667..0000000000
--- a/src/glut/directfb/NOTES
+++ /dev/null
@@ -1,9 +0,0 @@
-DirectFB GLUT Implementation NOTES
-----------------------------------
-
-* To have high performance rendering, it's really important to
- use glutEnterGameMode() instead of glutCreateWindow()/glutFullScreen().
- You can also force a windowed application to game mode by setting
- the environment variable "__GLUT_GAME_MODE".
-
-
diff --git a/src/glut/directfb/callback.c b/src/glut/directfb/callback.c
deleted file mode 100644
index 7c9768aac0..0000000000
--- a/src/glut/directfb/callback.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/time.h>
-
-#include "internal.h"
-
-
-typedef void (GLUTCALLBACK *__GlutTimerCallback) ( int value );
-
-typedef struct __GlutTimer_s {
- struct timeval interval;
- struct timeval expire;
-
- __GlutTimerCallback func;
- int value;
-
- struct __GlutTimer_s *next;
-} __GlutTimer;
-
-/*****************************************************************************/
-
-static __GlutTimer *g_timers = NULL;
-
-/*****************************************************************************/
-
-
-void GLUTAPIENTRY
-glutDisplayFunc( void (GLUTCALLBACK *func) (void) )
-{
- display_func = func;
-}
-
-
-void GLUTAPIENTRY
-glutReshapeFunc( void (GLUTCALLBACK *func) (int width, int height) )
-{
- reshape_func = func;
-}
-
-
-void GLUTAPIENTRY
-glutKeyboardFunc( void (GLUTCALLBACK *func) (unsigned char key, int x, int y) )
-{
- keyboard_func = func;
-}
-
-
-void GLUTAPIENTRY
-glutMouseFunc( void (GLUTCALLBACK *func) (int button, int state, int x, int y) )
-{
- mouse_func = func;
-}
-
-
-void GLUTAPIENTRY
-glutMotionFunc( void (GLUTCALLBACK *func) (int x, int y) )
-{
- motion_func = func;
-}
-
-
-void GLUTAPIENTRY
-glutPassiveMotionFunc( void (GLUTCALLBACK *func) (int x, int y) )
-{
- passive_motion_func = func;
-}
-
-
-void GLUTAPIENTRY
-glutEntryFunc( void (GLUTCALLBACK *func) (int state) )
-{
- entry_func = func;
-}
-
-
-void GLUTAPIENTRY
-glutVisibilityFunc( void (GLUTCALLBACK *func) (int state) )
-{
- visibility_func = func;
-}
-
-
-void GLUTAPIENTRY
-glutMenuStateFunc( void (GLUTCALLBACK *func) (int state) )
-{
- menu_state_func = func;
-}
-
-
-void GLUTAPIENTRY
-glutSpecialFunc( void (GLUTCALLBACK *func) (int key, int x, int y) )
-{
- special_func = func;
-}
-
-
-void GLUTAPIENTRY
-glutSpaceballMotionFunc( void (GLUTCALLBACK *func) (int x, int y, int z) )
-{
-}
-
-
-void GLUTAPIENTRY
-glutSpaceballRotateFunc( void (GLUTCALLBACK *func) (int x, int y, int z) )
-{
-}
-
-
-void GLUTAPIENTRY
-glutSpaceballButtonFunc( void (GLUTCALLBACK *func) (int button, int state) )
-{
-}
-
-
-void GLUTAPIENTRY
-glutButtonBoxFunc( void (GLUTCALLBACK *func) (int button, int state) )
-{
-}
-
-
-void GLUTAPIENTRY
-glutDialsFunc( void (GLUTCALLBACK *func) (int dial, int value) )
-{
-}
-
-
-void GLUTAPIENTRY
-glutTabletMotionFunc( void (GLUTCALLBACK *func) (int x, int y) )
-{
-}
-
-
-void GLUTAPIENTRY
-glutTabletButtonFunc( void (GLUTCALLBACK *func) (int button, int state, int x, int y) )
-{
-}
-
-
-void GLUTAPIENTRY
-glutMenuStatusFunc( void (GLUTCALLBACK *func) (int status, int x, int y) )
-{
-}
-
-
-void GLUTAPIENTRY
-glutOverlayDisplayFunc( void (GLUTCALLBACK *func) (void) )
-{
-}
-
-
-void GLUTAPIENTRY
-glutWindowStatusFunc( void (GLUTCALLBACK *func) (int state) )
-{
-}
-
-
-void GLUTAPIENTRY
-glutKeyboardUpFunc( void (GLUTCALLBACK *func) (unsigned char key, int x, int y) )
-{
- keyboard_up_func = func;
-}
-
-
-void GLUTAPIENTRY
-glutSpecialUpFunc( void (GLUTCALLBACK *func) (int key, int x, int y) )
-{
- special_up_func = func;
-}
-
-
-void GLUTAPIENTRY
-glutJoystickFunc( void (GLUTCALLBACK *func)(unsigned int buttons, int x, int y, int z), int pollInterval )
-{
- joystick_func = func;
- /* FIXME: take care of pollInterval */
-}
-
-
-void GLUTAPIENTRY
-glutIdleFunc( void (GLUTCALLBACK *func) (void) )
-{
- idle_func = func;
-}
-
-
-void GLUTAPIENTRY
-glutTimerFunc( unsigned int msec, void (GLUTCALLBACK *func) (int value), int value )
-{
- __GlutTimer *timer;
-
- if (!func)
- return;
-
- timer = calloc( 1, sizeof(__GlutTimer) );
- if (!timer)
- __glutFatalError( "out of memory" );
-
- timer->interval.tv_sec = msec / 1000;
- timer->interval.tv_usec = (msec % 1000) * 1000;
-
- gettimeofday( &timer->expire, NULL );
- timer->expire.tv_usec += timer->interval.tv_usec;
- timer->expire.tv_sec += timer->interval.tv_sec + timer->expire.tv_usec/1000000;
- timer->expire.tv_usec %= 1000000;
-
- timer->func = func;
- timer->value = value;
-
- timer->next = g_timers;
- g_timers = timer;
-}
-
-
-void
-__glutHandleTimers( void )
-{
- __GlutTimer *cur;
- struct timeval now;
-
- for (cur = g_timers; cur; cur = cur->next ) {
- gettimeofday( &now, NULL );
-
- if (cur->expire.tv_sec > now.tv_sec ||
- (cur->expire.tv_sec == now.tv_sec &&
- cur->expire.tv_usec >= now.tv_usec))
- {
- g_idle = GL_FALSE;
-
- cur->func( cur->value );
-
- cur->expire.tv_usec += cur->interval.tv_usec;
- cur->expire.tv_sec += cur->interval.tv_sec + cur->expire.tv_usec/1000000;
- cur->expire.tv_usec %= 1000000;
- }
- }
-}
-
-
-GLboolean
-__glutGetTimeout( int *ret_msec )
-{
- __GlutTimer *cur;
- struct timeval *time = NULL;
- struct timeval now;
-
- for (cur = g_timers; cur; cur = cur->next) {
- if (time == NULL ||
- time->tv_sec > cur->expire.tv_sec ||
- (time->tv_sec == cur->expire.tv_sec &&
- time->tv_usec > cur->expire.tv_usec)) {
- time = &cur->expire;
- }
- }
-
- if (time == NULL)
- return GL_FALSE;
-
- gettimeofday( &now, NULL );
-
- *ret_msec = (time->tv_sec - now.tv_sec) * 1000 +
- (time->tv_usec - now.tv_usec + 999) / 1000;
-
- return GL_TRUE;
-}
-
-
-void
-__glutFreeTimers( void )
-{
- __GlutTimer *cur = g_timers;
-
- while (cur) {
- __GlutTimer *next = cur->next;
- free( cur );
- cur = next;
- }
-
- g_timers = NULL;
-}
-
diff --git a/src/glut/directfb/color.c b/src/glut/directfb/color.c
deleted file mode 100644
index 26c514c6d5..0000000000
--- a/src/glut/directfb/color.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include "internal.h"
-
-
-void GLUTAPIENTRY
-glutSetColor( int index, GLfloat red, GLfloat green, GLfloat blue )
-{
-}
-
-
-GLfloat GLUTAPIENTRY
-glutGetColor( int index, int component )
-{
- return 0.0;
-}
-
-
-void GLUTAPIENTRY
-glutCopyColormap( int win )
-{
-}
diff --git a/src/glut/directfb/cursor.c b/src/glut/directfb/cursor.c
deleted file mode 100644
index aca3fcc921..0000000000
--- a/src/glut/directfb/cursor.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "internal.h"
-
-#include "cursors.h"
-
-
-void GLUTAPIENTRY
-glutSetCursor( int type )
-{
- const unsigned char *cursor;
- DFBSurfaceDescription dsc;
- IDirectFBSurface *shape;
-
- if (!g_current || !g_current->window)
- return;
-
- if (g_current->cursor == type)
- return;
-
- switch (type) {
- case GLUT_CURSOR_RIGHT_ARROW:
- cursor = &cur_right_arrow[0];
- break;
- case GLUT_CURSOR_LEFT_ARROW:
- cursor = &cur_left_arrow[0];
- break;
- case GLUT_CURSOR_INFO:
- cursor = &cur_info[0];
- break;
- case GLUT_CURSOR_DESTROY:
- cursor = &cur_destroy[0];
- break;
- case GLUT_CURSOR_HELP:
- cursor = &cur_help[0];
- break;
- case GLUT_CURSOR_CYCLE:
- cursor = &cur_cycle[0];
- break;
- case GLUT_CURSOR_SPRAY:
- cursor = &cur_spray[0];
- break;
- case GLUT_CURSOR_WAIT:
- cursor = &cur_wait[0];
- break;
- case GLUT_CURSOR_TEXT:
- cursor = &cur_text[0];
- break;
- case GLUT_CURSOR_CROSSHAIR:
- cursor = &cur_crosshair[0];
- break;
- case GLUT_CURSOR_UP_DOWN:
- cursor = &cur_up_down[0];
- break;
- case GLUT_CURSOR_LEFT_RIGHT:
- cursor = &cur_left_right[0];
- break;
- case GLUT_CURSOR_TOP_SIDE:
- cursor = &cur_top_side[0];
- break;
- case GLUT_CURSOR_BOTTOM_SIDE:
- cursor = &cur_bottom_side[0];
- break;
- case GLUT_CURSOR_LEFT_SIDE:
- cursor = &cur_left_side[0];
- break;
- case GLUT_CURSOR_RIGHT_SIDE:
- cursor = &cur_right_side[0];
- break;
- case GLUT_CURSOR_TOP_LEFT_CORNER:
- cursor = &cur_top_left[0];
- break;
- case GLUT_CURSOR_TOP_RIGHT_CORNER:
- cursor = &cur_top_right[0];
- break;
- case GLUT_CURSOR_BOTTOM_RIGHT_CORNER:
- cursor = &cur_bottom_right[0];
- break;
- case GLUT_CURSOR_BOTTOM_LEFT_CORNER:
- cursor = &cur_bottom_left[0];
- break;
- case GLUT_CURSOR_NONE:
- cursor = NULL;
- break;
- default:
- cursor = &cur_right_arrow[0];
- break;
- }
-
- dsc.flags = DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT;
- dsc.width =
- dsc.height = cursor ? cursor[0] : 8;
- dsc.pixelformat = DSPF_ARGB;
-
- if (dfb->CreateSurface( dfb, &dsc, &shape ))
- return;
-
- if (cursor) {
- __u8 *src = (__u8*) &cursor[3];
- __u8 *msk = src + cursor[0]*cursor[0]/8;
- void *dst;
- int pitch;
- int x, y;
-
- if (shape->Lock( shape, DSLF_WRITE, &dst, &pitch )) {
- shape->Release( shape );
- return;
- }
-
- for (y = 0; y < cursor[0]; y++) {
- for (x = 0; x < cursor[0]; x++) {
- ((__u32*)dst)[x] =
- ((src[x>>3] & (0x80 >> (x&7))) ? 0 : 0x00ffffff) |
- ((msk[x>>3] & (0x80 >> (x&7))) ? 0xff000000 : 0);
- }
-
- dst += pitch;
- src += cursor[0]/8;
- msk += cursor[0]/8;
- }
-
- shape->Unlock( shape );
- }
- else {
- /* Invisible cursor */
- shape->Clear( shape, 0, 0, 0, 0 );
- }
-
- g_current->window->SetCursorShape( g_current->window, shape,
- cursor ? cursor[1] : 0,
- cursor ? cursor[2] : 0 );
- g_current->cursor = type;
-
- shape->Release( shape );
-}
-
-
-void GLUTAPIENTRY
-glutWarpPointer( int x, int y )
-{
- if (g_current) {
- if (!g_game) {
- int wx, wy;
- g_current->window->GetPosition( g_current->window, &wx, &wy );
- primary->WarpCursor( primary, wx+x, wy+y );
- }
- else {
- g_current->cx = x;
- g_current->cy = y;
- }
- }
-}
-
-
diff --git a/src/glut/directfb/cursors.h b/src/glut/directfb/cursors.h
deleted file mode 100644
index 30ab7c348e..0000000000
--- a/src/glut/directfb/cursors.h
+++ /dev/null
@@ -1,306 +0,0 @@
-#ifndef __GLUT_CURSORS_H__
-#define __GLUT_CURSORS_H__
-
-
-static const unsigned char cur_right_arrow[] = {
- 16, /* size */
- 1, 2, /* hotspot */
- /* data */
- 0x00, 0x00, 0x60, 0x00, 0x78, 0x00, 0x3e, 0x00,
- 0x3f, 0x80, 0x1f, 0xe0, 0x1f, 0xf8, 0x0f, 0x80,
- 0x0f, 0xc0, 0x06, 0xe0, 0x06, 0x70, 0x02, 0x38,
- 0x02, 0x1c, 0x00, 0x0e, 0x00, 0x04, 0x00, 0x00,
- /* mask */
- 0xe0, 0x00, 0xf8, 0x00, 0xfe, 0x00, 0x7f, 0x80,
- 0x7f, 0xe0, 0x3f, 0xf8, 0x3f, 0xfc, 0x1f, 0xfc,
- 0x1f, 0xe0, 0x0f, 0xf0, 0x0f, 0xf8, 0x07, 0x7c,
- 0x07, 0x3e, 0x02, 0x1f, 0x00, 0x0e, 0x00, 0x04,
-};
-
-static const unsigned char cur_left_arrow[] = {
- 16, /* size */
- 1, 15, /* hotspot */
- /* data */
- 0x00, 0x00, 0x80, 0x06, 0x00, 0x1e, 0x00, 0x7c,
- 0x01, 0xfc, 0x07, 0xf8, 0x1f, 0xf8, 0x01, 0xf0,
- 0x01, 0xf0, 0x02, 0x60, 0x04, 0x60, 0x08, 0x40,
- 0x10, 0x40, 0x20, 0x00, 0x40, 0x00, 0x00, 0x00,
- /* mask */
- 0x00, 0x07, 0x00, 0x1f, 0x00, 0x7f, 0x01, 0xfe,
- 0x07, 0xfe, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xf8,
- 0x03, 0xf8, 0x07, 0xf0, 0x0e, 0xf0, 0x1c, 0xe0,
- 0x38, 0xe0, 0x70, 0xe0, 0xe0, 0x00, 0xc0, 0x00,
-};
-
-static const unsigned char cur_info[] = {
- 16, /* size */
- 0, 2, /* hotspot */
- /* data */
- 0x30, 0x00, 0x3c, 0x00, 0x0f, 0x00, 0x07, 0x80,
- 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x07, 0xf4,
- 0x0f, 0xfe, 0x0f, 0xfa, 0x07, 0xe0, 0x03, 0xe0,
- 0x00, 0x52, 0x00, 0x46, 0x00, 0x2c, 0x00, 0x18,
- /* mask */
- 0xb8, 0x00, 0x3e, 0x00, 0x1f, 0x80, 0x0f, 0xc0,
- 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xfc, 0x1f, 0xfe,
- 0x1f, 0xfe, 0x1f, 0xfe, 0x0f, 0xfe, 0x07, 0xfe,
- 0x03, 0xfe, 0x00, 0xfe, 0x00, 0x7e, 0x00, 0x3c,
-};
-
-static const unsigned char cur_destroy[] = {
- 16, /* size */
- 12, 8, /* hotspot */
- /* data */
- 0x01, 0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0c, 0xcc,
- 0x0c, 0xcc, 0x07, 0xf8, 0x03, 0xf0, 0x01, 0xe0,
- 0x21, 0xe1, 0x61, 0xe1, 0x10, 0xc2, 0x0e, 0x1c,
- 0x01, 0xe0, 0x47, 0xf8, 0x7c, 0x0f, 0x20, 0x01,
- /* mask */
- 0x03, 0xf0, 0x07, 0xf8, 0x0f, 0xfc, 0x1f, 0xfe,
- 0x1f, 0xfe, 0x0f, 0xfc, 0x07, 0xf8, 0x83, 0xf1,
- 0xe3, 0xf1, 0xf3, 0xf3, 0x39, 0xef, 0x1e, 0x1e,
- 0x01, 0xe0, 0xc7, 0xfe, 0xff, 0xff, 0x7c, 0x0f,
-};
-
-static const unsigned char cur_help[] = {
- 16, /* size */
- 7, 8, /* hotspot */
- /* data */
- 0x83, 0xe0, 0x07, 0xf0, 0x0e, 0x38, 0x0c, 0x18,
- 0x0c, 0x38, 0x0e, 0x30, 0x07, 0x00, 0x03, 0xc0,
- 0x01, 0xc0, 0x01, 0x40, 0x01, 0x40, 0x07, 0x70,
- 0x03, 0x60, 0x01, 0xc0, 0x00, 0x80, 0x00, 0x00,
- /* mask */
- 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0xf8, 0x1f, 0xfc,
- 0x1e, 0x3c, 0x1e, 0x7c, 0x1f, 0x78, 0x0f, 0xf0,
- 0x07, 0xe0, 0x03, 0xe0, 0x03, 0xe0, 0x07, 0xf0,
- 0x0f, 0xf8, 0x07, 0xf0, 0x03, 0xe0, 0x01, 0xc0,
-};
-
-static const unsigned char cur_cycle[] = {
- 16, /* size */
- 7, 9, /* hotspot */
- /* data */
- 0x00, 0x00, 0x07, 0xe2, 0x0f, 0xf6, 0x18, 0x3e,
- 0x10, 0x12, 0x00, 0x32, 0x00, 0x7e, 0x00, 0x00,
- 0x00, 0x00, 0x7e, 0x00, 0x4c, 0x00, 0x48, 0x08,
- 0x7c, 0x18, 0x6f, 0xf0, 0x47, 0xe0, 0x00, 0x00,
- /* mask */
- 0x07, 0xe3, 0x0f, 0xf7, 0x1f, 0xff, 0x3f, 0xff,
- 0x38, 0x3f, 0x30, 0xff, 0x00, 0xff, 0x00, 0xff,
- 0xff, 0x00, 0xff, 0x00, 0xfe, 0x0c, 0xfc, 0x1c,
- 0xff, 0xfc, 0xff, 0xf8, 0xef, 0xf0, 0xc7, 0xe0,
-};
-
-static const unsigned char cur_spray[] = {
- 16, /* size */
- 2, 4, /* hotspot */
- /* data */
- 0x98, 0x00, 0x02, 0x00, 0x18, 0xb0, 0x02, 0x78,
- 0x18, 0x58, 0x00, 0xfc, 0x00, 0x84, 0x00, 0x9c,
- 0x00, 0x94, 0x00, 0x9c, 0x00, 0x94, 0x00, 0x9c,
- 0x00, 0x9c, 0x00, 0x84, 0x00, 0x84, 0x00, 0xfc,
- /* mask */
- 0x30, 0x00, 0x34, 0x60, 0x35, 0xf0, 0x35, 0xf0,
- 0x35, 0xf8, 0x03, 0xfc, 0x03, 0xfc, 0x03, 0xfc,
- 0x03, 0xfc, 0x03, 0xfc, 0x03, 0xfc, 0x03, 0xfc,
- 0x03, 0xfc, 0x03, 0xfc, 0x03, 0xfc, 0x03, 0xfc,
-};
-
-static const unsigned char cur_wait[] = {
- 16, /* size */
- 9, 1, /* hotspot */
- /* data */
- 0x07, 0xf8, 0x07, 0xf8, 0x07, 0xf8, 0x0f, 0xfc,
- 0x18, 0x86, 0x30, 0x83, 0xe0, 0x81, 0xe1, 0xc1,
- 0xe1, 0xc1, 0xe0, 0x21, 0x30, 0x13, 0x18, 0x06,
- 0x0f, 0xfc, 0x07, 0xf8, 0x07, 0xf8, 0x07, 0xf8,
- /* mask */
- 0x0f, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x1f, 0xfe,
- 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xff,
- 0x1f, 0xfe, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc,
-};
-
-static const unsigned char cur_text[] = {
- 16, /* size */
- 8, 8, /* hotspot */
- /* data */
- 0x00, 0x00, 0x0f, 0x70, 0x09, 0xc0, 0x00, 0x80,
- 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80,
- 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80,
- 0x00, 0x80, 0x01, 0xc0, 0x07, 0x70, 0x00, 0x00,
- /* mask */
- 0x0f, 0x78, 0x0f, 0xf8, 0x0f, 0xf8, 0x03, 0xe0,
- 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0,
- 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0,
- 0x03, 0xe0, 0x0f, 0xf8, 0x0f, 0xf8, 0x0f, 0x78,
-};
-
-static const unsigned char cur_crosshair[] = {
- 16, /* size */
- 7, 9, /* hotspot */
- /* data */
- 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80,
- 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0xff, 0x7f,
- 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80,
- 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00,
- /* mask */
- 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0,
- 0x01, 0xc0, 0x01, 0xc0, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0,
- 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0,
-};
-
-static const unsigned char cur_up_down[] = {
- 16, /* size */
- 7, 8, /* hotspot */
- /* data */
- 0x00, 0x80, 0x09, 0xc0, 0x03, 0xe0, 0x07, 0xf0,
- 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40,
- 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x07, 0xf0,
- 0x03, 0xe0, 0x01, 0xc0, 0x00, 0x80, 0x00, 0x00,
- /* mask */
- 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0xf8,
- 0x0f, 0xf8, 0x03, 0xe0, 0x03, 0xe0, 0x03, 0xe0,
- 0x03, 0xe0, 0x03, 0xe0, 0x0f, 0xf8, 0x0f, 0xf8,
- 0x07, 0xf0, 0x03, 0xe0, 0x01, 0xc0, 0x00, 0x00,
-};
-
-static const unsigned char cur_left_right[] = {
- 16, /* size */
- 7, 8, /* hotspot */
- /* data */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x08, 0x08, 0x18, 0x0c, 0x3f, 0xfe, 0x78, 0x0f,
- 0x3f, 0xfe, 0x18, 0x0c, 0x08, 0x08, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* mask */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x18,
- 0x1c, 0x1c, 0x3f, 0xfe, 0x7f, 0xff, 0x7f, 0xff,
- 0x7f, 0xff, 0x3f, 0xfe, 0x1c, 0x1c, 0x0c, 0x18,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char cur_top_side[] = {
- 16, /* size */
- 1, 8, /* hotspot */
- /* data */
- 0x00, 0x00, 0xff, 0xfe, 0x3f, 0xfe, 0x00, 0x00,
- 0x00, 0x80, 0x01, 0xc0, 0x02, 0xa0, 0x04, 0x90,
- 0x08, 0x88, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80,
- 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00,
- /* mask */
- 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff,
- 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0xf8,
- 0x1d, 0xdc, 0x19, 0xcc, 0x01, 0xc0, 0x01, 0xc0,
- 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0,
-};
-
-static const unsigned char cur_bottom_side[] = {
- 16, /* size */
- 14, 8, /* hotspot */
- /* data */
- 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80,
- 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x08, 0x88,
- 0x04, 0x90, 0x02, 0xa0, 0x01, 0xc0, 0x00, 0x80,
- 0x00, 0x00, 0x3f, 0xfe, 0x3f, 0xfe, 0x00, 0x00,
- /* mask */
- 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0,
- 0x01, 0xc0, 0x01, 0xc0, 0x19, 0xcc, 0x1d, 0xdc,
- 0x0f, 0xf8, 0x07, 0xf0, 0x03, 0xe0, 0x01, 0xc0,
- 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff,
-};
-
-static const unsigned char cur_left_side[] = {
- 16, /* size */
- 7, 15, /* hotspot */
- /* data */
- 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x01, 0x06,
- 0x00, 0x86, 0x00, 0x46, 0x00, 0x26, 0x7f, 0xf6,
- 0x00, 0x26, 0x00, 0x46, 0x00, 0x86, 0x01, 0x06,
- 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00,
- /* mask */
- 0x00, 0x0f, 0x00, 0x0f, 0x03, 0x0f, 0x03, 0x8f,
- 0x01, 0xcf, 0x00, 0xef, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0x00, 0xef, 0x01, 0xcf, 0x03, 0x8f,
- 0x03, 0x0f, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0x00,
-};
-
-static const unsigned char cur_right_side[] = {
- 16, /* size */
- 7, 2, /* hotspot */
- /* data */
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x80,
- 0x61, 0x00, 0x62, 0x00, 0x64, 0x00, 0x6f, 0xfe,
- 0x64, 0x00, 0x62, 0x00, 0x61, 0x00, 0x60, 0x80,
- 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
- /* mask */
- 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0xc0, 0xf1, 0xc0,
- 0xf3, 0x80, 0xf7, 0x00, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xf7, 0x00, 0xf3, 0x80, 0xf1, 0xc0,
- 0xf0, 0xc0, 0xf0, 0x00, 0xf0, 0x00, 0x00, 0x00,
-};
-
-static const unsigned char cur_top_left[] = {
- 16, /* size */
- 1, 15, /* hotspot */
- /* data */
- 0x00, 0x00, 0xff, 0xfe, 0x7f, 0xfe, 0x00, 0x06,
- 0x00, 0x06, 0x00, 0x06, 0x1f, 0xc6, 0x00, 0xc6,
- 0x01, 0x46, 0x02, 0x46, 0x04, 0x46, 0x08, 0x46,
- 0x10, 0x46, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00,
- /* mask */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0x00, 0x0f, 0x3f, 0xef, 0x3f, 0xef, 0x3f, 0xef,
- 0x03, 0xef, 0x07, 0xef, 0x0e, 0xef, 0x1c, 0xef,
- 0x38, 0xef, 0x30, 0xef, 0x00, 0x0f, 0x00, 0x0f,
-};
-
-static const unsigned char cur_top_right[] = {
- 16, /* size */
- 1, 2, /* hotspot */
- /* data */
- 0x00, 0x00, 0xff, 0xfe, 0x7f, 0xfe, 0x60, 0x00,
- 0x60, 0x00, 0x60, 0x00, 0x63, 0xf8, 0x63, 0x00,
- 0x62, 0x80, 0x62, 0x40, 0x62, 0x20, 0x62, 0x10,
- 0x62, 0x08, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00,
- /* mask */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xf0, 0x00, 0xf7, 0xfc, 0xf7, 0xfc, 0xf7, 0xfc,
- 0xf7, 0xc0, 0xf7, 0xe0, 0xf7, 0x70, 0xf7, 0x38,
- 0xf7, 0x1c, 0xf7, 0x0c, 0xf0, 0x00, 0xf0, 0x00,
-};
-
-static const unsigned char cur_bottom_right[] = {
- 16, /* size */
- 14, 2, /* hotspot */
- /* data */
- 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x62, 0x08,
- 0x62, 0x10, 0x62, 0x20, 0x62, 0x40, 0x62, 0x80,
- 0x63, 0x00, 0x63, 0xf8, 0x60, 0x00, 0x60, 0x00,
- 0x60, 0x00, 0x7f, 0xfe, 0x7f, 0xfe, 0x00, 0x00,
- /* mask */
- 0xf0, 0x00, 0xf0, 0x00, 0xf7, 0x0c, 0xf7, 0x1c,
- 0xf7, 0x38, 0xf7, 0x70, 0xf7, 0xe0, 0xf7, 0xc0,
- 0xf7, 0xfc, 0xf7, 0xfc, 0xf7, 0xfc, 0xf0, 0x00,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-};
-
-static const unsigned char cur_bottom_left[] = {
- 16, /* size */
- 14, 15, /* hotspot */
- /* data */
- 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x10, 0x46,
- 0x08, 0x46, 0x04, 0x46, 0x02, 0x46, 0x01, 0x46,
- 0x00, 0xc6, 0x1f, 0xc6, 0x00, 0x06, 0x00, 0x06,
- 0x00, 0x06, 0x7f, 0xfe, 0x7f, 0xfe, 0x00, 0x00,
- /* mask */
- 0x00, 0x0f, 0x00, 0x0f, 0x30, 0xef, 0x38, 0xef,
- 0x1c, 0xef, 0x0e, 0xef, 0x07, 0xef, 0x03, 0xef,
- 0x3f, 0xef, 0x3f, 0xef, 0x3f, 0xef, 0x00, 0x0f,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-};
-
-
-#endif /* __GLUT_CURSORS_H__ */
diff --git a/src/glut/directfb/events.c b/src/glut/directfb/events.c
deleted file mode 100644
index 6ebdd166ac..0000000000
--- a/src/glut/directfb/events.c
+++ /dev/null
@@ -1,492 +0,0 @@
-/*
- * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "internal.h"
-
-
-/*****************************************************************************/
-
-static int g_ignore_key_repeat = 0;
-
-/*****************************************************************************/
-
-
-int GLUTAPIENTRY
-glutDeviceGet( GLenum type )
-{
- switch (type) {
- case GLUT_HAS_KEYBOARD:
- return (keyboard != NULL);
- case GLUT_HAS_MOUSE:
- return (mouse != NULL);
- case GLUT_NUM_MOUSE_BUTTONS:
- if (mouse) {
- DFBInputDeviceDescription dsc;
- mouse->GetDescription( mouse, &dsc );
- return dsc.max_button+1;
- }
- break;
- case GLUT_DEVICE_IGNORE_KEY_REPEAT:
- return g_ignore_key_repeat;
- case GLUT_DEVICE_KEY_REPEAT:
- return (g_ignore_key_repeat) ? GLUT_KEY_REPEAT_OFF
- : GLUT_KEY_REPEAT_ON;
- case GLUT_HAS_JOYSTICK:
- case GLUT_OWNS_JOYSTICK:
- return (g_game && joystick); /* only available in game mode */
- case GLUT_JOYSTICK_BUTTONS:
- if (joystick) {
- DFBInputDeviceDescription dsc;
- joystick->GetDescription( joystick, &dsc );
- return dsc.max_button+1;
- }
- break;
- case GLUT_JOYSTICK_AXES:
- if (joystick) {
- DFBInputDeviceDescription dsc;
- joystick->GetDescription( joystick, &dsc );
- return dsc.max_axis+1;
- }
- break;
- case GLUT_JOYSTICK_POLL_RATE:
- if (joystick)
- return 1; /* hack */
- break;
- default:
- break;
- }
-
- return 0;
-}
-
-
-int GLUTAPIENTRY
-glutGetModifiers( void )
-{
- if (g_current)
- return g_current->modifiers;
- return 0;
-}
-
-
-void GLUTAPIENTRY
-glutIgnoreKeyRepeat( int ignore )
-{
- g_ignore_key_repeat = ignore;
-}
-
-
-void GLUTAPIENTRY
-glutSetKeyRepeat( int mode )
-{
- g_ignore_key_repeat = (mode == GLUT_KEY_REPEAT_OFF);
-}
-
-
-void GLUTAPIENTRY
-glutForceJoystickFunc( void )
-{
- if (g_game && joystick && joystick_func) {
- joystick_func( g_game->buttons,
- g_game->jx, g_game->jy, g_game->jz );
- }
-}
-
-
-static int
-__glutSpecialKey( DFBInputDeviceKeySymbol key )
-{
- switch (key) {
- case DIKS_F1:
- return GLUT_KEY_F1;
- case DIKS_F2:
- return GLUT_KEY_F2;
- case DIKS_F3:
- return GLUT_KEY_F3;
- case DIKS_F4:
- return GLUT_KEY_F4;
- case DIKS_F5:
- return GLUT_KEY_F5;
- case DIKS_F6:
- return GLUT_KEY_F6;
- case DIKS_F7:
- return GLUT_KEY_F7;
- case DIKS_F8:
- return GLUT_KEY_F8;
- case DIKS_F9:
- return GLUT_KEY_F9;
- case DIKS_F10:
- return GLUT_KEY_F10;
- case DIKS_F11:
- return GLUT_KEY_F11;
- case DIKS_F12:
- return GLUT_KEY_F12;
- case DIKS_CURSOR_LEFT:
- return GLUT_KEY_LEFT;
- case DIKS_CURSOR_UP:
- return GLUT_KEY_UP;
- case DIKS_CURSOR_RIGHT:
- return GLUT_KEY_RIGHT;
- case DIKS_CURSOR_DOWN:
- return GLUT_KEY_DOWN;
- case DIKS_PAGE_UP:
- return GLUT_KEY_PAGE_UP;
- case DIKS_PAGE_DOWN:
- return GLUT_KEY_PAGE_DOWN;
- case DIKS_HOME:
- return GLUT_KEY_HOME;
- case DIKS_END:
- return GLUT_KEY_END;
- case DIKS_INSERT:
- return GLUT_KEY_INSERT;
- default:
- break;
- }
-
- return 0;
-}
-
-
-static int
-__glutButton( DFBInputDeviceButtonIdentifier button )
-{
- switch (button) {
- case DIBI_LEFT:
- return GLUT_LEFT_BUTTON;
- case DIBI_MIDDLE:
- return GLUT_MIDDLE_BUTTON;
- case DIBI_RIGHT:
- return GLUT_RIGHT_BUTTON;
- default:
- break;
- }
-
- return 0;
-}
-
-
-static int
-__glutModifiers( DFBInputDeviceModifierMask mask )
-{
- return ((mask & DIMM_SHIFT) ? GLUT_ACTIVE_SHIFT : 0) |
- ((mask & DIMM_CONTROL) ? GLUT_ACTIVE_CTRL : 0) |
- ((mask & DIMM_ALT) ? GLUT_ACTIVE_ALT : 0);
-}
-
-
-static void
-__glutWindowEvent( DFBWindowEvent *e, DFBWindowEvent *p )
-{
- __GlutWindow *window;
-
- window = __glutFindWindow( e->window_id );
- if (!window) /* window was destroyed */
- return;
-
- switch (e->type) {
- case DWET_KEYDOWN:
- window->modifiers = __glutModifiers( e->modifiers );
- if (g_ignore_key_repeat && p) {
- if (p->type == DWET_KEYDOWN &&
- p->window_id == e->window_id &&
- p->key_symbol == e->key_symbol)
- break;
- }
- if (DFB_KEY_IS_ASCII( e->key_symbol )) {
- if (keyboard_func) {
- __glutSetWindow( window );
- keyboard_func( e->key_symbol, e->x, e->y );
- }
- }
- else {
- int key = __glutSpecialKey( e->key_symbol );
- if (key && special_func) {
- __glutSetWindow( window );
- special_func( key, e->x, e->y );
- }
- }
- break;
- case DWET_KEYUP:
- window->modifiers = __glutModifiers( e->modifiers );
- if (DFB_KEY_IS_ASCII( e->key_symbol )) {
- if (keyboard_up_func) {
- __glutSetWindow( window );
- keyboard_up_func( e->key_symbol, e->x, e->y );
- }
- }
- else {
- int key = __glutSpecialKey( e->key_symbol );
- if (key && special_up_func) {
- __glutSetWindow( window );
- special_up_func( key, e->x, e->y );
- }
- }
- break;
- case DWET_BUTTONDOWN:
- if (mouse_func) {
- __glutSetWindow( window );
- mouse_func( __glutButton( e->button ), GLUT_DOWN, e->x, e->y );
- }
- break;
- case DWET_BUTTONUP:
- if (mouse_func) {
- __glutSetWindow( window );
- mouse_func( __glutButton( e->button ), GLUT_UP, e->x, e->y );
- }
- break;
- case DWET_MOTION:
- if (e->buttons) {
- if (motion_func) {
- __glutSetWindow( window );
- motion_func( e->cx, e->cy );
- }
- }
- else {
- if (passive_motion_func) {
- __glutSetWindow( window );
- passive_motion_func( e->cx, e->cy );
- }
- }
- break;
- case DWET_ENTER:
- if (entry_func) {
- __glutSetWindow( window );
- entry_func( GLUT_ENTERED );
- }
- break;
- case DWET_LEAVE:
- if (entry_func) {
- __glutSetWindow( window );
- entry_func( GLUT_LEFT );
- }
- break;
- case DWET_SIZE:
- window->reshape = GL_TRUE;
- window->redisplay = GL_TRUE;
- break;
- default:
- break;
- }
-}
-
-
-static void
-__glutInputEvent( DFBInputEvent *e, DFBInputEvent *p )
-{
- __glutAssert( g_game != NULL );
-
- switch (e->type) {
- case DIET_KEYPRESS:
- g_game->modifiers = __glutModifiers( e->modifiers );
- if (g_ignore_key_repeat && p) {
- if (p->type == DIET_KEYPRESS &&
- p->key_symbol == e->key_symbol)
- break;
- }
- if (DFB_KEY_IS_ASCII( e->key_symbol )) {
- if (keyboard_func) {
- __glutSetWindow( g_game );
- keyboard_func( e->key_symbol, g_game->cx, g_game->cy );
- }
- }
- else {
- int key = __glutSpecialKey( e->key_symbol );
- if (key && special_func) {
- __glutSetWindow( g_game );
- special_func( key, g_game->cx, g_game->cy );
- }
- }
- break;
- case DIET_KEYRELEASE:
- g_game->modifiers = __glutModifiers( e->modifiers );
- if (DFB_KEY_IS_ASCII( e->key_symbol )) {
- if (keyboard_up_func) {
- __glutSetWindow( g_game );
- keyboard_up_func( e->key_symbol, g_game->cx, g_game->cy );
- }
- }
- else {
- int key = __glutSpecialKey( e->key_symbol );
- if (key && special_up_func) {
- __glutSetWindow( g_game );
- special_up_func( key, g_game->cx, g_game->cy );
- }
- }
- break;
- case DIET_BUTTONPRESS:
- if (e->device_id == DIDID_JOYSTICK) {
- g_game->buttons = e->buttons;
- if (joystick_func) {
- __glutSetWindow( g_game );
- joystick_func( g_game->buttons,
- g_game->jx, g_game->jy, g_game->jz );
- }
- }
- else {
- if (mouse_func) {
- __glutSetWindow( g_game );
- mouse_func( __glutButton( e->button ),
- GLUT_DOWN, g_game->cx, g_game->cy );
- }
- }
- break;
- case DIET_BUTTONRELEASE:
- if (e->device_id == DIDID_JOYSTICK) {
- g_game->buttons = e->buttons;
- if (joystick_func) {
- __glutSetWindow( g_game );
- joystick_func( g_game->buttons,
- g_game->jx, g_game->jy, g_game->jz );
- }
- }
- else {
- if (mouse_func) {
- __glutSetWindow( g_game );
- mouse_func( __glutButton( e->button ),
- GLUT_UP, g_game->cx, g_game->cy );
- }
- }
- break;
- case DIET_AXISMOTION:
- if (e->device_id == DIDID_JOYSTICK) {
- switch (e->axis) {
- case DIAI_X:
- if (e->flags & DIEF_AXISABS)
- g_game->jx = e->axisabs;
- else if (e->flags & DIEF_AXISREL)
- g_game->jx += e->axisrel;
- break;
- case DIAI_Y:
- if (e->flags & DIEF_AXISABS)
- g_game->jy = e->axisabs;
- else if (e->flags & DIEF_AXISREL)
- g_game->jy += e->axisrel;
- break;
- case DIAI_Z:
- if (e->flags & DIEF_AXISABS)
- g_game->jz = e->axisabs;
- else if (e->flags & DIEF_AXISREL)
- g_game->jz += e->axisrel;
- break;
- default:
- break;
- }
- if (joystick_func) {
- __glutSetWindow( g_game );
- joystick_func( g_game->buttons,
- g_game->jx, g_game->jy, g_game->jz );
- }
- }
- else {
- switch (e->axis) {
- case DIAI_X:
- if (e->flags & DIEF_AXISABS)
- g_game->cx = e->axisabs;
- else if (e->flags & DIEF_AXISREL)
- g_game->cx += e->axisrel;
- break;
- case DIAI_Y:
- if (e->flags & DIEF_AXISABS)
- g_game->cy = e->axisabs;
- else if (e->flags & DIEF_AXISREL)
- g_game->cy += e->axisrel;
- break;
- default:
- return;
- }
- if (e->buttons && motion_func) {
- __glutSetWindow( g_game );
- motion_func( g_game->cx, g_game->cy );
- }
- else if (!e->buttons && passive_motion_func) {
- __glutSetWindow( g_game );
- passive_motion_func( g_game->cx, g_game->cy );
- }
- }
- break;
- default:
- break;
- }
-}
-
-
-void GLUTAPIENTRY
-glutMainLoop( void )
-{
- __glutAssert( events != NULL );
-
- __glutHandleWindows();
-
- while (GL_TRUE) {
- DFBEvent evt, prev;
-
- g_idle = GL_TRUE;
-
- __glutHandleTimers();
-
- prev.clazz = DFEC_NONE;
-
- while (events->GetEvent( events, &evt ) == DFB_OK) {
- g_idle = GL_FALSE;
-
- switch (evt.clazz) {
- case DFEC_WINDOW:
- if (prev.clazz == DFEC_WINDOW)
- __glutWindowEvent( &evt.window, &prev.window );
- else
- __glutWindowEvent( &evt.window, NULL );
- break;
- case DFEC_INPUT:
- if (prev.clazz == DFEC_INPUT)
- __glutInputEvent( &evt.input, &prev.input );
- else
- __glutInputEvent( &evt.input, NULL );
- break;
- default:
- __glutWarning( "unexpected event class %d!\n", evt.clazz );
- break;
- }
-
- prev = evt;
-
- __glutHandleTimers();
- }
-
- __glutHandleWindows();
-
- if (g_idle) {
- if (idle_func) {
- idle_func();
- }
- else {
- int msec;
- __glutSetWindow( NULL );
- if (__glutGetTimeout( &msec ))
- events->WaitForEventWithTimeout( events, msec/1000, msec%1000 );
- else
- events->WaitForEvent( events );
- }
- }
- }
-}
-
diff --git a/src/glut/directfb/ext.c b/src/glut/directfb/ext.c
deleted file mode 100644
index e37ecf5afa..0000000000
--- a/src/glut/directfb/ext.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "internal.h"
-
-
-static const struct {
- const char *name;
- const GLUTproc address;
-} glut_functions[] = {
- { "glutInit", (const GLUTproc) glutInit },
- { "glutInitDisplayMode", (const GLUTproc) glutInitDisplayMode },
- { "glutInitDisplayString", (const GLUTproc) glutInitDisplayString },
- { "glutInitWindowPosition", (const GLUTproc) glutInitWindowPosition },
- { "glutInitWindowSize", (const GLUTproc) glutInitWindowSize },
- { "glutMainLoop", (const GLUTproc) glutMainLoop },
- { "glutCreateWindow", (const GLUTproc) glutCreateWindow },
- { "glutCreateSubWindow", (const GLUTproc) glutCreateSubWindow },
- { "glutDestroyWindow", (const GLUTproc) glutDestroyWindow },
- { "glutPostRedisplay", (const GLUTproc) glutPostRedisplay },
- { "glutPostWindowRedisplay", (const GLUTproc) glutPostWindowRedisplay },
- { "glutSwapBuffers", (const GLUTproc) glutSwapBuffers },
- { "glutGetWindow", (const GLUTproc) glutGetWindow },
- { "glutSetWindow", (const GLUTproc) glutSetWindow },
- { "glutSetWindowTitle", (const GLUTproc) glutSetWindowTitle },
- { "glutSetIconTitle", (const GLUTproc) glutSetIconTitle },
- { "glutPositionWindow", (const GLUTproc) glutPositionWindow },
- { "glutReshapeWindow", (const GLUTproc) glutReshapeWindow },
- { "glutPopWindow", (const GLUTproc) glutPopWindow },
- { "glutPushWindow", (const GLUTproc) glutPushWindow },
- { "glutIconifyWindow", (const GLUTproc) glutIconifyWindow },
- { "glutShowWindow", (const GLUTproc) glutShowWindow },
- { "glutHideWindow", (const GLUTproc) glutHideWindow },
- { "glutFullScreen", (const GLUTproc) glutFullScreen },
- { "glutSetCursor", (const GLUTproc) glutSetCursor },
- { "glutWarpPointer", (const GLUTproc) glutWarpPointer },
- { "glutEstablishOverlay", (const GLUTproc) glutEstablishOverlay },
- { "glutRemoveOverlay", (const GLUTproc) glutRemoveOverlay },
- { "glutUseLayer", (const GLUTproc) glutUseLayer },
- { "glutPostOverlayRedisplay", (const GLUTproc) glutPostOverlayRedisplay },
- { "glutPostWindowOverlayRedisplay", (const GLUTproc) glutPostWindowOverlayRedisplay },
- { "glutShowOverlay", (const GLUTproc) glutShowOverlay },
- { "glutHideOverlay", (const GLUTproc) glutHideOverlay },
- { "glutCreateMenu", (const GLUTproc) glutCreateMenu },
- { "glutDestroyMenu", (const GLUTproc) glutDestroyMenu },
- { "glutGetMenu", (const GLUTproc) glutGetMenu },
- { "glutSetMenu", (const GLUTproc) glutSetMenu },
- { "glutAddMenuEntry", (const GLUTproc) glutAddMenuEntry },
- { "glutAddSubMenu", (const GLUTproc) glutAddSubMenu },
- { "glutChangeToMenuEntry", (const GLUTproc) glutChangeToMenuEntry },
- { "glutChangeToSubMenu", (const GLUTproc) glutChangeToSubMenu },
- { "glutRemoveMenuItem", (const GLUTproc) glutRemoveMenuItem },
- { "glutAttachMenu", (const GLUTproc) glutAttachMenu },
- { "glutDetachMenu", (const GLUTproc) glutDetachMenu },
- { "glutDisplayFunc", (const GLUTproc) glutDisplayFunc },
- { "glutReshapeFunc", (const GLUTproc) glutReshapeFunc },
- { "glutKeyboardFunc", (const GLUTproc) glutKeyboardFunc },
- { "glutMouseFunc", (const GLUTproc) glutMouseFunc },
- { "glutMotionFunc", (const GLUTproc) glutMotionFunc },
- { "glutPassiveMotionFunc", (const GLUTproc) glutPassiveMotionFunc },
- { "glutEntryFunc", (const GLUTproc) glutEntryFunc },
- { "glutVisibilityFunc", (const GLUTproc) glutVisibilityFunc },
- { "glutIdleFunc", (const GLUTproc) glutIdleFunc },
- { "glutTimerFunc", (const GLUTproc) glutTimerFunc },
- { "glutMenuStateFunc", (const GLUTproc) glutMenuStateFunc },
- { "glutSpecialFunc", (const GLUTproc) glutSpecialFunc },
- { "glutSpaceballMotionFunc", (const GLUTproc) glutSpaceballMotionFunc },
- { "glutSpaceballRotateFunc", (const GLUTproc) glutSpaceballRotateFunc },
- { "glutSpaceballButtonFunc", (const GLUTproc) glutSpaceballButtonFunc },
- { "glutButtonBoxFunc", (const GLUTproc) glutButtonBoxFunc },
- { "glutDialsFunc", (const GLUTproc) glutDialsFunc },
- { "glutTabletMotionFunc", (const GLUTproc) glutTabletMotionFunc },
- { "glutTabletButtonFunc", (const GLUTproc) glutTabletButtonFunc },
- { "glutMenuStatusFunc", (const GLUTproc) glutMenuStatusFunc },
- { "glutOverlayDisplayFunc", (const GLUTproc) glutOverlayDisplayFunc },
- { "glutWindowStatusFunc", (const GLUTproc) glutWindowStatusFunc },
- { "glutKeyboardUpFunc", (const GLUTproc) glutKeyboardUpFunc },
- { "glutSpecialUpFunc", (const GLUTproc) glutSpecialUpFunc },
- { "glutJoystickFunc", (const GLUTproc) glutJoystickFunc },
- { "glutSetColor", (const GLUTproc) glutSetColor },
- { "glutGetColor", (const GLUTproc) glutGetColor },
- { "glutCopyColormap", (const GLUTproc) glutCopyColormap },
- { "glutGet", (const GLUTproc) glutGet },
- { "glutDeviceGet", (const GLUTproc) glutDeviceGet },
- { "glutExtensionSupported", (const GLUTproc) glutExtensionSupported },
- { "glutGetModifiers", (const GLUTproc) glutGetModifiers },
- { "glutLayerGet", (const GLUTproc) glutLayerGet },
- { "glutGetProcAddress", (const GLUTproc) glutGetProcAddress },
- { "glutBitmapCharacter", (const GLUTproc) glutBitmapCharacter },
- { "glutBitmapWidth", (const GLUTproc) glutBitmapWidth },
- { "glutStrokeCharacter", (const GLUTproc) glutStrokeCharacter },
- { "glutStrokeWidth", (const GLUTproc) glutStrokeWidth },
- { "glutBitmapLength", (const GLUTproc) glutBitmapLength },
- { "glutStrokeLength", (const GLUTproc) glutStrokeLength },
- { "glutWireSphere", (const GLUTproc) glutWireSphere },
- { "glutSolidSphere", (const GLUTproc) glutSolidSphere },
- { "glutWireCone", (const GLUTproc) glutWireCone },
- { "glutSolidCone", (const GLUTproc) glutSolidCone },
- { "glutWireCube", (const GLUTproc) glutWireCube },
- { "glutSolidCube", (const GLUTproc) glutSolidCube },
- { "glutWireTorus", (const GLUTproc) glutWireTorus },
- { "glutSolidTorus", (const GLUTproc) glutSolidTorus },
- { "glutWireDodecahedron", (const GLUTproc) glutWireDodecahedron },
- { "glutSolidDodecahedron", (const GLUTproc) glutSolidDodecahedron },
- { "glutWireTeapot", (const GLUTproc) glutWireTeapot },
- { "glutSolidTeapot", (const GLUTproc) glutSolidTeapot },
- { "glutWireOctahedron", (const GLUTproc) glutWireOctahedron },
- { "glutSolidOctahedron", (const GLUTproc) glutSolidOctahedron },
- { "glutWireTetrahedron", (const GLUTproc) glutWireTetrahedron },
- { "glutSolidTetrahedron", (const GLUTproc) glutSolidTetrahedron },
- { "glutWireIcosahedron", (const GLUTproc) glutWireIcosahedron },
- { "glutSolidIcosahedron", (const GLUTproc) glutSolidIcosahedron },
-// { "glutVideoResizeGet", (const GLUTproc) glutVideoResizeGet },
-// { "glutSetupVideoResizing", (const GLUTproc) glutSetupVideoResizing },
-// { "glutStopVideoResizing", (const GLUTproc) glutStopVideoResizing },
-// { "glutVideoResize", (const GLUTproc) glutVideoResize },
-// { "glutVideoPan", (const GLUTproc) glutVideoPan },
- { "glutReportErrors", (const GLUTproc) glutReportErrors },
- { "glutIgnoreKeyRepeat", (const GLUTproc) glutIgnoreKeyRepeat },
- { "glutSetKeyRepeat", (const GLUTproc) glutSetKeyRepeat },
- { "glutForceJoystickFunc", (const GLUTproc) glutForceJoystickFunc },
- { "glutGameModeString", (const GLUTproc) glutGameModeString },
- { "glutEnterGameMode", (const GLUTproc) glutEnterGameMode },
- { "glutLeaveGameMode", (const GLUTproc) glutLeaveGameMode },
- { "glutGameModeGet", (const GLUTproc) glutGameModeGet },
-};
-
-
-GLUTproc GLUTAPIENTRY
-glutGetProcAddress( const char *name )
-{
- int i;
-
- for (i = 0; i < sizeof(glut_functions)/sizeof(glut_functions[0]); i++) {
- if (!strcmp( name, glut_functions[i].name ))
- return glut_functions[i].address;
- }
-
-#if DIRECTFBGL_INTERFACE_VERSION >= 1
- if (g_current) {
- void *address = NULL;
- g_current->gl->GetProcAddress( g_current->gl, name, &address );
- return address;
- }
-#endif
- return NULL;
-}
-
-
-int GLUTAPIENTRY
-glutExtensionSupported( const char *name )
-{
- GLubyte *extensions;
- int length;
-
- if (!name || !*name)
- return 0;
-
- length = strlen( name );
- extensions = (GLubyte*) glGetString( GL_EXTENSIONS );
-
- while (extensions && *extensions) {
- GLubyte *next;
-
- next = strchr( extensions, ' ' );
- if (next) {
- if (length == (int)(next - extensions)) {
- if (!strncmp( extensions, name, length ))
- return 1;
- }
- extensions = next+1;
- }
- else {
- if (!strcmp( extensions, name ))
- return 1;
- break;
- }
- }
-
- return 0;
-}
-
diff --git a/src/glut/directfb/font.c b/src/glut/directfb/font.c
deleted file mode 100644
index 0139cddbec..0000000000
--- a/src/glut/directfb/font.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/* Copyright (c) Mark J. Kilgard, 1994, 1998.
-
- This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
- implied. This program is -not- in the public domain. */
-
-#include "internal.h"
-#include "font.h"
-
-
-#if defined(_WIN32) || defined (GLUT_IMPORT_LIB)
-
-static inline void*
-__glutFont( void *font )
-{
- switch((long)font) {
- case (long)GLUT_STROKE_ROMAN:
- return &glutStrokeRoman;
- case (long)GLUT_STROKE_MONO_ROMAN:
- return &glutStrokeMonoRoman;
- case (long)GLUT_BITMAP_9_BY_15:
- return &glutBitmap9By15;
- case (long)GLUT_BITMAP_8_BY_13:
- return &glutBitmap8By13;
- case (long)GLUT_BITMAP_TIMES_ROMAN_10:
- return &glutBitmapTimesRoman10;
- case (long)GLUT_BITMAP_TIMES_ROMAN_24:
- return &glutBitmapTimesRoman24;
- case (long)GLUT_BITMAP_HELVETICA_10:
- return &glutBitmapHelvetica10;
- case (long)GLUT_BITMAP_HELVETICA_12:
- return &glutBitmapHelvetica12;
- case (long)GLUT_BITMAP_HELVETICA_18:
- return &glutBitmapHelvetica18;
- }
-
- return NULL;
-}
-
-#else
-
-static inline void*
-__glutFont( void *font )
-{
- return font;
-}
-
-#endif
-
-
-void GLUTAPIENTRY
-glutBitmapCharacter( GLUTbitmapFont font, int c )
-{
- const BitmapCharRec *ch;
- BitmapFontPtr fontinfo;
- GLint swapbytes, lsbfirst, rowlength;
- GLint skiprows, skippixels, alignment;
-
- fontinfo = (BitmapFontPtr) __glutFont( font );
-
- if (!fontinfo || c < fontinfo->first ||
- c >= fontinfo->first + fontinfo->num_chars)
- return;
-
- ch = fontinfo->ch[c - fontinfo->first];
- if (ch) {
- /* Save current modes. */
- glGetIntegerv(GL_UNPACK_SWAP_BYTES, &swapbytes);
- glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsbfirst);
- glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowlength);
- glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skiprows);
- glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skippixels);
- glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
- /* Little endian machines (DEC Alpha for example) could
- benefit from setting GL_UNPACK_LSB_FIRST to GL_TRUE
- instead of GL_FALSE, but this would require changing the
- generated bitmaps too. */
- glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
- glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glBitmap(ch->width, ch->height, ch->xorig, ch->yorig,
- ch->advance, 0, ch->bitmap);
- /* Restore saved modes. */
- glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes);
- glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength);
- glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows);
- glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels);
- glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
- }
-}
-
-
-int GLUTAPIENTRY
-glutBitmapWidth( GLUTbitmapFont font, int c )
-{
- BitmapFontPtr fontinfo;
- const BitmapCharRec *ch;
-
- fontinfo = (BitmapFontPtr) __glutFont( font );
-
- if (!fontinfo || c < fontinfo->first ||
- c >= fontinfo->first + fontinfo->num_chars)
- return 0;
-
- ch = fontinfo->ch[c - fontinfo->first];
- if (ch)
- return ch->advance;
-
- return 0;
-}
-
-
-int GLUTAPIENTRY
-glutBitmapLength( GLUTbitmapFont font, const unsigned char *string )
-{
- int c, length;
- BitmapFontPtr fontinfo;
- const BitmapCharRec *ch;
-
- fontinfo = (BitmapFontPtr) __glutFont( font );
- if (!fontinfo)
- return 0;
-
- for (length = 0; *string != '\0'; string++) {
- c = *string;
- if (c >= fontinfo->first &&
- c < fontinfo->first + fontinfo->num_chars) {
- ch = fontinfo->ch[c - fontinfo->first];
- if (ch)
- length += ch->advance;
- }
- }
-
- return length;
-}
-
-
-void GLUTAPIENTRY
-glutStrokeCharacter( GLUTstrokeFont font, int c )
-{
- const StrokeCharRec *ch;
- const StrokeRec *stroke;
- const CoordRec *coord;
- StrokeFontPtr fontinfo;
- int i, j;
-
- fontinfo = (StrokeFontPtr) __glutFont( font );
-
- if (!fontinfo || c < 0 || c >= fontinfo->num_chars)
- return;
-
- ch = &(fontinfo->ch[c]);
- if (ch) {
- for (i = ch->num_strokes, stroke = ch->stroke;
- i > 0; i--, stroke++) {
- glBegin(GL_LINE_STRIP);
- for (j = stroke->num_coords, coord = stroke->coord;
- j > 0; j--, coord++) {
- glVertex2f(coord->x, coord->y);
- }
- glEnd();
- }
- glTranslatef(ch->right, 0.0, 0.0);
- }
-}
-
-
-int GLUTAPIENTRY
-glutStrokeWidth( GLUTstrokeFont font, int c )
-{
- StrokeFontPtr fontinfo;
- const StrokeCharRec *ch;
-
- fontinfo = (StrokeFontPtr) __glutFont( font );
-
- if (!fontinfo || c < 0 || c >= fontinfo->num_chars)
- return 0;
-
- ch = &(fontinfo->ch[c]);
- if (ch)
- return ch->right;
-
- return 0;
-}
-
-
-int GLUTAPIENTRY
-glutStrokeLength( GLUTstrokeFont font, const unsigned char *string )
-{
- int c, length;
- StrokeFontPtr fontinfo;
- const StrokeCharRec *ch;
-
- fontinfo = (StrokeFontPtr) __glutFont( font );
- if (!fontinfo)
- return 0;
-
- for (length = 0; *string != '\0'; string++) {
- c = *string;
- if (c >= 0 && c < fontinfo->num_chars) {
- ch = &(fontinfo->ch[c]);
- if (ch)
- length += ch->right;
- }
- }
-
- return length;
-}
-
diff --git a/src/glut/directfb/font.h b/src/glut/directfb/font.h
deleted file mode 100644
index b1e76838a0..0000000000
--- a/src/glut/directfb/font.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Copyright (c) Mark J. Kilgard, 1994, 1998. */
-
-/* This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
- implied. This program is -not- in the public domain. */
-
-#ifndef __GLUT_FONT_H__
-#define __GLUT_FONT_H__
-
-
-typedef struct {
- const GLsizei width;
- const GLsizei height;
- const GLfloat xorig;
- const GLfloat yorig;
- const GLfloat advance;
- const GLubyte *bitmap;
-} BitmapCharRec, *BitmapCharPtr;
-
-typedef struct {
- const char *name;
- const int num_chars;
- const int first;
- const BitmapCharRec * const *ch;
-} BitmapFontRec, *BitmapFontPtr;
-
-typedef void *GLUTbitmapFont;
-
-
-typedef struct {
- float x;
- float y;
-} CoordRec, *CoordPtr;
-
-typedef struct {
- int num_coords;
- const CoordRec *coord;
-} StrokeRec, *StrokePtr;
-
-typedef struct {
- int num_strokes;
- const StrokeRec *stroke;
- float center;
- float right;
-} StrokeCharRec, *StrokeCharPtr;
-
-typedef struct {
- const char *name;
- int num_chars;
- const StrokeCharRec *ch;
- float top;
- float bottom;
-} StrokeFontRec, *StrokeFontPtr;
-
-typedef void *GLUTstrokeFont;
-
-
-#endif /* __GLUT_FONT_H__ */
diff --git a/src/glut/directfb/game.c b/src/glut/directfb/game.c
deleted file mode 100644
index 4c027a68f6..0000000000
--- a/src/glut/directfb/game.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "internal.h"
-
-
-/*****************************************************************************/
-
-static int g_display_changed = 0;
-
-/*****************************************************************************/
-
-
-void GLUTAPIENTRY
-glutGameModeString( const char *string )
-{
- int x, y, bpp;
- char *tmp;
-
- if (!string)
- return;
-
- tmp = strchr( string, 'x' );
- if (tmp) {
- x = strtol( string, NULL, 10 );
- y = strtol( tmp+1, NULL, 10 );
-
- if (x > 0 && y > 0) {
- g_width = x;
- g_height = y;
- }
- }
-
- tmp = strchr( string, ':' );
- if (tmp) {
- bpp = strtol( tmp+1, NULL, 10 );
-
- if (bpp > 0)
- g_bpp = bpp;
- }
-}
-
-
-int GLUTAPIENTRY
-glutEnterGameMode( void )
-{
- DFBDisplayLayerConfig prev, cur;
-
- glutInit( NULL, NULL );
-
- primary->GetConfiguration( primary, &prev );
- primary->SetCooperativeLevel( primary, DLSCL_EXCLUSIVE );
-
- if (g_game)
- __glutDestroyWindow( g_game );
-
- g_game = __glutCreateWindow( GL_TRUE );
- if (!g_game)
- return 0;
-
- __glutSetWindow( g_game );
- g_game->cursor = GLUT_CURSOR_NONE;
-
- primary->GetConfiguration( primary, &cur );
- g_display_changed = (cur.width != prev.width ||
- cur.height != prev.height ||
- cur.pixelformat != prev.pixelformat);
-
- return g_game->id;
-}
-
-
-void GLUTAPIENTRY
-glutLeaveGameMode( void )
-{
- if (g_game)
- __glutDestroyWindow( g_game );
-
- primary->SetCooperativeLevel( primary, DLSCL_ADMINISTRATIVE );
-}
-
-
-int GLUTAPIENTRY
-glutGameModeGet( GLenum type )
-{
- switch (type) {
- case GLUT_GAME_MODE_ACTIVE:
- return (g_game != NULL);
- case GLUT_GAME_MODE_POSSIBLE:
- if (primary) {
- DFBDisplayLayerConfig c;
- c.flags = DLCONF_WIDTH | DLCONF_HEIGHT;
- c.width = g_width;
- c.height = g_height;
- /* XXX: bpp */
- if (primary->TestConfiguration( primary, &c, 0 ) == DFB_OK)
- return 1;
- }
- break;
- case GLUT_GAME_MODE_WIDTH:
- if (g_game) {
- int w;
- g_game->surface->GetSize( g_game->surface, &w, 0 );
- return w;
- }
- break;
- case GLUT_GAME_MODE_HEIGHT:
- if (g_game) {
- int h;
- g_game->surface->GetSize( g_game->surface, 0, &h );
- return h;
- }
- break;
- case GLUT_GAME_MODE_PIXEL_DEPTH:
- if (g_game) {
- DFBSurfacePixelFormat f;
- g_game->surface->GetPixelFormat( g_game->surface, &f );
- return DFB_COLOR_BITS_PER_PIXEL( f );
- }
- break;
- case GLUT_GAME_MODE_REFRESH_RATE:
- return 60; /* assume 60hz */
- case GLUT_GAME_MODE_DISPLAY_CHANGED:
- return g_display_changed;
- default:
- break;
- }
-
- return 0;
-}
-
-
-
diff --git a/src/glut/directfb/globals.c b/src/glut/directfb/globals.c
deleted file mode 100644
index 2a5291137e..0000000000
--- a/src/glut/directfb/globals.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include "internal.h"
-
-IDirectFB *dfb = NULL;
-IDirectFBDisplayLayer *primary = NULL;
-IDirectFBEventBuffer *events = NULL;
-IDirectFBInputDevice *keyboard = NULL;
-IDirectFBInputDevice *mouse = NULL;
-IDirectFBInputDevice *joystick = NULL;
-
-GLenum g_display_mode = 0;
-GLuint g_width = DEFAULT_WIDTH;
-GLuint g_height = DEFAULT_HEIGHT;
-GLint g_xpos = 0;
-GLint g_ypos = 0;
-GLint g_bpp = 0;
-GLboolean g_idle = GL_TRUE;
-__GlutWindow *g_current = NULL;
-__GlutWindow *g_game = NULL;
-
-
-void (GLUTCALLBACK *display_func) (void) = 0;
-void (GLUTCALLBACK *reshape_func) (int width, int height) = 0;
-void (GLUTCALLBACK *keyboard_func) (unsigned char key, int x, int y) = 0;
-void (GLUTCALLBACK *mouse_func) (int button, int state, int x, int y) = 0;
-void (GLUTCALLBACK *motion_func) (int x, int y) = 0;
-void (GLUTCALLBACK *passive_motion_func) (int x, int y) = 0;
-void (GLUTCALLBACK *entry_func) (int state) = 0;
-void (GLUTCALLBACK *visibility_func) (int state) = 0;
-void (GLUTCALLBACK *idle_func) (void) = 0;
-void (GLUTCALLBACK *menu_state_func) (int state) = 0;
-void (GLUTCALLBACK *special_func) (int key, int x, int y) = 0;
-void (GLUTCALLBACK *spaceball_motion_func) (int x, int y, int z) = 0;
-void (GLUTCALLBACK *spaceball_rotate_func) (int x, int y, int z) = 0;
-void (GLUTCALLBACK *spaceball_button_func) (int button, int state) = 0;
-void (GLUTCALLBACK *button_box_func) (int button, int state) = 0;
-void (GLUTCALLBACK *dials_func) (int dial, int value) = 0;
-void (GLUTCALLBACK *tablet_motion_func) (int x, int y) = 0;
-void (GLUTCALLBACK *tabled_button_func) (int button, int state, int x, int y) = 0;
-void (GLUTCALLBACK *menu_status_func) (int status, int x, int y) = 0;
-void (GLUTCALLBACK *overlay_display_func) (void) = 0;
-void (GLUTCALLBACK *window_status_func) (int state) = 0;
-void (GLUTCALLBACK *keyboard_up_func) (unsigned char key, int x, int y) = 0;
-void (GLUTCALLBACK *special_up_func) (int key, int x, int y) = 0;
-void (GLUTCALLBACK *joystick_func) (unsigned int buttons, int x, int y, int z) = 0;
diff --git a/src/glut/directfb/init.c b/src/glut/directfb/init.c
deleted file mode 100644
index ba1a49adf2..0000000000
--- a/src/glut/directfb/init.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "internal.h"
-
-
-static void
-__glutExit( void )
-{
- __glutFreeTimers();
- __glutDestroyWindows();
-
- if (events) {
- events->Release( events );
- events = NULL;
- }
-
- if (joystick) {
- joystick->Release( joystick );
- joystick = NULL;
- }
-
- if (mouse) {
- mouse->Release( mouse );
- mouse = NULL;
- }
-
- if (keyboard) {
- keyboard->Release( keyboard );
- keyboard = NULL;
- }
-
- if (primary) {
- primary->Release( primary );
- primary = NULL;
- }
-
- if (dfb) {
- dfb->Release( dfb );
- dfb = NULL;
- }
-}
-
-
-void GLUTAPIENTRY
-glutInit( int *argcp, char **argv )
-{
- DFBResult ret;
-
- if (dfb)
- return;
-
- glutGet( GLUT_ELAPSED_TIME );
-
- ret = DirectFBInit( argcp, argv ? &argv : NULL );
- if (ret)
- DirectFBErrorFatal( "DirectFBInit()", ret );
-
- ret = DirectFBCreate( &dfb );
- if (ret)
- DirectFBErrorFatal( "DirectFBCreate()", ret );
-
- ret = dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &primary );
- if (ret)
- DirectFBErrorFatal( "IDirectFB::GetDisplayLayer()", ret );
-
- ret = dfb->CreateEventBuffer( dfb, &events );
- if (ret)
- DirectFBErrorFatal( "IDirectFB::CreateEventBuffer()", ret );
-
- dfb->GetInputDevice( dfb, DIDID_KEYBOARD, &keyboard );
- dfb->GetInputDevice( dfb, DIDID_MOUSE, &mouse );
- dfb->GetInputDevice( dfb, DIDID_JOYSTICK, &joystick );
-
- primary->SetCooperativeLevel( primary, DLSCL_ADMINISTRATIVE );
-
- atexit( __glutExit );
-}
-
-
-void GLUTAPIENTRY
-glutInitDisplayMode( unsigned int mode )
-{
- g_display_mode = mode;
-}
-
-
-void GLUTAPIENTRY
-glutInitWindowPosition( int x, int y )
-{
- g_xpos = x;
- g_ypos = y;
-}
-
-
-void GLUTAPIENTRY
-glutInitWindowSize( int width, int height )
-{
- g_width = width;
- g_height = height;
-}
-
-
-void GLUTAPIENTRY
-glutInitDisplayString( const char *string )
-{
-}
-
diff --git a/src/glut/directfb/internal.h b/src/glut/directfb/internal.h
deleted file mode 100644
index 55c4b5ce28..0000000000
--- a/src/glut/directfb/internal.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#ifndef __GLUT_INTERNAL_H__
-#define __GLUT_INTERNAL_H__
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <directfb.h>
-#include <directfb_version.h>
-
-#include <directfbgl.h>
-
-#include "GL/glut.h"
-
-
-#define VERSION_CODE( M, m, r ) (((M) << 16) | ((m) << 8) | ((r)))
-
-#define DIRECTFB_VERSION_CODE VERSION_CODE( DIRECTFB_MAJOR_VERSION, \
- DIRECTFB_MINOR_VERSION, \
- DIRECTFB_MICRO_VERSION )
-
-
-#define DEFAULT_WIDTH 640
-#define DEFAULT_HEIGHT 480
-
-/*
- * Window request flags
- */
-#define WINDOW_REQUEST_POSITION 0x00000001
-#define WINDOW_REQUEST_RESIZE 0x00000002
-#define WINDOW_REQUEST_RESTACK 0x00000004
-#define WINDOW_REQUEST_SHOW 0x00000008
-#define WINDOW_REQUEST_HIDE 0x00000010
-#define WINDOW_REQUEST_DESTROY 0x00000020
-
-/*
- * GLUT Window implementation
- */
-typedef struct __GlutWindow_s {
- int id;
- DFBWindowID wid;
-
- IDirectFBWindow *window; /* NULL = fullscreen (game mode) */
- IDirectFBSurface *surface;
- IDirectFBGL *gl;
-
- /* display mode */
- GLenum mode;
-
- /* cursor position in fullscreen mode */
- int cx;
- int cy;
- /* joystick position */
- int jx;
- int jy;
- int jz;
- /* pressed modifiers */
- int modifiers;
- /* pressed buttons */
- int buttons;
- /* current cursor shape */
- int cursor;
-
- struct {
- int flags;
- int x;
- int y;
- int w;
- int h;
- int z;
- } req;
-
- GLboolean visible;
- GLboolean redisplay;
- GLboolean reshape;
- GLboolean visibility;
-
- struct __GlutWindow_s *next;
- struct __GlutWindow_s *prev;
-} __GlutWindow;
-
-
-/* Global Vars */
-extern IDirectFB *dfb;
-extern IDirectFBDisplayLayer *primary;
-extern IDirectFBEventBuffer *events;
-extern IDirectFBInputDevice *keyboard;
-extern IDirectFBInputDevice *mouse;
-extern IDirectFBInputDevice *joystick;
-
-extern GLenum g_display_mode;
-extern GLuint g_width;
-extern GLuint g_height;
-extern GLint g_xpos;
-extern GLint g_ypos;
-extern GLint g_bpp;
-extern GLboolean g_idle;
-extern __GlutWindow *g_current;
-extern __GlutWindow *g_game;
-
-
-/* Global Funcs */
-/* window.c */
-extern __GlutWindow* __glutCreateWindow( GLboolean fullscreen );
-extern __GlutWindow* __glutFindWindow( DFBWindowID id );
-extern void __glutSetWindow( __GlutWindow *window );
-extern void __glutHandleWindows( void );
-extern void __glutDestroyWindow( __GlutWindow *window );
-extern void __glutDestroyWindows( void );
-/* callback.c */
-extern void __glutHandleTimers( void );
-extern GLboolean __glutGetTimeout( int *ret_msec );
-extern void __glutFreeTimers( void );
-
-
-/* Global Callbacks */
-extern void (GLUTCALLBACK *display_func) (void);
-extern void (GLUTCALLBACK *reshape_func) (int width, int height);
-extern void (GLUTCALLBACK *keyboard_func) (unsigned char key, int x, int y);
-extern void (GLUTCALLBACK *mouse_func) (int button, int state, int x, int y);
-extern void (GLUTCALLBACK *motion_func) (int x, int y);
-extern void (GLUTCALLBACK *passive_motion_func) (int x, int y);
-extern void (GLUTCALLBACK *entry_func) (int state);
-extern void (GLUTCALLBACK *visibility_func) (int state);
-extern void (GLUTCALLBACK *idle_func) (void);
-extern void (GLUTCALLBACK *menu_state_func) (int state);
-extern void (GLUTCALLBACK *special_func) (int key, int x, int y);
-extern void (GLUTCALLBACK *spaceball_motion_func) (int x, int y, int z);
-extern void (GLUTCALLBACK *spaceball_rotate_func) (int x, int y, int z);
-extern void (GLUTCALLBACK *spaceball_button_func) (int button, int state);
-extern void (GLUTCALLBACK *button_box_func) (int button, int state);
-extern void (GLUTCALLBACK *dials_func) (int dial, int value);
-extern void (GLUTCALLBACK *tablet_motion_func) (int x, int y);
-extern void (GLUTCALLBACK *tabled_button_func) (int button, int state, int x, int y);
-extern void (GLUTCALLBACK *menu_status_func) (int status, int x, int y);
-extern void (GLUTCALLBACK *overlay_display_func) (void);
-extern void (GLUTCALLBACK *window_status_func) (int state);
-extern void (GLUTCALLBACK *keyboard_up_func) (unsigned char key, int x, int y);
-extern void (GLUTCALLBACK *special_up_func) (int key, int x, int y);
-extern void (GLUTCALLBACK *joystick_func) (unsigned int buttons, int x, int y, int z);
-
-
-#ifdef DEBUG
-# define __glutAssert( exp ) {\
- if (!(exp)) {\
- fprintf( stderr, "(!!) *** Assertion [%s] failed in %s() ***\n",\
- #exp, __FUNCTION__ );
- fflush( stderr );\
- exit( -1 );\
- }\
- }
-#else
-# define __glutAssert( exp )
-#endif
-
-#define __glutWarning( format, ... ) {\
- fprintf( stderr, "(!) GLUT: " format "!\n", ## __VA_ARGS__ );\
- fflush( stderr );\
-}
-
-#define __glutFatalError( format, ... ) {\
- fprintf( stderr, "(!) GLUT: " format "!\n", ## __VA_ARGS__ );\
- fprintf( stderr, "\t-> from %s() at line %d\n", __FUNCTION__, __LINE__ );\
- fflush( stderr );\
- exit( -1 );\
-}
-
-
-#endif /* __GLUT_INTERNAL_H__ */
-
diff --git a/src/glut/directfb/menu.c b/src/glut/directfb/menu.c
deleted file mode 100644
index 400e966bbb..0000000000
--- a/src/glut/directfb/menu.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include "internal.h"
-
-
-int GLUTAPIENTRY
-glutCreateMenu( void (GLUTCALLBACK *func) (int) )
-{
- return 0;
-}
-
-void GLUTAPIENTRY
-glutDestroyMenu( int menu )
-{
-}
-
-
-int GLUTAPIENTRY
-glutGetMenu( void )
-{
- return 0;
-}
-
-
-void GLUTAPIENTRY
-glutSetMenu( int menu )
-{
-}
-
-
-void GLUTAPIENTRY
-glutAddMenuEntry( const char *label, int value )
-{
-}
-
-
-void GLUTAPIENTRY
-glutAddSubMenu( const char *label, int submenu )
-{
-}
-
-
-void GLUTAPIENTRY
-glutChangeToMenuEntry( int item, const char *label, int value )
-{
-}
-
-
-void GLUTAPIENTRY
-glutChangeToSubMenu( int item, const char *label, int submenu )
-{
-}
-
-
-void GLUTAPIENTRY
-glutRemoveMenuItem( int item )
-{
-}
-
-
-void GLUTAPIENTRY
-glutAttachMenu( int button )
-{
-}
-
-
-void GLUTAPIENTRY
-glutDetachMenu( int button )
-{
-}
diff --git a/src/glut/directfb/models.c b/src/glut/directfb/models.c
deleted file mode 100644
index d96a8f5077..0000000000
--- a/src/glut/directfb/models.c
+++ /dev/null
@@ -1,599 +0,0 @@
-
-/* Copyright (c) Mark J. Kilgard, 1994, 1997. */
-
-/**
-(c) Copyright 1993, Silicon Graphics, Inc.
-
-ALL RIGHTS RESERVED
-
-Permission to use, copy, modify, and distribute this software
-for any purpose and without fee is hereby granted, provided
-that the above copyright notice appear in all copies and that
-both the copyright notice and this permission notice appear in
-supporting documentation, and that the name of Silicon
-Graphics, Inc. not be used in advertising or publicity
-pertaining to distribution of the software without specific,
-written prior permission.
-
-THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU
-"AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR
-OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO
-EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE
-ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR
-CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER,
-INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE,
-SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR
-NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF THE POSSIBILITY
-OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR
-PERFORMANCE OF THIS SOFTWARE.
-
-US Government Users Restricted Rights
-
-Use, duplication, or disclosure by the Government is subject to
-restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
-(c)(1)(ii) of the Rights in Technical Data and Computer
-Software clause at DFARS 252.227-7013 and/or in similar or
-successor clauses in the FAR or the DOD or NASA FAR
-Supplement. Unpublished-- rights reserved under the copyright
-laws of the United States. Contractor/manufacturer is Silicon
-Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA
-94039-7311.
-
-OpenGL(TM) is a trademark of Silicon Graphics, Inc.
-*/
-
-#include <math.h>
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#include "internal.h"
-
-/* Some <math.h> files do not define M_PI... */
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-static GLUquadricObj *quadObj;
-
-#define QUAD_OBJ_INIT() { if(!quadObj) initQuadObj(); }
-
-static void
-initQuadObj(void)
-{
- quadObj = gluNewQuadric();
- if (!quadObj)
- __glutFatalError("out of memory");
-}
-
-/* CENTRY */
-void GLUTAPIENTRY
-glutWireSphere(GLdouble radius, GLint slices, GLint stacks)
-{
- QUAD_OBJ_INIT();
- gluQuadricDrawStyle(quadObj, GLU_LINE);
- gluQuadricNormals(quadObj, GLU_SMOOTH);
- /* If we ever changed/used the texture or orientation state
- of quadObj, we'd need to change it to the defaults here
- with gluQuadricTexture and/or gluQuadricOrientation. */
- gluSphere(quadObj, radius, slices, stacks);
-}
-
-void GLUTAPIENTRY
-glutSolidSphere(GLdouble radius, GLint slices, GLint stacks)
-{
- QUAD_OBJ_INIT();
- gluQuadricDrawStyle(quadObj, GLU_FILL);
- gluQuadricNormals(quadObj, GLU_SMOOTH);
- /* If we ever changed/used the texture or orientation state
- of quadObj, we'd need to change it to the defaults here
- with gluQuadricTexture and/or gluQuadricOrientation. */
- gluSphere(quadObj, radius, slices, stacks);
-}
-
-void GLUTAPIENTRY
-glutWireCone(GLdouble base, GLdouble height,
- GLint slices, GLint stacks)
-{
- QUAD_OBJ_INIT();
- gluQuadricDrawStyle(quadObj, GLU_LINE);
- gluQuadricNormals(quadObj, GLU_SMOOTH);
- /* If we ever changed/used the texture or orientation state
- of quadObj, we'd need to change it to the defaults here
- with gluQuadricTexture and/or gluQuadricOrientation. */
- gluCylinder(quadObj, base, 0.0, height, slices, stacks);
-}
-
-void GLUTAPIENTRY
-glutSolidCone(GLdouble base, GLdouble height,
- GLint slices, GLint stacks)
-{
- QUAD_OBJ_INIT();
- gluQuadricDrawStyle(quadObj, GLU_FILL);
- gluQuadricNormals(quadObj, GLU_SMOOTH);
- /* If we ever changed/used the texture or orientation state
- of quadObj, we'd need to change it to the defaults here
- with gluQuadricTexture and/or gluQuadricOrientation. */
- gluCylinder(quadObj, base, 0.0, height, slices, stacks);
-}
-
-/* ENDCENTRY */
-
-static void
-drawBox(GLfloat size, GLenum type)
-{
- static GLfloat n[6][3] =
- {
- {-1.0, 0.0, 0.0},
- {0.0, 1.0, 0.0},
- {1.0, 0.0, 0.0},
- {0.0, -1.0, 0.0},
- {0.0, 0.0, 1.0},
- {0.0, 0.0, -1.0}
- };
- static GLint faces[6][4] =
- {
- {0, 1, 2, 3},
- {3, 2, 6, 7},
- {7, 6, 5, 4},
- {4, 5, 1, 0},
- {5, 6, 2, 1},
- {7, 4, 0, 3}
- };
- GLfloat v[8][3];
- GLint i;
-
- v[0][0] = v[1][0] = v[2][0] = v[3][0] = -size / 2;
- v[4][0] = v[5][0] = v[6][0] = v[7][0] = size / 2;
- v[0][1] = v[1][1] = v[4][1] = v[5][1] = -size / 2;
- v[2][1] = v[3][1] = v[6][1] = v[7][1] = size / 2;
- v[0][2] = v[3][2] = v[4][2] = v[7][2] = -size / 2;
- v[1][2] = v[2][2] = v[5][2] = v[6][2] = size / 2;
-
- for (i = 5; i >= 0; i--) {
- glBegin(type);
-/* glNormal3fv(&n[i][0]); */
- glVertex3fv(&v[faces[i][0]][0]);
- glVertex3fv(&v[faces[i][1]][0]);
- glVertex3fv(&v[faces[i][2]][0]);
- glVertex3fv(&v[faces[i][3]][0]);
- glEnd();
- }
-}
-
-/* CENTRY */
-void GLUTAPIENTRY
-glutWireCube(GLdouble size)
-{
- drawBox(size, GL_LINE_LOOP);
-}
-
-void GLUTAPIENTRY
-glutSolidCube(GLdouble size)
-{
- drawBox(size, GL_QUADS);
-}
-
-/* ENDCENTRY */
-
-static void
-doughnut(GLfloat r, GLfloat R, GLint nsides, GLint rings)
-{
- int i, j;
- GLfloat theta, phi, theta1;
- GLfloat cosTheta, sinTheta;
- GLfloat cosTheta1, sinTheta1;
- GLfloat ringDelta, sideDelta;
-
- ringDelta = 2.0 * M_PI / rings;
- sideDelta = 2.0 * M_PI / nsides;
-
- theta = 0.0;
- cosTheta = 1.0;
- sinTheta = 0.0;
- for (i = rings - 1; i >= 0; i--) {
- theta1 = theta + ringDelta;
- cosTheta1 = cos(theta1);
- sinTheta1 = sin(theta1);
- glBegin(GL_QUAD_STRIP);
- phi = 0.0;
- for (j = nsides; j >= 0; j--) {
- GLfloat cosPhi, sinPhi, dist;
-
- phi += sideDelta;
- cosPhi = cos(phi);
- sinPhi = sin(phi);
- dist = R + r * cosPhi;
-
-/* glNormal3f(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi); */
- glVertex3f(cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi);
-/* glNormal3f(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi); */
- glVertex3f(cosTheta * dist, -sinTheta * dist, r * sinPhi);
- }
- glEnd();
- theta = theta1;
- cosTheta = cosTheta1;
- sinTheta = sinTheta1;
- }
-}
-
-/* CENTRY */
-void GLUTAPIENTRY
-glutWireTorus(GLdouble innerRadius, GLdouble outerRadius,
- GLint nsides, GLint rings)
-{
-/* glPushAttrib(GL_POLYGON_BIT); */
-/* glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); */
- doughnut(innerRadius, outerRadius, nsides, rings);
-/* glPopAttrib(); */
-}
-
-void GLUTAPIENTRY
-glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius,
- GLint nsides, GLint rings)
-{
- doughnut(innerRadius, outerRadius, nsides, rings);
-}
-
-/* ENDCENTRY */
-
-static GLfloat dodec[20][3];
-
-static void
-initDodecahedron(void)
-{
- GLfloat alpha, beta;
-
- alpha = sqrt(2.0 / (3.0 + sqrt(5.0)));
- beta = 1.0 + sqrt(6.0 / (3.0 + sqrt(5.0)) -
- 2.0 + 2.0 * sqrt(2.0 / (3.0 + sqrt(5.0))));
- /* *INDENT-OFF* */
- dodec[0][0] = -alpha; dodec[0][1] = 0; dodec[0][2] = beta;
- dodec[1][0] = alpha; dodec[1][1] = 0; dodec[1][2] = beta;
- dodec[2][0] = -1; dodec[2][1] = -1; dodec[2][2] = -1;
- dodec[3][0] = -1; dodec[3][1] = -1; dodec[3][2] = 1;
- dodec[4][0] = -1; dodec[4][1] = 1; dodec[4][2] = -1;
- dodec[5][0] = -1; dodec[5][1] = 1; dodec[5][2] = 1;
- dodec[6][0] = 1; dodec[6][1] = -1; dodec[6][2] = -1;
- dodec[7][0] = 1; dodec[7][1] = -1; dodec[7][2] = 1;
- dodec[8][0] = 1; dodec[8][1] = 1; dodec[8][2] = -1;
- dodec[9][0] = 1; dodec[9][1] = 1; dodec[9][2] = 1;
- dodec[10][0] = beta; dodec[10][1] = alpha; dodec[10][2] = 0;
- dodec[11][0] = beta; dodec[11][1] = -alpha; dodec[11][2] = 0;
- dodec[12][0] = -beta; dodec[12][1] = alpha; dodec[12][2] = 0;
- dodec[13][0] = -beta; dodec[13][1] = -alpha; dodec[13][2] = 0;
- dodec[14][0] = -alpha; dodec[14][1] = 0; dodec[14][2] = -beta;
- dodec[15][0] = alpha; dodec[15][1] = 0; dodec[15][2] = -beta;
- dodec[16][0] = 0; dodec[16][1] = beta; dodec[16][2] = alpha;
- dodec[17][0] = 0; dodec[17][1] = beta; dodec[17][2] = -alpha;
- dodec[18][0] = 0; dodec[18][1] = -beta; dodec[18][2] = alpha;
- dodec[19][0] = 0; dodec[19][1] = -beta; dodec[19][2] = -alpha;
- /* *INDENT-ON* */
-
-}
-
-#define DIFF3(_a,_b,_c) { \
- (_c)[0] = (_a)[0] - (_b)[0]; \
- (_c)[1] = (_a)[1] - (_b)[1]; \
- (_c)[2] = (_a)[2] - (_b)[2]; \
-}
-
-static void
-crossprod(GLfloat v1[3], GLfloat v2[3], GLfloat prod[3])
-{
- GLfloat p[3]; /* in case prod == v1 or v2 */
-
- p[0] = v1[1] * v2[2] - v2[1] * v1[2];
- p[1] = v1[2] * v2[0] - v2[2] * v1[0];
- p[2] = v1[0] * v2[1] - v2[0] * v1[1];
- prod[0] = p[0];
- prod[1] = p[1];
- prod[2] = p[2];
-}
-
-static void
-normalize(GLfloat v[3])
-{
- GLfloat d;
-
- d = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
- if (d == 0.0) {
-/* __glutWarning("normalize: zero length vector"); */
- v[0] = d = 1.0;
- }
- d = 1 / d;
- v[0] *= d;
- v[1] *= d;
- v[2] *= d;
-}
-
-static void
-pentagon(int a, int b, int c, int d, int e, GLenum shadeType)
-{
- GLfloat n0[3], d1[3], d2[3];
-
- DIFF3(dodec[a], dodec[b], d1);
- DIFF3(dodec[b], dodec[c], d2);
- crossprod(d1, d2, n0);
- normalize(n0);
-
- glBegin(shadeType);
-/* glNormal3fv(n0); */
- glVertex3fv(&dodec[a][0]);
- glVertex3fv(&dodec[b][0]);
- glVertex3fv(&dodec[c][0]);
- glVertex3fv(&dodec[d][0]);
- glVertex3fv(&dodec[e][0]);
- glEnd();
-}
-
-static void
-dodecahedron(GLenum type)
-{
- static int inited = 0;
-
- if (inited == 0) {
- inited = 1;
- initDodecahedron();
- }
- pentagon(0, 1, 9, 16, 5, type);
- pentagon(1, 0, 3, 18, 7, type);
- pentagon(1, 7, 11, 10, 9, type);
- pentagon(11, 7, 18, 19, 6, type);
- pentagon(8, 17, 16, 9, 10, type);
- pentagon(2, 14, 15, 6, 19, type);
- pentagon(2, 13, 12, 4, 14, type);
- pentagon(2, 19, 18, 3, 13, type);
- pentagon(3, 0, 5, 12, 13, type);
- pentagon(6, 15, 8, 10, 11, type);
- pentagon(4, 17, 8, 15, 14, type);
- pentagon(4, 12, 5, 16, 17, type);
-}
-
-/* CENTRY */
-void GLUTAPIENTRY
-glutWireDodecahedron(void)
-{
- dodecahedron(GL_LINE_LOOP);
-}
-
-void GLUTAPIENTRY
-glutSolidDodecahedron(void)
-{
- dodecahedron(GL_TRIANGLE_FAN);
-}
-
-/* ENDCENTRY */
-
-static void
-recorditem(GLfloat * n1, GLfloat * n2, GLfloat * n3,
- GLenum shadeType)
-{
- GLfloat q0[3], q1[3];
-
- DIFF3(n1, n2, q0);
- DIFF3(n2, n3, q1);
- crossprod(q0, q1, q1);
- normalize(q1);
-
- glBegin(shadeType);
-/* glNormal3fv(q1); */
- glVertex3fv(n1);
- glVertex3fv(n2);
- glVertex3fv(n3);
- glEnd();
-}
-
-static void
-subdivide(GLfloat * v0, GLfloat * v1, GLfloat * v2,
- GLenum shadeType)
-{
- int depth;
- GLfloat w0[3], w1[3], w2[3];
- GLfloat l;
- int i, j, k, n;
-
- depth = 1;
- for (i = 0; i < depth; i++) {
- for (j = 0; i + j < depth; j++) {
- k = depth - i - j;
- for (n = 0; n < 3; n++) {
- w0[n] = (i * v0[n] + j * v1[n] + k * v2[n]) / depth;
- w1[n] = ((i + 1) * v0[n] + j * v1[n] + (k - 1) * v2[n])
- / depth;
- w2[n] = (i * v0[n] + (j + 1) * v1[n] + (k - 1) * v2[n])
- / depth;
- }
- l = sqrt(w0[0] * w0[0] + w0[1] * w0[1] + w0[2] * w0[2]);
- w0[0] /= l;
- w0[1] /= l;
- w0[2] /= l;
- l = sqrt(w1[0] * w1[0] + w1[1] * w1[1] + w1[2] * w1[2]);
- w1[0] /= l;
- w1[1] /= l;
- w1[2] /= l;
- l = sqrt(w2[0] * w2[0] + w2[1] * w2[1] + w2[2] * w2[2]);
- w2[0] /= l;
- w2[1] /= l;
- w2[2] /= l;
- recorditem(w1, w0, w2, shadeType);
- }
- }
-}
-
-static void
-drawtriangle(int i, GLfloat data[][3], int ndx[][3],
- GLenum shadeType)
-{
- GLfloat *x0, *x1, *x2;
-
- x0 = data[ndx[i][0]];
- x1 = data[ndx[i][1]];
- x2 = data[ndx[i][2]];
- subdivide(x0, x1, x2, shadeType);
-}
-
-/* octahedron data: The octahedron produced is centered at the
- origin and has radius 1.0 */
-static GLfloat odata[6][3] =
-{
- {1.0, 0.0, 0.0},
- {-1.0, 0.0, 0.0},
- {0.0, 1.0, 0.0},
- {0.0, -1.0, 0.0},
- {0.0, 0.0, 1.0},
- {0.0, 0.0, -1.0}
-};
-
-static int ondex[8][3] =
-{
- {0, 4, 2},
- {1, 2, 4},
- {0, 3, 4},
- {1, 4, 3},
- {0, 2, 5},
- {1, 5, 2},
- {0, 5, 3},
- {1, 3, 5}
-};
-
-static void
-octahedron(GLenum shadeType)
-{
- int i;
-
- for (i = 7; i >= 0; i--) {
- drawtriangle(i, odata, ondex, shadeType);
- }
-}
-
-/* CENTRY */
-void GLUTAPIENTRY
-glutWireOctahedron(void)
-{
- octahedron(GL_LINE_LOOP);
-}
-
-void GLUTAPIENTRY
-glutSolidOctahedron(void)
-{
- octahedron(GL_TRIANGLES);
-}
-
-/* ENDCENTRY */
-
-/* icosahedron data: These numbers are rigged to make an
- icosahedron of radius 1.0 */
-
-#define X .525731112119133606
-#define Z .850650808352039932
-
-static GLfloat idata[12][3] =
-{
- {-X, 0, Z},
- {X, 0, Z},
- {-X, 0, -Z},
- {X, 0, -Z},
- {0, Z, X},
- {0, Z, -X},
- {0, -Z, X},
- {0, -Z, -X},
- {Z, X, 0},
- {-Z, X, 0},
- {Z, -X, 0},
- {-Z, -X, 0}
-};
-
-static int index[20][3] =
-{
- {0, 4, 1},
- {0, 9, 4},
- {9, 5, 4},
- {4, 5, 8},
- {4, 8, 1},
- {8, 10, 1},
- {8, 3, 10},
- {5, 3, 8},
- {5, 2, 3},
- {2, 7, 3},
- {7, 10, 3},
- {7, 6, 10},
- {7, 11, 6},
- {11, 0, 6},
- {0, 1, 6},
- {6, 1, 10},
- {9, 0, 11},
- {9, 11, 2},
- {9, 2, 5},
- {7, 2, 11},
-};
-
-static void
-icosahedron(GLenum shadeType)
-{
- int i;
-
- for (i = 19; i >= 0; i--) {
- drawtriangle(i, idata, index, shadeType);
- }
-}
-
-/* CENTRY */
-void GLUTAPIENTRY
-glutWireIcosahedron(void)
-{
- icosahedron(GL_LINE_LOOP);
-}
-
-void GLUTAPIENTRY
-glutSolidIcosahedron(void)
-{
- icosahedron(GL_TRIANGLES);
-}
-
-/* ENDCENTRY */
-
-/* tetrahedron data: */
-
-#define T 1.73205080756887729
-
-static GLfloat tdata[4][3] =
-{
- {T, T, T},
- {T, -T, -T},
- {-T, T, -T},
- {-T, -T, T}
-};
-
-static int tndex[4][3] =
-{
- {0, 1, 3},
- {2, 1, 0},
- {3, 2, 0},
- {1, 2, 3}
-};
-
-static void
-tetrahedron(GLenum shadeType)
-{
- int i;
-
- for (i = 3; i >= 0; i--)
- drawtriangle(i, tdata, tndex, shadeType);
-}
-
-/* CENTRY */
-void GLUTAPIENTRY
-glutWireTetrahedron(void)
-{
- tetrahedron(GL_LINE_LOOP);
-}
-
-void GLUTAPIENTRY
-glutSolidTetrahedron(void)
-{
- tetrahedron(GL_TRIANGLES);
-}
-
-/* ENDCENTRY */
diff --git a/src/glut/directfb/overlay.c b/src/glut/directfb/overlay.c
deleted file mode 100644
index 714be5f1a2..0000000000
--- a/src/glut/directfb/overlay.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include "internal.h"
-
-
-void GLUTAPIENTRY
-glutEstablishOverlay( void )
-{
-}
-
-
-void GLUTAPIENTRY
-glutRemoveOverlay( void )
-{
-}
-
-
-void GLUTAPIENTRY
-glutUseLayer( GLenum layer )
-{
-}
-
-
-void GLUTAPIENTRY
-glutPostOverlayRedisplay( void )
-{
-}
-
-
-void GLUTAPIENTRY
-glutPostWindowOverlayRedisplay( int win )
-{
-}
-
-
-void GLUTAPIENTRY
-glutShowOverlay( void )
-{
-}
-
-
-void GLUTAPIENTRY
-glutHideOverlay( void )
-{
-}
diff --git a/src/glut/directfb/state.c b/src/glut/directfb/state.c
deleted file mode 100644
index 194d5bbb62..0000000000
--- a/src/glut/directfb/state.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-#include "GL/glu.h"
-
-#include "internal.h"
-
-
-int GLUTAPIENTRY
-glutGet( GLenum type )
-{
- switch (type) {
- case GLUT_WINDOW_X:
- if (g_current && g_current->window) {
- int x;
- g_current->window->GetPosition( g_current->window, &x, 0 );
- return x;
- }
- break;
- case GLUT_WINDOW_Y:
- if (g_current && g_current->window) {
- int y;
- g_current->window->GetPosition( g_current->window, 0, &y );
- return y;
- }
- break;
-
- case GLUT_WINDOW_WIDTH:
- if (g_current) {
- int w;
- g_current->surface->GetSize( g_current->surface, &w, 0 );
- return w;
- }
- break;
- case GLUT_WINDOW_HEIGHT:
- if (g_current) {
- int h;
- g_current->surface->GetSize( g_current->surface, 0, &h );
- return h;
- }
- break;
-
- case GLUT_WINDOW_BUFFER_SIZE:
- if (g_current) {
- DFBGLAttributes a;
- g_current->gl->GetAttributes( g_current->gl, &a );
- return a.buffer_size;
- }
- break;
- case GLUT_WINDOW_STENCIL_SIZE:
- if (g_current) {
- DFBGLAttributes a;
- g_current->gl->GetAttributes( g_current->gl, &a );
- return a.stencil_size;
- }
- break;
- case GLUT_WINDOW_DEPTH_SIZE:
- if (g_current) {
- DFBGLAttributes a;
- g_current->gl->GetAttributes( g_current->gl, &a );
- return a.depth_size;
- }
- break;
- case GLUT_WINDOW_RED_SIZE:
- if (g_current) {
- DFBGLAttributes a;
- g_current->gl->GetAttributes( g_current->gl, &a );
- return a.red_size;
- }
- break;
- case GLUT_WINDOW_GREEN_SIZE:
- if (g_current) {
- DFBGLAttributes a;
- g_current->gl->GetAttributes( g_current->gl, &a );
- return a.green_size;
- }
- break;
- case GLUT_WINDOW_BLUE_SIZE:
- if (g_current) {
- DFBGLAttributes a;
- g_current->gl->GetAttributes( g_current->gl, &a );
- return a.blue_size;
- }
- break;
- case GLUT_WINDOW_ALPHA_SIZE:
- if (g_current) {
- DFBGLAttributes a;
- g_current->gl->GetAttributes( g_current->gl, &a );
- return a.alpha_size;
- }
- break;
- case GLUT_WINDOW_ACCUM_RED_SIZE:
- if (g_current) {
- DFBGLAttributes a;
- g_current->gl->GetAttributes( g_current->gl, &a );
- return a.accum_red_size;
- }
- break;
- case GLUT_WINDOW_ACCUM_GREEN_SIZE:
- if (g_current) {
- DFBGLAttributes a;
- g_current->gl->GetAttributes( g_current->gl, &a );
- return a.accum_green_size;
- }
- break;
- case GLUT_WINDOW_ACCUM_BLUE_SIZE:
- if (g_current) {
- DFBGLAttributes a;
- g_current->gl->GetAttributes( g_current->gl, &a );
- return a.accum_blue_size;
- }
- break;
- case GLUT_WINDOW_ACCUM_ALPHA_SIZE:
- if (g_current) {
- DFBGLAttributes a;
- g_current->gl->GetAttributes( g_current->gl, &a );
- return a.accum_alpha_size;
- }
- break;
- case GLUT_WINDOW_DOUBLEBUFFER:
- if (g_current) {
- DFBGLAttributes a;
- g_current->gl->GetAttributes( g_current->gl, &a );
- return a.double_buffer;
- }
- break;
-
- case GLUT_WINDOW_RGBA:
- return 1;
-
- case GLUT_WINDOW_CURSOR:
- if (g_current)
- return g_current->cursor;
- break;
-
- case GLUT_SCREEN_WIDTH:
- if (primary) {
- DFBDisplayLayerConfig c;
- primary->GetConfiguration( primary, &c );
- return c.width;
- }
- break;
- case GLUT_SCREEN_HEIGHT:
- if (primary) {
- DFBDisplayLayerConfig c;
- primary->GetConfiguration( primary, &c );
- return c.height;
- }
- break;
-
- case GLUT_INIT_DISPLAY_MODE:
- return g_display_mode;
- case GLUT_INIT_WINDOW_X:
- return g_xpos;
- case GLUT_INIT_WINDOW_Y:
- return g_ypos;
- case GLUT_INIT_WINDOW_WIDTH:
- return g_width;
- case GLUT_INIT_WINDOW_HEIGHT:
- return g_height;
-
- case GLUT_ELAPSED_TIME:
- {
- static long long start = -1;
- struct timeval t;
-
- gettimeofday( &t, NULL );
- if (start == -1) {
- start = t.tv_sec * 1000ll + t.tv_usec / 1000ll;
- return 0;
- }
- return (t.tv_sec * 1000ll + t.tv_usec / 1000ll - start);
- }
- break;
-
- default:
- break;
- }
-
- return 0;
-}
-
-
-int GLUTAPIENTRY
-glutLayerGet( GLenum type )
-{
- return 0;
-}
-
-void GLUTAPIENTRY
-glutReportErrors( void )
-{
- GLenum error;
-
- while ((error = glGetError()) != GL_NO_ERROR)
- __glutWarning( "**OpenGL Error** %s", gluErrorString( error ) );
-}
-
-
diff --git a/src/glut/directfb/teapot.c b/src/glut/directfb/teapot.c
deleted file mode 100644
index e7f1ee812f..0000000000
--- a/src/glut/directfb/teapot.c
+++ /dev/null
@@ -1,212 +0,0 @@
-
-/* Copyright (c) Mark J. Kilgard, 1994. */
-
-/**
-(c) Copyright 1993, Silicon Graphics, Inc.
-
-ALL RIGHTS RESERVED
-
-Permission to use, copy, modify, and distribute this software
-for any purpose and without fee is hereby granted, provided
-that the above copyright notice appear in all copies and that
-both the copyright notice and this permission notice appear in
-supporting documentation, and that the name of Silicon
-Graphics, Inc. not be used in advertising or publicity
-pertaining to distribution of the software without specific,
-written prior permission.
-
-THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU
-"AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR
-OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO
-EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE
-ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR
-CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER,
-INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE,
-SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR
-NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF THE POSSIBILITY
-OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR
-PERFORMANCE OF THIS SOFTWARE.
-
-US Government Users Restricted Rights
-
-Use, duplication, or disclosure by the Government is subject to
-restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
-(c)(1)(ii) of the Rights in Technical Data and Computer
-Software clause at DFARS 252.227-7013 and/or in similar or
-successor clauses in the FAR or the DOD or NASA FAR
-Supplement. Unpublished-- rights reserved under the copyright
-laws of the United States. Contractor/manufacturer is Silicon
-Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA
-94039-7311.
-
-OpenGL(TM) is a trademark of Silicon Graphics, Inc.
-*/
-
-#include <GL/gl.h>
-#include <GL/glu.h>
-#include "GL/glut.h"
-
-/* Rim, body, lid, and bottom data must be reflected in x and
- y; handle and spout data across the y axis only. */
-
-static int patchdata[][16] =
-{
- /* rim */
- {102, 103, 104, 105, 4, 5, 6, 7, 8, 9, 10, 11,
- 12, 13, 14, 15},
- /* body */
- {12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27},
- {24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36,
- 37, 38, 39, 40},
- /* lid */
- {96, 96, 96, 96, 97, 98, 99, 100, 101, 101, 101,
- 101, 0, 1, 2, 3,},
- {0, 1, 2, 3, 106, 107, 108, 109, 110, 111, 112,
- 113, 114, 115, 116, 117},
- /* bottom */
- {118, 118, 118, 118, 124, 122, 119, 121, 123, 126,
- 125, 120, 40, 39, 38, 37},
- /* handle */
- {41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
- 53, 54, 55, 56},
- {53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- 28, 65, 66, 67},
- /* spout */
- {68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83},
- {80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
- 92, 93, 94, 95}
-};
-/* *INDENT-OFF* */
-
-static float cpdata[][3] =
-{
- {0.2, 0, 2.7}, {0.2, -0.112, 2.7}, {0.112, -0.2, 2.7}, {0,
- -0.2, 2.7}, {1.3375, 0, 2.53125}, {1.3375, -0.749, 2.53125},
- {0.749, -1.3375, 2.53125}, {0, -1.3375, 2.53125}, {1.4375,
- 0, 2.53125}, {1.4375, -0.805, 2.53125}, {0.805, -1.4375,
- 2.53125}, {0, -1.4375, 2.53125}, {1.5, 0, 2.4}, {1.5, -0.84,
- 2.4}, {0.84, -1.5, 2.4}, {0, -1.5, 2.4}, {1.75, 0, 1.875},
- {1.75, -0.98, 1.875}, {0.98, -1.75, 1.875}, {0, -1.75,
- 1.875}, {2, 0, 1.35}, {2, -1.12, 1.35}, {1.12, -2, 1.35},
- {0, -2, 1.35}, {2, 0, 0.9}, {2, -1.12, 0.9}, {1.12, -2,
- 0.9}, {0, -2, 0.9}, {-2, 0, 0.9}, {2, 0, 0.45}, {2, -1.12,
- 0.45}, {1.12, -2, 0.45}, {0, -2, 0.45}, {1.5, 0, 0.225},
- {1.5, -0.84, 0.225}, {0.84, -1.5, 0.225}, {0, -1.5, 0.225},
- {1.5, 0, 0.15}, {1.5, -0.84, 0.15}, {0.84, -1.5, 0.15}, {0,
- -1.5, 0.15}, {-1.6, 0, 2.025}, {-1.6, -0.3, 2.025}, {-1.5,
- -0.3, 2.25}, {-1.5, 0, 2.25}, {-2.3, 0, 2.025}, {-2.3, -0.3,
- 2.025}, {-2.5, -0.3, 2.25}, {-2.5, 0, 2.25}, {-2.7, 0,
- 2.025}, {-2.7, -0.3, 2.025}, {-3, -0.3, 2.25}, {-3, 0,
- 2.25}, {-2.7, 0, 1.8}, {-2.7, -0.3, 1.8}, {-3, -0.3, 1.8},
- {-3, 0, 1.8}, {-2.7, 0, 1.575}, {-2.7, -0.3, 1.575}, {-3,
- -0.3, 1.35}, {-3, 0, 1.35}, {-2.5, 0, 1.125}, {-2.5, -0.3,
- 1.125}, {-2.65, -0.3, 0.9375}, {-2.65, 0, 0.9375}, {-2,
- -0.3, 0.9}, {-1.9, -0.3, 0.6}, {-1.9, 0, 0.6}, {1.7, 0,
- 1.425}, {1.7, -0.66, 1.425}, {1.7, -0.66, 0.6}, {1.7, 0,
- 0.6}, {2.6, 0, 1.425}, {2.6, -0.66, 1.425}, {3.1, -0.66,
- 0.825}, {3.1, 0, 0.825}, {2.3, 0, 2.1}, {2.3, -0.25, 2.1},
- {2.4, -0.25, 2.025}, {2.4, 0, 2.025}, {2.7, 0, 2.4}, {2.7,
- -0.25, 2.4}, {3.3, -0.25, 2.4}, {3.3, 0, 2.4}, {2.8, 0,
- 2.475}, {2.8, -0.25, 2.475}, {3.525, -0.25, 2.49375},
- {3.525, 0, 2.49375}, {2.9, 0, 2.475}, {2.9, -0.15, 2.475},
- {3.45, -0.15, 2.5125}, {3.45, 0, 2.5125}, {2.8, 0, 2.4},
- {2.8, -0.15, 2.4}, {3.2, -0.15, 2.4}, {3.2, 0, 2.4}, {0, 0,
- 3.15}, {0.8, 0, 3.15}, {0.8, -0.45, 3.15}, {0.45, -0.8,
- 3.15}, {0, -0.8, 3.15}, {0, 0, 2.85}, {1.4, 0, 2.4}, {1.4,
- -0.784, 2.4}, {0.784, -1.4, 2.4}, {0, -1.4, 2.4}, {0.4, 0,
- 2.55}, {0.4, -0.224, 2.55}, {0.224, -0.4, 2.55}, {0, -0.4,
- 2.55}, {1.3, 0, 2.55}, {1.3, -0.728, 2.55}, {0.728, -1.3,
- 2.55}, {0, -1.3, 2.55}, {1.3, 0, 2.4}, {1.3, -0.728, 2.4},
- {0.728, -1.3, 2.4}, {0, -1.3, 2.4}, {0, 0, 0}, {1.425,
- -0.798, 0}, {1.5, 0, 0.075}, {1.425, 0, 0}, {0.798, -1.425,
- 0}, {0, -1.5, 0.075}, {0, -1.425, 0}, {1.5, -0.84, 0.075},
- {0.84, -1.5, 0.075}
-};
-
-static float tex[2][2][2] =
-{
- { {0, 0},
- {1, 0}},
- { {0, 1},
- {1, 1}}
-};
-
-/* *INDENT-ON* */
-
-static void
-teapot(GLint grid, GLdouble scale, GLenum type)
-{
- float p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3];
- long i, j, k, l;
-
- glPushAttrib(GL_ENABLE_BIT | GL_EVAL_BIT);
- glEnable(GL_AUTO_NORMAL);
- glEnable(GL_NORMALIZE);
- glEnable(GL_MAP2_VERTEX_3);
- glEnable(GL_MAP2_TEXTURE_COORD_2);
- glPushMatrix();
- glRotatef(270.0, 1.0, 0.0, 0.0);
- glScalef(0.5 * scale, 0.5 * scale, 0.5 * scale);
- glTranslatef(0.0, 0.0, -1.5);
- for (i = 0; i < 10; i++) {
- for (j = 0; j < 4; j++) {
- for (k = 0; k < 4; k++) {
- for (l = 0; l < 3; l++) {
- p[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l];
- q[j][k][l] = cpdata[patchdata[i][j * 4 + (3 - k)]][l];
- if (l == 1)
- q[j][k][l] *= -1.0;
- if (i < 6) {
- r[j][k][l] =
- cpdata[patchdata[i][j * 4 + (3 - k)]][l];
- if (l == 0)
- r[j][k][l] *= -1.0;
- s[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l];
- if (l == 0)
- s[j][k][l] *= -1.0;
- if (l == 1)
- s[j][k][l] *= -1.0;
- }
- }
- }
- }
- glMap2f(GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2,
- &tex[0][0][0]);
- glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
- &p[0][0][0]);
- glMapGrid2f(grid, 0.0, 1.0, grid, 0.0, 1.0);
- glEvalMesh2(type, 0, grid, 0, grid);
- glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
- &q[0][0][0]);
- glEvalMesh2(type, 0, grid, 0, grid);
- if (i < 6) {
- glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
- &r[0][0][0]);
- glEvalMesh2(type, 0, grid, 0, grid);
- glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
- &s[0][0][0]);
- glEvalMesh2(type, 0, grid, 0, grid);
- }
- }
- glPopMatrix();
- glPopAttrib();
-}
-
-/* CENTRY */
-void GLUTAPIENTRY
-glutSolidTeapot(GLdouble scale)
-{
- teapot(7, scale, GL_FILL);
-}
-
-void GLUTAPIENTRY
-glutWireTeapot(GLdouble scale)
-{
- teapot(10, scale, GL_LINE);
-}
-
-/* ENDCENTRY */
diff --git a/src/glut/directfb/window.c b/src/glut/directfb/window.c
deleted file mode 100644
index 62cf8bb33e..0000000000
--- a/src/glut/directfb/window.c
+++ /dev/null
@@ -1,597 +0,0 @@
-/*
- * Copyright (C) 2006 Claudio Ciccani <klan@users.sf.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "internal.h"
-
-
-/*****************************************************************************/
-
-static __GlutWindow *g_stack = NULL;
-
-/*****************************************************************************/
-
-
-__GlutWindow*
-__glutCreateWindow( GLboolean fullscreen )
-{
- __GlutWindow *new;
- DFBResult ret;
- static int curid = 1;
-
- new = calloc( 1, sizeof(__GlutWindow) );
- if (!new)
- __glutFatalError( "out of memory" );
-
- new->id = curid++;
-
- if (fullscreen) {
- DFBDisplayLayerConfig config;
- DFBDisplayLayerConfigFlags fail = 0;
-
- config.flags = DLCONF_WIDTH | DLCONF_HEIGHT |
- DLCONF_BUFFERMODE;
- config.width = g_width;
- config.height = g_height;
-
- if (g_display_mode & GLUT_DOUBLE)
- config.buffermode = DLBM_BACKVIDEO;
- else
- config.buffermode = DLBM_FRONTONLY;
-
- if (g_bpp) {
- config.flags |= DLCONF_PIXELFORMAT;
-
- switch (g_bpp) {
- case 8:
- config.pixelformat = DSPF_RGB332;
- break;
- case 12:
- config.pixelformat = DSPF_ARGB4444;
- break;
- case 15:
- config.pixelformat = DSPF_ARGB1555;
- break;
- case 16:
- config.pixelformat = DSPF_RGB16;
- break;
- case 24:
- case 32:
- config.pixelformat = DSPF_RGB32;
- break;
- default:
- config.flags &= ~DLCONF_PIXELFORMAT;
- break;
- }
- }
-
- primary->TestConfiguration( primary, &config, &fail );
- config.flags &= ~fail;
- primary->SetConfiguration( primary, &config );
-
- ret = primary->GetSurface( primary, &new->surface );
- if (ret) {
- DirectFBError( "IDirectFBDisplayLayer::GetSurface()", ret );
- free( new );
- return NULL;
- }
-
- ret = new->surface->GetGL( new->surface, &new->gl );
- if (ret) {
- DirectFBError( "IDirectFBSurface::GetGL()", ret );
- new->surface->Release( new->surface );
- free( new );
- return NULL;
- }
-
- events->Reset( events );
- if (keyboard)
- keyboard->AttachEventBuffer( keyboard, events );
- if (mouse)
- mouse->AttachEventBuffer( mouse, events );
- if (joystick)
- joystick->AttachEventBuffer( joystick, events );
-
- new->visible = GL_TRUE;
- }
- else {
- DFBWindowDescription dsc;
-
- dsc.flags = DWDESC_CAPS | DWDESC_POSX | DWDESC_POSY |
- DWDESC_WIDTH | DWDESC_HEIGHT;
- dsc.caps = DWCAPS_NONE;
- dsc.posx = g_xpos;
- dsc.posy = g_ypos;
- dsc.width = g_width;
- dsc.height = g_height;
-
- if (g_display_mode & GLUT_DOUBLE)
- dsc.caps |= DWCAPS_DOUBLEBUFFER;
- if (g_display_mode & GLUT_ALPHA)
- dsc.caps |= DWCAPS_ALPHACHANNEL;
-
- ret = primary->CreateWindow( primary, &dsc, &new->window );
- if (ret) {
- DirectFBError( "IDirectFBDisplayLayer::CreateWindow()", ret );
- free( new );
- return NULL;
- }
-
- new->window->GetID( new->window, &new->wid );
-
- ret = new->window->GetSurface( new->window, &new->surface );
- if (ret) {
- DirectFBError( "IDirectFBWindow::GetSurface()", ret );
- new->window->Release( new->window );
- free( new );
- return NULL;
- }
-
- ret = new->surface->GetGL( new->surface, &new->gl );
- if (ret) {
- DirectFBError( "IDirectFBSurface::GetGl()", ret );
- new->surface->Release( new->surface );
- new->window->Release( new->window );
- free( new );
- return NULL;
- }
-
- new->window->AttachEventBuffer( new->window, events );
- /* enable only handled events */
- new->window->DisableEvents( new->window, DWET_ALL );
- new->window->EnableEvents( new->window, DWET_KEYDOWN | DWET_KEYUP |
- DWET_BUTTONDOWN | DWET_BUTTONUP |
- DWET_ENTER | DWET_LEAVE |
- DWET_MOTION | DWET_SIZE );
-
- new->req.flags |= WINDOW_REQUEST_SHOW;
- }
-
- new->mode = g_display_mode;
-
- new->reshape = GL_TRUE;
- new->visibility = GL_TRUE;
- new->redisplay = GL_TRUE;
-
- if (g_stack) {
- new->prev = g_stack->prev;
- g_stack->prev->next = new;
- g_stack->prev = new;
- }
- else {
- new->prev = new;
- g_stack = new;
- }
-
- return new;
-}
-
-
-__GlutWindow*
-__glutFindWindow( DFBWindowID id )
-{
- __GlutWindow *cur;
-
- for (cur = g_stack; cur; cur = cur->next) {
- if (cur->wid == id)
- return cur;
- }
-
- __glutFatalError( "Window %d not found", id );
-
- return NULL;
-}
-
-
-void
-__glutSetWindow( __GlutWindow *window )
-{
- if (g_current) {
- if (g_current == window)
- return;
- g_current->gl->Unlock( g_current->gl );
- }
-
- if (window)
- window->gl->Lock( window->gl );
- g_current = window;
-}
-
-
-void
-__glutHandleWindows( void )
-{
- __GlutWindow *cur = g_stack;
-
- while (cur) {
- __GlutWindow *next = cur->next;
- GLboolean displayed = GL_FALSE;
-
- if (cur->window && cur->req.flags) {
- if (cur == g_current)
- cur->gl->Unlock( cur->gl );
-
- if (cur->req.flags & WINDOW_REQUEST_DESTROY) {
- __glutDestroyWindow( cur );
- cur = next;
- continue;
- }
-
- if (cur->req.flags & WINDOW_REQUEST_POSITION) {
- cur->window->MoveTo( cur->window,
- cur->req.x, cur->req.y );
- }
-
- if (cur->req.flags & WINDOW_REQUEST_RESIZE) {
- cur->window->Resize( cur->window,
- cur->req.w, cur->req.h );
- cur->reshape = GL_TRUE;
- cur->redisplay = GL_TRUE;
- }
-
- if (cur->req.flags & WINDOW_REQUEST_RESTACK) {
- while (cur->req.z > 0) {
- if (cur->req.z >= +1000) {
- cur->window->RaiseToTop( cur->window );
- cur->req.z = 0;
- break;
- }
-
- cur->window->Raise( cur->window );
- cur->req.z--;
- }
-
- while (cur->req.z < 0) {
- if (cur->req.z <= -1000) {
- cur->window->LowerToBottom( cur->window );
- cur->req.z = 0;
- break;
- }
-
- cur->window->Lower( cur->window );
- cur->req.z++;
- }
- }
-
- if (cur->req.flags & WINDOW_REQUEST_SHOW) {
- cur->window->SetOpacity( cur->window, 0xff );
- cur->visible = GL_TRUE;
- cur->visibility = GL_TRUE;
- }
- else if (cur->req.flags & WINDOW_REQUEST_HIDE) {
- cur->window->SetOpacity( cur->window, 0x00 );
- cur->visible = GL_FALSE;
- cur->visibility = GL_TRUE;
- }
-
- cur->req.flags = 0;
-
- if (cur == g_current)
- cur->gl->Lock( cur->gl );
- }
-
- if (cur->reshape && reshape_func) {
- int w, h;
- g_idle = GL_FALSE;
- cur->surface->GetSize( cur->surface, &w, &h );
- __glutSetWindow( cur );
- reshape_func( w, h );
- displayed = GL_TRUE;
- }
-
- if (cur->visibility && visibility_func) {
- g_idle = GL_FALSE;
- __glutSetWindow( cur );
- visibility_func( cur->visible ? GLUT_VISIBLE : GLUT_NOT_VISIBLE );
- displayed = GL_TRUE;
- }
-
- if (cur->redisplay && display_func) {
- g_idle = GL_FALSE;
- __glutSetWindow( cur );
- display_func();
- displayed = GL_TRUE;
- }
-
- if (displayed && cur->window && cur->visible) {
- if (!(cur->mode & GLUT_DOUBLE)) {
- cur->gl->Unlock( cur->gl );
- cur->surface->Flip( cur->surface, NULL, 0 );
- cur->gl->Lock( cur->gl );
- }
- }
-
- cur->reshape = GL_FALSE;
- cur->visibility = GL_FALSE;
- cur->redisplay = GL_FALSE;
-
- cur = next;
- }
-}
-
-
-void
-__glutDestroyWindow( __GlutWindow *window )
-{
- __GlutWindow *next = window->next;
- __GlutWindow *prev = window->prev;
-
- __glutAssert( window != NULL );
-
- if (window == g_current)
- g_current = NULL;
- if (window == g_game)
- g_game = NULL;
-
- window->gl->Unlock( window->gl );
- window->gl->Release( window->gl );
- window->surface->Release( window->surface );
-
- if (window->window) {
-#if DIRECTFB_VERSION_CODE >= VERSION_CODE(0,9,26)
- window->window->DetachEventBuffer( window->window, events );
-#else
- window->window->Destroy( window->window );
-#endif
- window->window->Release( window->window );
- }
- else {
-#if DIRECTFB_VERSION_CODE >= VERSION_CODE(0,9,26)
- if (joystick)
- joystick->DetachEventBuffer( joystick, events );
- if (mouse)
- mouse->DetachEventBuffer( mouse, events );
- if (keyboard)
- keyboard->DetachEventBuffer( keyboard, events );
-#endif
- events->Reset( events );
- }
-
- free( window );
-
- if (next)
- next->prev = prev;
- else
- g_stack->prev = prev;
-
- if (window == g_stack)
- g_stack = next;
- else
- prev->next = next;
-}
-
-
-void
-__glutDestroyWindows( void )
-{
- __GlutWindow *cur = g_stack;
-
- while (cur) {
- __GlutWindow *next = cur->next;
- __glutDestroyWindow( cur );
- cur = next;
- }
-}
-
-
-int GLUTAPIENTRY
-glutCreateWindow( const char *title )
-{
- __GlutWindow *window;
-
- if (getenv( "__GLUT_GAME_MODE" ))
- return glutEnterGameMode();
-
- glutInit( NULL, NULL );
-
- window = __glutCreateWindow( GL_FALSE );
- if (!window)
- return 0;
-
- __glutSetWindow( window );
- glutSetCursor( GLUT_CURSOR_INHERIT );
-
- return window->id;
-}
-
-
-int GLUTAPIENTRY
-glutCreateSubWindow( int win, int x, int y, int width, int height )
-{
- return GL_FALSE;
-}
-
-
-void GLUTAPIENTRY
-glutDestroyWindow( int win )
-{
- __GlutWindow *cur;
-
- for (cur = g_stack; cur; cur = cur->next) {
- if (cur->id == win) {
- if (cur->window)
- cur->window->Destroy( cur->window );
-
- cur->req.flags |= WINDOW_REQUEST_DESTROY;
- break;
- }
- }
-}
-
-
-void GLUTAPIENTRY
-glutPostRedisplay( void )
-{
- if (g_current)
- g_current->redisplay = GL_TRUE;
-}
-
-
-void GLUTAPIENTRY
-glutPostWindowRedisplay( int win )
-{
- __GlutWindow *cur;
-
- for (cur = g_stack; cur; cur = cur->next) {
- if (cur->id == win) {
- cur->redisplay = GL_TRUE;
- break;
- }
- }
-}
-
-
-void GLUTAPIENTRY
-glutSwapBuffers( void )
-{
- if (g_current) {
- g_current->gl->Unlock( g_current->gl );
- g_current->surface->Flip( g_current->surface, NULL, 0 );
- g_current->gl->Lock( g_current->gl );
- }
-}
-
-
-int GLUTAPIENTRY
-glutGetWindow( void )
-{
- return (g_current) ? g_current->id : 0;
-}
-
-
-void GLUTAPIENTRY
-glutSetWindow( int win )
-{
- __GlutWindow *cur;
-
- if (g_current && g_current->id == win)
- return;
-
- for (cur = g_stack; cur; cur = cur->next) {
- if (cur->id == win) {
- __glutSetWindow( cur );
- break;
- }
- }
-}
-
-
-void GLUTAPIENTRY
-glutSetWindowTitle( const char *title )
-{
-}
-
-
-void GLUTAPIENTRY
-glutSetIconTitle( const char *title )
-{
-}
-
-
-void GLUTAPIENTRY
-glutFullScreen( void )
-{
- if (g_current && !g_game) {
- DFBDisplayLayerConfig config;
-
- primary->GetConfiguration( primary, &config );
-
- g_current->req.flags |= WINDOW_REQUEST_POSITION |
- WINDOW_REQUEST_RESIZE |
- WINDOW_REQUEST_RESTACK;
- g_current->req.x = 0;
- g_current->req.y = 0;
- g_current->req.w = config.width;
- g_current->req.h = config.height;
- g_current->req.z = 1000;
- }
-}
-
-
-void GLUTAPIENTRY
-glutPositionWindow( int x, int y )
-{
- if (g_current && !g_game) {
- g_current->req.flags |= WINDOW_REQUEST_POSITION;
- g_current->req.x = x;
- g_current->req.y = y;
- }
-}
-
-
-void GLUTAPIENTRY
-glutReshapeWindow( int width, int height )
-{
- if (g_current && !g_game) {
- g_current->req.flags |= WINDOW_REQUEST_RESIZE;
- g_current->req.w = width;
- g_current->req.h = height;
- }
-}
-
-
-void GLUTAPIENTRY
-glutPopWindow( void )
-{
- if (g_current && !g_game) {
- g_current->req.flags |= WINDOW_REQUEST_RESTACK;
- g_current->req.z--;
- }
-}
-
-
-void GLUTAPIENTRY
-glutPushWindow( void )
-{
- if (g_current && !g_game) {
- g_current->req.flags |= WINDOW_REQUEST_RESTACK;
- g_current->req.z++;
- }
-}
-
-
-void GLUTAPIENTRY
-glutIconifyWindow( void )
-{
-}
-
-
-void GLUTAPIENTRY
-glutShowWindow( void )
-{
- if (g_current && !g_game) {
- g_current->req.flags |= WINDOW_REQUEST_SHOW;
- g_current->req.flags &= ~WINDOW_REQUEST_HIDE;
- }
-}
-
-
-void GLUTAPIENTRY
-glutHideWindow( void )
-{
- if (g_current && !g_game) {
- g_current->req.flags |= WINDOW_REQUEST_HIDE;
- g_current->req.flags &= ~WINDOW_REQUEST_SHOW;
- }
-}
-
diff --git a/src/mesa/drivers/directfb/Makefile b/src/mesa/drivers/directfb/Makefile
deleted file mode 100644
index 94c82a2c9c..0000000000
--- a/src/mesa/drivers/directfb/Makefile
+++ /dev/null
@@ -1,67 +0,0 @@
-# src/mesa/drivers/directfb/Makefile
-
-TOP = ../../../..
-
-include $(TOP)/configs/current
-
-
-INCLUDE_DIRS = \
- -I$(TOP)/include \
- -I$(TOP)/src/mesa \
- -I$(TOP)/src/mesa/main \
- -I$(TOP)/src/mesa/glapi \
- -I$(TOP)/src/mesa/math \
- -I$(TOP)/src/mesa/tnl \
- -I$(TOP)/src/mesa/shader \
- -I$(TOP)/src/mesa/swrast \
- -I$(TOP)/src/mesa/swrast_setup
-
-DFB_CFLAGS = $(shell pkg-config --cflags directfb)
-DFB_MODULEDIR = $(shell pkg-config --variable=moduledir directfb-internal)
-
-DIRECTFBGL_MESA_SOURCES = ../common/driverfuncs.c idirectfbgl_mesa.c
-
-DIRECTFBGL_MESA_OBJECTS = $(DIRECTFBGL_MESA_SOURCES:.c=.o)
-
-DIRECTFBGL_MESA = libidirectfbgl_mesa.so
-
-LIBS = $(TOP)/src/mesa/libmesa.a $(TOP)/src/mesa/libglapi.a
-
-
-.c.o:
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(DFB_CFLAGS) $< -o $@
-
-
-default: directfb-libgl directfbgl_mesa
-
-
-# XXX this used to be in src/mesa/Makefile and is probably broken now
-directfb-libgl: $(LIBS)
- @ $(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
- -major $(MESA_MAJOR) -minor $(MESA_MINOR) -patch $(MESA_TINY) \
- -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) $(LIBS) \
- $(GL_LIB_DEPS)
-
-
-
-# Mesa DirectFBGL module
-directfbgl_mesa: $(DIRECTFBGL_MESA_OBJECTS)
- $(CC) -shared $(CFLAGS) $(DIRECTFBGL_MESA_OBJECTS) -o $(DIRECTFBGL_MESA) \
- -Wl,-soname -Wl,$(DIRECTFBGL_MESA) -L$(TOP)/$(LIB_DIR) -lGL -lm
-
-
-install:
- @if test -d $(DFB_MODULEDIR); then \
- echo "Installing DirectFBGL module."; \
- else \
- echo "*** Failed to determine DirectFB module's directory."; \
- echo "*** Installation aborted."; \
- exit 1; \
- fi;
- test -d $(DFB_MODULEDIR)/interfaces/IDirectFBGL/ || mkdir $(DFB_MODULEDIR)/interfaces/IDirectFBGL/
- install -m 755 $(DIRECTFBGL_MESA) $(DFB_MODULEDIR)/interfaces/IDirectFBGL/
-
-
-clean:
- -rm -f *.o *.so
-
diff --git a/src/mesa/drivers/directfb/idirectfbgl_mesa.c b/src/mesa/drivers/directfb/idirectfbgl_mesa.c
deleted file mode 100644
index 85a6f03672..0000000000
--- a/src/mesa/drivers/directfb/idirectfbgl_mesa.c
+++ /dev/null
@@ -1,982 +0,0 @@
-/*
- * Copyright (C) 2004-2007 Claudio Ciccani <klan@directfb.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- *
- * Based on glfbdev.c, written by Brian Paul.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <pthread.h>
-
-#include <directfb.h>
-#include <directfb_version.h>
-
-#include <directfbgl.h>
-
-#include <direct/mem.h>
-#include <direct/messages.h>
-#include <direct/interface.h>
-
-#undef CLAMP
-#include "main/glheader.h"
-#include "main/buffers.h"
-#include "main/context.h"
-#include "main/extensions.h"
-#include "main/framebuffer.h"
-#include "main/renderbuffer.h"
-#include "main/imports.h"
-#include "main/texformat.h"
-#include "main/teximage.h"
-#include "main/texstore.h"
-#include "vbo/vbo.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 "drivers/common/driverfuncs.h"
-
-
-#define VERSION_CODE( M, m, r ) (((M) * 1000) + ((m) * 100) + ((r)))
-#define DIRECTFB_VERSION_CODE VERSION_CODE( DIRECTFB_MAJOR_VERSION, \
- DIRECTFB_MINOR_VERSION, \
- DIRECTFB_MICRO_VERSION )
-
-
-static DFBResult
-Probe( void *data );
-
-static DFBResult
-Construct( IDirectFBGL *thiz,
- IDirectFBSurface *surface );
-
-#include <direct/interface_implementation.h>
-
-DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBGL, Mesa )
-
-/*
- * private data struct of IDirectFBGL
- */
-typedef struct {
- int ref; /* reference counter */
-
- int locked;
-
- IDirectFBSurface *surface;
- DFBSurfacePixelFormat format;
- int width;
- int height;
-
- struct {
- GLubyte *start;
- GLubyte *end;
- int pitch;
- } video;
-
- GLvisual visual;
- GLframebuffer framebuffer;
- GLcontext context;
- struct gl_renderbuffer render;
-} IDirectFBGL_data;
-
-/******************************************************************************/
-
-static pthread_mutex_t global_lock = PTHREAD_MUTEX_INITIALIZER;
-static unsigned int global_ref = 0;
-
-static INLINE int directfbgl_init( void )
-{
- pthread_mutexattr_t attr;
- int ret;
-
- if (global_ref++)
- return 0;
-
- pthread_mutexattr_init( &attr );
- pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_ERRORCHECK );
- ret = pthread_mutex_init( &global_lock, &attr );
- pthread_mutexattr_destroy( &attr );
-
- return ret;
-}
-
-static INLINE void directfbgl_finish( void )
-{
- if (--global_ref == 0)
- pthread_mutex_destroy( &global_lock );
-}
-
-#define directfbgl_lock() pthread_mutex_lock( &global_lock )
-#define directfbgl_unlock() pthread_mutex_unlock( &global_lock )
-
-/******************************************************************************/
-
-static bool directfbgl_init_visual ( GLvisual *visual,
- DFBSurfacePixelFormat format );
-static bool directfbgl_create_context ( GLcontext *context,
- GLframebuffer *framebuffer,
- GLvisual *visual,
- IDirectFBGL_data *data );
-static void directfbgl_destroy_context( GLcontext *context,
- GLframebuffer *framebuffer );
-
-/******************************************************************************/
-
-
-static void
-IDirectFBGL_Mesa_Destruct( IDirectFBGL *thiz )
-{
- IDirectFBGL_data *data = (IDirectFBGL_data*) thiz->priv;
-
- directfbgl_destroy_context( &data->context, &data->framebuffer );
-
- if (data->surface)
- data->surface->Release( data->surface );
-
- DIRECT_DEALLOCATE_INTERFACE( thiz );
-
- directfbgl_finish();
-}
-
-static DFBResult
-IDirectFBGL_Mesa_AddRef( IDirectFBGL *thiz )
-{
- DIRECT_INTERFACE_GET_DATA( IDirectFBGL );
-
- data->ref++;
-
- return DFB_OK;
-}
-
-static DFBResult
-IDirectFBGL_Mesa_Release( IDirectFBGL *thiz )
-{
- DIRECT_INTERFACE_GET_DATA( IDirectFBGL )
-
- if (--data->ref == 0)
- IDirectFBGL_Mesa_Destruct( thiz );
-
- return DFB_OK;
-}
-
-static DFBResult
-IDirectFBGL_Mesa_Lock( IDirectFBGL *thiz )
-{
- IDirectFBSurface *surface;
- int width = 0;
- int height = 0;
- DFBResult ret;
-
- DIRECT_INTERFACE_GET_DATA( IDirectFBGL );
-
- if (data->locked) {
- data->locked++;
- return DFB_OK;
- }
-
- if (directfbgl_lock())
- return DFB_LOCKED;
-
- surface = data->surface;
- surface->GetSize( surface, &width, &height );
-
- ret = surface->Lock( surface, DSLF_READ | DSLF_WRITE,
- (void*)&data->video.start, &data->video.pitch );
- if (ret) {
- D_ERROR( "DirectFBGL/Mesa: couldn't lock surface.\n" );
- directfbgl_unlock();
- return ret;
- }
- data->video.end = data->video.start + (height-1) * data->video.pitch;
-
- data->render.Data = data->video.start;
-
- _mesa_make_current( &data->context,
- &data->framebuffer, &data->framebuffer );
-
- if (data->width != width || data->height != height) {
- _mesa_resize_framebuffer( &data->context,
- &data->framebuffer, width, height );
- data->width = width;
- data->height = height;
- }
-
- data->locked++;
-
- return DFB_OK;
-}
-
-static DFBResult
-IDirectFBGL_Mesa_Unlock( IDirectFBGL *thiz )
-{
- DIRECT_INTERFACE_GET_DATA( IDirectFBGL );
-
- if (!data->locked)
- return DFB_OK;
-
- if (--data->locked == 0) {
- _mesa_make_current( NULL, NULL, NULL );
-
- data->surface->Unlock( data->surface );
-
- directfbgl_unlock();
- }
-
- return DFB_OK;
-}
-
-static DFBResult
-IDirectFBGL_Mesa_GetAttributes( IDirectFBGL *thiz,
- DFBGLAttributes *attributes )
-{
- DFBSurfaceCapabilities caps;
- GLvisual *visual;
-
- DIRECT_INTERFACE_GET_DATA( IDirectFBGL );
-
- if (!attributes)
- return DFB_INVARG;
-
- data->surface->GetCapabilities( data->surface, &caps );
-
- visual = &data->visual;
-
- attributes->buffer_size = visual->rgbBits ? : visual->indexBits;
- attributes->depth_size = visual->depthBits;
- attributes->stencil_size = visual->stencilBits;
- attributes->aux_buffers = visual->numAuxBuffers;
- attributes->red_size = visual->redBits;
- attributes->green_size = visual->greenBits;
- attributes->blue_size = visual->blueBits;
- attributes->alpha_size = visual->alphaBits;
- attributes->accum_red_size = visual->accumRedBits;
- attributes->accum_green_size = visual->accumGreenBits;
- attributes->accum_blue_size = visual->accumBlueBits;
- attributes->accum_alpha_size = visual->accumAlphaBits;
- attributes->double_buffer = ((caps & DSCAPS_FLIPPING) != 0);
- attributes->stereo = (visual->stereoMode != 0);
-
- return DFB_OK;
-}
-
-#if DIRECTFBGL_INTERFACE_VERSION >= 1
-static DFBResult
-IDirectFBGL_Mesa_GetProcAddress( IDirectFBGL *thiz,
- const char *name,
- void **ret_address )
-{
- DIRECT_INTERFACE_GET_DATA( IDirectFBGL );
-
- if (!name)
- return DFB_INVARG;
-
- if (!ret_address)
- return DFB_INVARG;
-
- *ret_address = _glapi_get_proc_address( name );
-
- return (*ret_address) ? DFB_OK : DFB_UNSUPPORTED;
-}
-#endif
-
-
-/* exported symbols */
-
-static DFBResult
-Probe( void *data )
-{
- return DFB_OK;
-}
-
-static DFBResult
-Construct( IDirectFBGL *thiz, IDirectFBSurface *surface )
-{
- DFBResult ret;
-
- /* Initialize global resources. */
- if (directfbgl_init())
- return DFB_INIT;
-
- /* Allocate interface data. */
- DIRECT_ALLOCATE_INTERFACE_DATA( thiz, IDirectFBGL );
-
- /* Initialize interface data. */
- data->ref = 1;
-
- /* Duplicate destination surface. */
- ret = surface->GetSubSurface( surface, NULL, &data->surface );
- if (ret) {
- IDirectFBGL_Mesa_Destruct( thiz );
- return ret;
- }
-
- data->surface->GetPixelFormat( data->surface, &data->format );
- data->surface->GetSize( data->surface, &data->width, &data->height );
-
- /* Configure visual. */
- if (!directfbgl_init_visual( &data->visual, data->format )) {
- D_ERROR( "DirectFBGL/Mesa: failed to initialize visual.\n" );
- IDirectFBGL_Mesa_Destruct( thiz );
- return DFB_UNSUPPORTED;
- }
-
- /* Create context. */
- if (!directfbgl_create_context( &data->context,
- &data->framebuffer,
- &data->visual, data )) {
- D_ERROR( "DirectFBGL/Mesa: failed to create context.\n" );
- IDirectFBGL_Mesa_Destruct( thiz );
- return DFB_UNSUPPORTED;
- }
-
- /* Assign interface pointers. */
- thiz->AddRef = IDirectFBGL_Mesa_AddRef;
- thiz->Release = IDirectFBGL_Mesa_Release;
- thiz->Lock = IDirectFBGL_Mesa_Lock;
- thiz->Unlock = IDirectFBGL_Mesa_Unlock;
- thiz->GetAttributes = IDirectFBGL_Mesa_GetAttributes;
-#if DIRECTFBGL_INTERFACE_VERSION >= 1
- thiz->GetProcAddress = IDirectFBGL_Mesa_GetProcAddress;
-#endif
-
- return DFB_OK;
-}
-
-
-/***************************** Driver functions ******************************/
-
-static const GLubyte*
-dfbGetString( GLcontext *ctx, GLenum pname )
-{
- return NULL;
-}
-
-static void
-dfbUpdateState( GLcontext *ctx, GLuint new_state )
-{
- _swrast_InvalidateState( ctx, new_state );
- _swsetup_InvalidateState( ctx, new_state );
- _vbo_InvalidateState( ctx, new_state );
- _tnl_InvalidateState( ctx, new_state );
-}
-
-static void
-dfbGetBufferSize( GLframebuffer *buffer, GLuint *width, GLuint *height )
-{
- GLcontext *ctx = _mesa_get_current_context();
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-
- *width = (GLuint) data->width;
- *height = (GLuint) data->height;
-}
-
-/**
- * We only implement this function as a mechanism to check if the
- * framebuffer size has changed (and update corresponding state).
- */
-static void
-dfbSetViewport( GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h )
-{
- /* Nothing to do (the surface can't be resized while it's locked). */
- return;
-}
-
-static void
-dfbClear( GLcontext *ctx, GLbitfield mask )
-{
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-
-#define BUFFER_BIT_MASK (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_FRONT_RIGHT | \
- BUFFER_BIT_BACK_LEFT | BUFFER_BIT_BACK_RIGHT )
- if (mask & BUFFER_BIT_MASK &&
- ctx->Color.ColorMask[0][0] &&
- ctx->Color.ColorMask[0][1] &&
- ctx->Color.ColorMask[0][2] &&
- ctx->Color.ColorMask[0][3])
- {
- DFBRegion clip;
- GLubyte a, r, g, b;
-
- UNCLAMPED_FLOAT_TO_UBYTE( a, ctx->Color.ClearColor[ACOMP] );
- UNCLAMPED_FLOAT_TO_UBYTE( r, ctx->Color.ClearColor[RCOMP] );
- UNCLAMPED_FLOAT_TO_UBYTE( g, ctx->Color.ClearColor[GCOMP] );
- UNCLAMPED_FLOAT_TO_UBYTE( b, ctx->Color.ClearColor[BCOMP] );
-
- clip.x1 = ctx->DrawBuffer->_Xmin;
- clip.y1 = ctx->DrawBuffer->_Ymin;
- clip.x2 = ctx->DrawBuffer->_Xmax - 1;
- clip.y2 = ctx->DrawBuffer->_Ymax - 1;
- data->surface->SetClip( data->surface, &clip );
-
- data->surface->Unlock( data->surface );
-
- data->surface->Clear( data->surface, r, g, b, a );
-
- data->surface->Lock( data->surface, DSLF_READ | DSLF_WRITE,
- (void*)&data->video.start, &data->video.pitch );
- data->video.end = data->video.start + (data->height-1) * data->video.pitch;
- data->render.Data = data->video.start;
-
- mask &= ~BUFFER_BIT_MASK;
- }
-#undef BUFFER_BIT_MASK
-
- if (mask)
- _swrast_Clear( ctx, mask );
-}
-
-
-/************************ RenderBuffer functions *****************************/
-
-static void
-dfbDeleteRenderbuffer( struct gl_renderbuffer *render )
-{
- return;
-}
-
-static GLboolean
-dfbRenderbufferStorage( GLcontext *ctx, struct gl_renderbuffer *render,
- GLenum internalFormat, GLuint width, GLuint height )
-{
- return GL_TRUE;
-}
-
-
-/***************************** Span functions ********************************/
-
-/* RGB332 */
-#define NAME(PREFIX) PREFIX##_RGB332
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = data->video.end - (Y) * data->video.pitch + (X);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(P, X, Y, S) \
- *P = ( (((S[RCOMP]) & 0xe0) ) | \
- (((S[GCOMP]) & 0xe0) >> 3) | \
- (((S[BCOMP]) ) >> 6) )
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0xe0) ); \
- D[GCOMP] = ((*P & 0x1c) << 3); \
- D[BCOMP] = ((*P & 0x03) << 6); \
- D[ACOMP] = 0xff
-
-#include "swrast/s_spantemp.h"
-
-/* ARGB4444 */
-#define NAME(PREFIX) PREFIX##_ARGB4444
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *) (data->video.end - (Y) * data->video.pitch + (X) * 2);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL_RGB(P, X, Y, S) \
- *P = ( 0xf000 | \
- (((S[RCOMP]) & 0xf0) << 4) | \
- (((S[GCOMP]) & 0xf0) ) | \
- (((S[BCOMP]) & 0xf0) >> 4) )
-#define STORE_PIXEL(P, X, Y, S) \
- *P = ( (((S[ACOMP]) & 0xf0) << 8) | \
- (((S[RCOMP]) & 0xf0) << 4) | \
- (((S[GCOMP]) & 0xf0) ) | \
- (((S[BCOMP]) & 0xf0) >> 4) )
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0x0f00) >> 4) | ((*P & 0x0f00) >> 8); \
- D[GCOMP] = ((*P & 0x00f0) ) | ((*P & 0x00f0) >> 4); \
- D[BCOMP] = ((*P & 0x000f) << 4) | ((*P & 0x000f) ); \
- D[ACOMP] = ((*P & 0xf000) >> 8) | ((*P & 0xf000) >> 12)
-
-#include "swrast/s_spantemp.h"
-
-/* RGB444 */
-#define NAME(PREFIX) PREFIX##_RGB444
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *) (data->video.end - (Y) * data->video.pitch + (X) * 2);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(P, X, Y, S) \
- *P = ( (((S[RCOMP]) & 0xf0) << 4) | \
- (((S[GCOMP]) & 0xf0) ) | \
- (((S[BCOMP]) & 0xf0) >> 4) )
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0x0f00) >> 4) | ((*P & 0x0f00) >> 8); \
- D[GCOMP] = ((*P & 0x00f0) ) | ((*P & 0x00f0) >> 4); \
- D[BCOMP] = ((*P & 0x000f) << 4) | ((*P & 0x000f) ); \
- D[ACOMP] = 0xff
-
-#include "swrast/s_spantemp.h"
-
-/* ARGB2554 */
-#define NAME(PREFIX) PREFIX##_ARGB2554
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *) (data->video.end - (Y) * data->video.pitch + (X) * 2);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL_RGB(P, X, Y, S) \
- *P = ( 0xc000 | \
- (((S[RCOMP]) & 0xf8) << 6) | \
- (((S[GCOMP]) & 0xf8) << 1) | \
- (((S[BCOMP]) & 0xf0) >> 4) )
-#define STORE_PIXEL(P, X, Y, S) \
- *P = ( (((S[ACOMP]) & 0xc0) << 8) | \
- (((S[RCOMP]) & 0xf8) << 6) | \
- (((S[GCOMP]) & 0xf8) << 1) | \
- (((S[BCOMP]) & 0xf0) >> 4) )
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0x3e00) >> 9); \
- D[GCOMP] = ((*P & 0x01f0) >> 4); \
- D[BCOMP] = ((*P & 0x000f) << 4); \
- D[ACOMP] = ((*P & 0xc000) >> 14)
-
-#include "swrast/s_spantemp.h"
-
-/* ARGB1555 */
-#define NAME(PREFIX) PREFIX##_ARGB1555
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *) (data->video.end - (Y) * data->video.pitch + (X) * 2);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL_RGB(P, X, Y, S) \
- *P = ( 0x8000 | \
- (((S[RCOMP]) & 0xf8) << 7) | \
- (((S[GCOMP]) & 0xf8) << 2) | \
- (((S[BCOMP]) ) >> 3) )
-#define STORE_PIXEL(P, X, Y, S) \
- *P = ( (((S[ACOMP]) & 0x80) << 16) | \
- (((S[RCOMP]) & 0xf8) << 7) | \
- (((S[GCOMP]) & 0xf8) << 2) | \
- (((S[BCOMP]) ) >> 3) )
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0x7c00) >> 7) | ((*P & 0x7c00) >> 12); \
- D[GCOMP] = ((*P & 0x03e0) >> 2) | ((*P & 0x03e0) >> 7); \
- D[BCOMP] = ((*P & 0x001f) << 3) | ((*P & 0x001f) << 2); \
- D[ACOMP] = ((*P & 0x8000) ? 0xff : 0)
-
-#include "swrast/s_spantemp.h"
-
-/* RGB555 */
-#define NAME(PREFIX) PREFIX##_RGB555
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *) (data->video.end - (Y) * data->video.pitch + (X) * 2);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(P, X, Y, S) \
- *P = ( (((S[RCOMP]) & 0xf8) << 7) | \
- (((S[GCOMP]) & 0xf8) << 2) | \
- (((S[BCOMP]) ) >> 3) )
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0x7c00) >> 7) | ((*P & 0x7c00) >> 12); \
- D[GCOMP] = ((*P & 0x03e0) >> 2) | ((*P & 0x03e0) >> 7); \
- D[BCOMP] = ((*P & 0x001f) << 3) | ((*P & 0x001f) << 2); \
- D[ACOMP] = 0xff
-
-#include "swrast/s_spantemp.h"
-
-/* RGB16 */
-#define NAME(PREFIX) PREFIX##_RGB16
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLushort *P = (GLushort *) (data->video.end - (Y) * data->video.pitch + (X) * 2);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(P, X, Y, S) \
- *P = ( (((S[RCOMP]) & 0xf8) << 8) | \
- (((S[GCOMP]) & 0xfc) << 3) | \
- (((S[BCOMP]) ) >> 3) )
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0xf800) >> 8) | ((*P & 0xf800) >> 13); \
- D[GCOMP] = ((*P & 0x07e0) >> 3) | ((*P & 0x07e0) >> 9); \
- D[BCOMP] = ((*P & 0x001f) << 3) | ((*P & 0x001f) >> 2); \
- D[ACOMP] = 0xff
-
-#include "swrast/s_spantemp.h"
-
-/* RGB24 */
-#define NAME(PREFIX) PREFIX##_RGB24
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLubyte *P = data->video.end - (Y) * data->video.pitch + (X) * 3;
-#define INC_PIXEL_PTR(P) P += 3
-#define STORE_PIXEL(P, X, Y, S) \
- P[0] = S[BCOMP]; P[1] = S[GCOMP]; P[2] = S[BCOMP]
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = P[2]; D[GCOMP] = P[1]; D[BCOMP] = P[0]; D[ACOMP] = 0xff
-
-#include "swrast/s_spantemp.h"
-
-/* RGB32 */
-#define NAME(PREFIX) PREFIX##_RGB32
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLuint *P = (GLuint*) (data->video.end - (Y) * data->video.pitch + (X) * 4);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL(P, X, Y, S) \
- *P = ( ((S[RCOMP]) << 16) | \
- ((S[GCOMP]) << 8) | \
- ((S[BCOMP]) ) )
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0x00ff0000) >> 16); \
- D[GCOMP] = ((*P & 0x0000ff00) >> 8); \
- D[BCOMP] = ((*P & 0x000000ff) ); \
- D[ACOMP] = 0xff
-
-#include "swrast/s_spantemp.h"
-
-/* ARGB */
-#define NAME(PREFIX) PREFIX##_ARGB
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLuint *P = (GLuint*) (data->video.end - (Y) * data->video.pitch + (X) * 4);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL_RGB(P, X, Y, S) \
- *P = ( 0xff000000 | \
- ((S[RCOMP]) << 16) | \
- ((S[GCOMP]) << 8) | \
- ((S[BCOMP]) ) )
-#define STORE_PIXEL(P, X, Y, S) \
- *P = ( ((S[ACOMP]) << 24) | \
- ((S[RCOMP]) << 16) | \
- ((S[GCOMP]) << 8) | \
- ((S[BCOMP]) ) )
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0x00ff0000) >> 16); \
- D[GCOMP] = ((*P & 0x0000ff00) >> 8); \
- D[BCOMP] = ((*P & 0x000000ff) ); \
- D[ACOMP] = ((*P & 0xff000000) >> 24)
-
-#include "swrast/s_spantemp.h"
-
-/* AiRGB */
-#define NAME(PREFIX) PREFIX##_AiRGB
-#define FORMAT GL_RGBA8
-#define RB_TYPE GLubyte
-#define SPAN_VARS \
- IDirectFBGL_data *data = (IDirectFBGL_data*) ctx->DriverCtx;
-#define INIT_PIXEL_PTR(P, X, Y) \
- GLuint *P = (GLuint*) (data->video.end - (Y) * data->video.pitch + (X) * 4);
-#define INC_PIXEL_PTR(P) P += 1
-#define STORE_PIXEL_RGB(P, X, Y, S) \
- *P = ( ((S[RCOMP]) << 16) | \
- ((S[GCOMP]) << 8) | \
- ((S[BCOMP]) ) )
-#define STORE_PIXEL(P, X, Y, S) \
- *P = ( (((S[ACOMP]) ^ 0xff) << 24) | \
- (((S[RCOMP]) ) << 16) | \
- (((S[GCOMP]) ) << 8) | \
- (((S[BCOMP]) ) ) )
-#define FETCH_PIXEL(D, P) \
- D[RCOMP] = ((*P & 0x00ff0000) >> 16); \
- D[GCOMP] = ((*P & 0x0000ff00) >> 8); \
- D[BCOMP] = ((*P & 0x000000ff) ); \
- D[ACOMP] = (((*P & 0xff000000) >> 24) ^ 0xff)
-
-#include "swrast/s_spantemp.h"
-
-
-/*****************************************************************************/
-
-static bool
-directfbgl_init_visual( GLvisual *visual,
- DFBSurfacePixelFormat format )
-{
- GLboolean rgbFlag = GL_TRUE;
- GLboolean dbFlag = GL_FALSE;
- GLboolean stereoFlag = GL_FALSE;
- GLint redBits = 0;
- GLint blueBits = 0;
- GLint greenBits = 0;
- GLint alphaBits = 0;
- GLint indexBits = 0;
- GLint depthBits = 0;
- GLint stencilBits = 0;
- GLint accumRedBits = 0;
- GLint accumGreenBits = 0;
- GLint accumBlueBits = 0;
- GLint accumAlphaBits = 0;
- GLint numSamples = 0;
-
- /* FIXME: LUT8 support. */
- switch (format) {
- case DSPF_RGB332:
- redBits = 3;
- greenBits = 3;
- blueBits = 2;
- break;
- case DSPF_ARGB4444:
- alphaBits = 4;
- case DSPF_RGB444:
- redBits = 4;
- greenBits = 4;
- blueBits = 4;
- break;
- case DSPF_ARGB2554:
- alphaBits = 2;
- redBits = 5;
- greenBits = 5;
- blueBits = 4;
- break;
- case DSPF_ARGB1555:
- alphaBits = 1;
- case DSPF_RGB555:
- redBits = 5;
- greenBits = 5;
- blueBits = 5;
- break;
- case DSPF_RGB16:
- redBits = 5;
- greenBits = 6;
- blueBits = 5;
- break;
- case DSPF_ARGB:
- case DSPF_AiRGB:
- alphaBits = 8;
- case DSPF_RGB24:
- case DSPF_RGB32:
- redBits = 8;
- greenBits = 8;
- blueBits = 8;
- break;
- default:
- D_WARN( "unsupported pixelformat" );
- return false;
- }
-
- if (rgbFlag) {
- accumRedBits = redBits;
- accumGreenBits = greenBits;
- accumBlueBits = blueBits;
- accumAlphaBits = alphaBits;
- depthBits = redBits + greenBits + blueBits;
- stencilBits = alphaBits;
- } else
- depthBits = 8;
-
- return _mesa_initialize_visual( visual,
- rgbFlag, dbFlag, stereoFlag,
- redBits, greenBits, blueBits, alphaBits,
- indexBits, depthBits, stencilBits,
- accumRedBits, accumGreenBits,
- accumBlueBits, accumAlphaBits,
- numSamples );
-}
-
-static bool
-directfbgl_create_context( GLcontext *context,
- GLframebuffer *framebuffer,
- GLvisual *visual,
- IDirectFBGL_data *data )
-{
- struct dd_function_table functions;
-
- _mesa_initialize_window_framebuffer( framebuffer, visual );
-
- _mesa_init_driver_functions( &functions );
- functions.GetString = dfbGetString;
- functions.UpdateState = dfbUpdateState;
- functions.GetBufferSize = dfbGetBufferSize;
- functions.Viewport = dfbSetViewport;
- functions.Clear = dfbClear;
-
- if (!_mesa_initialize_context( context, visual, NULL,
- &functions, (void*) data )) {
- D_DEBUG( "DirectFBGL/Mesa: _mesa_initialize_context() failed.\n" );
- _mesa_free_framebuffer_data( framebuffer );
- return false;
- }
-
- _swrast_CreateContext( context );
- _vbo_CreateContext( context );
- _tnl_CreateContext( context );
- _swsetup_CreateContext( context );
- _swsetup_Wakeup( context );
-
- _mesa_init_renderbuffer( &data->render, 0 );
- data->render.InternalFormat = GL_RGBA;
- data->render._BaseFormat = GL_RGBA;
- data->render.DataType = GL_UNSIGNED_BYTE;
- data->render.Data = data->video.start;
- data->render.Delete = dfbDeleteRenderbuffer;
- data->render.AllocStorage = dfbRenderbufferStorage;
-
- switch (data->format) {
- case DSPF_RGB332:
- data->render.GetRow = get_row_RGB332;
- data->render.GetValues = get_values_RGB332;
- data->render.PutRow = put_row_RGB332;
- data->render.PutRowRGB = put_row_rgb_RGB332;
- data->render.PutMonoRow = put_mono_row_RGB332;
- data->render.PutValues = put_values_RGB332;
- data->render.PutMonoValues = put_mono_values_RGB332;
- break;
- case DSPF_ARGB4444:
- data->render.GetRow = get_row_ARGB4444;
- data->render.GetValues = get_values_ARGB4444;
- data->render.PutRow = put_row_ARGB4444;
- data->render.PutRowRGB = put_row_rgb_ARGB4444;
- data->render.PutMonoRow = put_mono_row_ARGB4444;
- data->render.PutValues = put_values_ARGB4444;
- data->render.PutMonoValues = put_mono_values_ARGB4444;
- break;
- case DSPF_RGB444:
- data->render.GetRow = get_row_RGB444;
- data->render.GetValues = get_values_RGB444;
- data->render.PutRow = put_row_RGB444;
- data->render.PutRowRGB = put_row_rgb_RGB444;
- data->render.PutMonoRow = put_mono_row_RGB444;
- data->render.PutValues = put_values_RGB444;
- data->render.PutMonoValues = put_mono_values_RGB444;
- break;
- case DSPF_ARGB2554:
- data->render.GetRow = get_row_ARGB2554;
- data->render.GetValues = get_values_ARGB2554;
- data->render.PutRow = put_row_ARGB2554;
- data->render.PutRowRGB = put_row_rgb_ARGB2554;
- data->render.PutMonoRow = put_mono_row_ARGB2554;
- data->render.PutValues = put_values_ARGB2554;
- data->render.PutMonoValues = put_mono_values_ARGB2554;
- break;
- case DSPF_ARGB1555:
- data->render.GetRow = get_row_ARGB1555;
- data->render.GetValues = get_values_ARGB1555;
- data->render.PutRow = put_row_ARGB1555;
- data->render.PutRowRGB = put_row_rgb_ARGB1555;
- data->render.PutMonoRow = put_mono_row_ARGB1555;
- data->render.PutValues = put_values_ARGB1555;
- data->render.PutMonoValues = put_mono_values_ARGB1555;
- break;
- case DSPF_RGB555:
- data->render.GetRow = get_row_RGB555;
- data->render.GetValues = get_values_RGB555;
- data->render.PutRow = put_row_RGB555;
- data->render.PutRowRGB = put_row_rgb_RGB555;
- data->render.PutMonoRow = put_mono_row_RGB555;
- data->render.PutValues = put_values_RGB555;
- data->render.PutMonoValues = put_mono_values_RGB555;
- break;
- case DSPF_RGB16:
- data->render.GetRow = get_row_RGB16;
- data->render.GetValues = get_values_RGB16;
- data->render.PutRow = put_row_RGB16;
- data->render.PutRowRGB = put_row_rgb_RGB16;
- data->render.PutMonoRow = put_mono_row_RGB16;
- data->render.PutValues = put_values_RGB16;
- data->render.PutMonoValues = put_mono_values_RGB16;
- break;
- case DSPF_RGB24:
- data->render.GetRow = get_row_RGB24;
- data->render.GetValues = get_values_RGB24;
- data->render.PutRow = put_row_RGB24;
- data->render.PutRowRGB = put_row_rgb_RGB24;
- data->render.PutMonoRow = put_mono_row_RGB24;
- data->render.PutValues = put_values_RGB24;
- data->render.PutMonoValues = put_mono_values_RGB24;
- break;
- case DSPF_RGB32:
- data->render.GetRow = get_row_RGB32;
- data->render.GetValues = get_values_RGB32;
- data->render.PutRow = put_row_RGB32;
- data->render.PutRowRGB = put_row_rgb_RGB32;
- data->render.PutMonoRow = put_mono_row_RGB32;
- data->render.PutValues = put_values_RGB32;
- data->render.PutMonoValues = put_mono_values_RGB32;
- break;
- case DSPF_ARGB:
- data->render.GetRow = get_row_ARGB;
- data->render.GetValues = get_values_ARGB;
- data->render.PutRow = put_row_ARGB;
- data->render.PutRowRGB = put_row_rgb_ARGB;
- data->render.PutMonoRow = put_mono_row_ARGB;
- data->render.PutValues = put_values_ARGB;
- data->render.PutMonoValues = put_mono_values_ARGB;
- break;
- case DSPF_AiRGB:
- data->render.GetRow = get_row_AiRGB;
- data->render.GetValues = get_values_AiRGB;
- data->render.PutRow = put_row_AiRGB;
- data->render.PutRowRGB = put_row_rgb_AiRGB;
- data->render.PutMonoRow = put_mono_row_AiRGB;
- data->render.PutValues = put_values_AiRGB;
- data->render.PutMonoValues = put_mono_values_AiRGB;
- break;
- default:
- D_BUG( "unexpected pixelformat" );
- return false;
- }
-
- data->render.Width = data->width;
- data->render.Height = data->height;
-
- _mesa_add_renderbuffer( framebuffer, BUFFER_FRONT_LEFT, &data->render );
-
- _mesa_add_soft_renderbuffers( framebuffer,
- GL_FALSE,
- visual->haveDepthBuffer,
- visual->haveStencilBuffer,
- visual->haveAccumBuffer,
- GL_FALSE,
- GL_FALSE );
-
- TNL_CONTEXT( context )->Driver.RunPipeline = _tnl_run_pipeline;
-
- _mesa_enable_sw_extensions( context );
-
- return true;
-}
-
-static void
-directfbgl_destroy_context( GLcontext *context,
- GLframebuffer *framebuffer )
-{
- _swsetup_DestroyContext( context );
- _swrast_DestroyContext( context );
- _tnl_DestroyContext( context );
- _vbo_DestroyContext( context );
- //_mesa_free_framebuffer_data( framebuffer );
- _mesa_free_context_data( context );
-}
-