From a9e36696837b2c31ecee4017a0adffbd987c1eff Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Thu, 25 Feb 2010 16:17:04 -0500 Subject: Remove remaining miniglx references --- configs/linux-solo | 54 ---- docs/MiniGLX.html | 534 ------------------------------------ doxygen/Makefile | 3 +- doxygen/miniglx.doxy | 179 ------------ include/GL/miniglx.h | 482 --------------------------------- progs/miniglx/.gitignore | 6 - progs/miniglx/Makefile | 61 ----- progs/miniglx/glfbdevtest.c | 477 -------------------------------- progs/miniglx/manytex.c | 381 -------------------------- progs/miniglx/miniglxsample.c | 128 --------- progs/miniglx/miniglxtest.c | 272 ------------------- progs/miniglx/sample_server.c | 111 -------- progs/miniglx/sample_server2.c | 228 ---------------- progs/miniglx/texline.c | 267 ------------------ src/glut/mini/Makefile | 103 ------- src/glut/mini/bitmap.c | 56 ---- src/glut/mini/callback.c | 152 ----------- src/glut/mini/color.c | 46 ---- src/glut/mini/globals.c | 61 ----- src/glut/mini/glut.pc.in | 13 - src/glut/mini/init.c | 59 ---- src/glut/mini/internal.h | 78 ------ src/glut/mini/menu.c | 86 ------ src/glut/mini/models.c | 598 ----------------------------------------- src/glut/mini/overlay.c | 60 ----- src/glut/mini/state.c | 70 ----- src/glut/mini/teapot.c | 212 --------------- src/glut/mini/window.c | 273 ------------------- 28 files changed, 1 insertion(+), 5049 deletions(-) delete mode 100644 configs/linux-solo delete mode 100644 docs/MiniGLX.html delete mode 100644 doxygen/miniglx.doxy delete mode 100644 include/GL/miniglx.h delete mode 100644 progs/miniglx/.gitignore delete mode 100644 progs/miniglx/Makefile delete mode 100644 progs/miniglx/glfbdevtest.c delete mode 100644 progs/miniglx/manytex.c delete mode 100644 progs/miniglx/miniglxsample.c delete mode 100644 progs/miniglx/miniglxtest.c delete mode 100644 progs/miniglx/sample_server.c delete mode 100644 progs/miniglx/sample_server2.c delete mode 100644 progs/miniglx/texline.c delete mode 100644 src/glut/mini/Makefile delete mode 100644 src/glut/mini/bitmap.c delete mode 100644 src/glut/mini/callback.c delete mode 100644 src/glut/mini/color.c delete mode 100644 src/glut/mini/globals.c delete mode 100644 src/glut/mini/glut.pc.in delete mode 100644 src/glut/mini/init.c delete mode 100644 src/glut/mini/internal.h delete mode 100644 src/glut/mini/menu.c delete mode 100644 src/glut/mini/models.c delete mode 100644 src/glut/mini/overlay.c delete mode 100644 src/glut/mini/state.c delete mode 100644 src/glut/mini/teapot.c delete mode 100644 src/glut/mini/window.c diff --git a/configs/linux-solo b/configs/linux-solo deleted file mode 100644 index 247a2d489a..0000000000 --- a/configs/linux-solo +++ /dev/null @@ -1,54 +0,0 @@ -# Configuration for linux-solo: Linux DRI hardware drivers for fbdev - -include $(TOP)/configs/default - -CONFIG_NAME = linux-solo - -# Compiler and flags -CC = gcc -CXX = g++ - -WARN_FLAGS = -Wall -Wundef -OPT_FLAGS = -O3 -g -PIC_FLAGS = -fPIC - -# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support. -ARCH_FLAGS ?= - -# DRM and pciaccess -LIBDRM_CFLAGS = $(shell pkg-config --cflags libdrm) -LIBDRM_LIB = $(shell pkg-config --libs libdrm) -PCIACCESS_CFLAGS = $(shell pkg-config --cflags pciaccess) -PCIACCESS_LIB = $(shell pkg-config --libs pciaccess) - - -DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ - -D_BSD_SOURCE -D_GNU_SOURCE -DHAVE_POSIX_MEMALIGN \ - -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \ - -DHAVE_ALIAS - -CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \ - $(ASM_FLAGS) -std=c99 -ffast-math - -CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) - -# Work around aliasing bugs - developers should comment this out -CFLAGS += -fno-strict-aliasing -CXXFLAGS += -fno-strict-aliasing - -MESA_ASM_SOURCES = - -# Library/program dependencies -DRI_LIB_DEPS = -lm -lpthread -lexpat -ldl -L$(TOP)/$(LIB_DIR) $(PCIACCESS_LIB) -GL_LIB_DEPS = -lm -lpthread -ldl -GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm -GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm -APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lpthread - -# Directories -SRC_DIRS = glx/mini gallium mesa glu glut/mini glew -DRIVER_DIRS = dri -PROGRAM_DIRS = miniglx - -#DRI_DIRS = ffb gamma sis savage tdfx unichrome fb -DRI_DIRS = i810 i915tex i915 mach64 mga r128 r200 radeon diff --git a/docs/MiniGLX.html b/docs/MiniGLX.html deleted file mode 100644 index e7ebae6851..0000000000 --- a/docs/MiniGLX.html +++ /dev/null @@ -1,534 +0,0 @@ - - - - Mini GLX Specification - - -

-
Mini GLX Specification
-

-

-
Tungsten Graphics, Inc.
-
-January 20, 2003
-
-
-

-

Copyright © 2002-2003 by Tungsten Graphics, Inc., Cedar Park, -Texas. All Rights Reserved.
-
-Permission is granted to make and distribute verbatim copies of this -document provided the copyright notice and this permission notice are -preserved on all copies.
-
-

-

1. Introduction

-

The Mini GLX interface facilitates OpenGL rendering on embedded -devices. The interface is a subset of the GLX interface, plus a minimal -set of Xlib-like functions.

-

Programs written to the Mini GLX specification should run unchanged -on systems with the X Window System and the GLX extension. The intention -is to allow flexibility for prototyping and testing.

-

This document serves as both the reference guide and programming -guide for Mini GLX.
-
-

-

2. Mini GLX Concepts

-

The OpenGL specification does not describe how OpenGL rendering -contexts and drawing surfaces (i.e. the frame buffer) are created and -managed. Rather, this is handled by an OpenGL window system interface, -such as Mini GLX.

-

There are three main datatypes or resources managed by Mini GLX. The -resources and their corresponding GLX or Xlib data types are:

- - - - - - - - - - - - - - - - - - - -
ResourceData type
pixel formatsX Visual and XVisualInfo
drawing surfacesX Window or GLXDrawable
rendering contextsGLXContext
-

Pixel formats or X Visuals describe the per-pixel attributes of the -frame buffer. For example, bits per color component, Z buffer size, -stencil size, TrueColor vs PseudoColor, etc.

-

Drawing surfaces or X Windows typically describe a spatial -allocation of the frame buffer (i.e. the position and size of a -rectangular region of pixels). Since MiniGLX doesn't really support a -window system, the window is effectively the entire frame buffer.

-

A rendering context represents the current OpenGL state such as -current drawing color, line width, blending mode, texture parameters, -etc. Several rendering contexts can be created but only one can be in -use at any given time.

-

The Mini GLX interface provides all the functions needed for -choosing pixel formats, create drawing surfaces, creating rendering -contexts and binding rendering contexts to drawing surfaces.
-
-

-

3. Using Mini GLX

-

To use the Mini GLX interface in your application, include the -GL/miniglx.h header file at compile time:

-
#include <GL/miniglx.h>
-
-Applications should link with libGL.so (i.e. gcc -myprogram.o -lGL -o myprogram).  libGL.so implements the -MiniGLX API functions and, in turn, loads a hardware-specific device -driver (such as radeon_dri.so) at runtime.  The -environment variable LIBGL_DRIVERS_PATH should name the -directory where these modules are located.
-
-The remainder of this section describes the MiniGLX API functions.
-
-

3.1 Initialization

-

The XOpenDisplay function is used to initialize the graphics system:

-
-
Display *XOpenDisplay(const char *displayname)
-
-

The displayName parameter is currently ignored in Mini -GLX. It is recommended that NULL be passed as thedisplayName -parameter.

-

If XOpenDisplay is able to initialize the graphics system a pointer -to a Display will be returned. Otherwise, NULL will be returned.

-

3.2 Choosing a Visual

-

A visual (i.e. pixel format) must be chosen before a drawing surface -or rendering context can be created. This is done with the -glXChooseVisual function:

-
-
XVisualInfo *glXChooseVisual(Display *dpy, int screen, const int *attribList)
-
-

dpy is a pointer to the display returned by -XOpenDisplay.

-

screen is currently ignored by Mini GLX and should be -zero.

-

attribList is a list of GLX attributes which describe -the desired pixel format. It is terminated by the token None. -The attributes are as follows:

-
-
-
GLX_USE_GL
-
This attribute should always be present in order to maintain -compatibility with GLX.
-
GLX_RGBA
-
If present, only RGBA pixel formats will be considered. -Otherwise, only color index formats are considered.
-
GLX_DOUBLEBUFFER
-
if present, only double-buffered pixel formats will be chosen.
-
GLX_RED_SIZE n
-
Must be followed by a non-negative integer indicating the -minimum number of bits per red pixel component that is acceptable.
-
GLX_GREEN_SIZE n
-
Must be followed by a non-negative integer indicating the -minimum number of bits per green pixel component that is acceptable.
-
GLX_BLUE_SIZE n
-
Must be followed by a non-negative integer indicating the -minimum number of bits per blue pixel component that is acceptable.
-
GLX_ALPHA_SIZE n
-
Must be followed by a non-negative integer indicating the -minimum number of bits per alpha pixel component that is acceptable.
-
GLX_STENCIL_SIZE n
-
Must be followed by a non-negative integer indicating the -minimum number of bits per stencil value that is acceptable.
-
None
-
This token is used to terminate the attribute list.
-
-
-

glXChooseVisual will return a pointer to an XVisualInfo object which -most closely matches the requirements of the attribute list. If there -is no visual which matches the request, NULL will be returned.

-

Note that visuals with accumulation buffers and depth buffers are -not available.
-
-

-

3.3 Creating a Drawing Surface

-

Drawing surfaces are created as X windows.  For Mini GLX, -windows are full-screen; they cover the entire frame buffer. - Also, Mini GLX imposes a limit of one window. A second window -cannot be created until the first one is destroyed.

-

3.3.1 Window Creation

-

The XCreateWindow function is used to create a drawing surface:

-
-
Window XCreateWindow( Display *display,
Window parent,
int x, int y,
unsigned int width, unsigned int height,
unsigned int borderWidth,
int depth,
unsigned int class,
Visual *visual,
unsigned long valuemask,
XSetWindowAttributes *attributes )
-
-

The parameters are as follows:

-
-
-
display
-
A Display pointer, as returned by XOpenDisplay.
-
parent
-
The parent window for the new window. For Mini GLX, this -should beRootWindow(dpy, 0).
-
x, y
-
The position of the window. For Mini GLX, both values should -be zero.
-
width, height
-
The size of the window. For Mini GLX, this specifies the -desired screen size such as 1024, 768 or 1280, 1024.
-
borderWidth
-
This parameter should be zero.
-
depth
-
The pixel depth for the window. For Mini GLX this should be -the depth found in the XVisualInfo object returned by glxChooseVisual.
-
class
-
The window class. For Mini GLX this value should be InputOutput.
-
visual
-
This parameter should be the visual field of the XVisualInfo -object returned by glxChooseVisual.
-
valuemask
-
This parameter indicates which fields of the XSetWindowAttributes -are to be used. For Mini GLX this is typically the bitmaskCWBackPixel -| CWBorderPixel | CWColormap.
-
attributes
-
Initial window attributes. Of the fields in the XSetWindowAttributes -structure, thebackground_pixel, border_pixel -and colormap fields should be set.  See the discussion -below regarding colormaps.
-
-
-

XCreateWindow will return a window handle if it succeeds -or zero if it fails.

-

3.3.2 Window Mapping

-

To display the window the XMapWindow function must be called:

-
-
void XMapWindow(Display *dpy, Window w)
-
-

This function does nothing in Mini GLX but is required for Xlib/GLX -compatibility

-

3.3.3 Colormaps
-

-

Xlib requires specification of a colormap when creating a window. - For purposes of interoperability, Mini GLX requires this as well, -though the colormap is not actually used.  The XCreateColormap -function is used to create a colormap:

-
Colormap XCreateColormap(Display *dpy, Window window, -Visual *visual, int alloc)
-
-

The parameters are as follows:
-

-
-
-
dpy
-
The display handle as returned by XOpenDisplay.
-
window
-
This parameter is ignored by Mini GLX but should be the value -returned by the RootWindow(dpy, 0) macro.
-
-
visual
-
This parameter is ignored by Mini GLX but should be the visual -field of the XVisualInfo object returned by glXChooseVisual.
-
alloc
-
This parameter is ignored by Mini GLX but should be set to AllocNone.
-
-
-
-

3.4 Creating a Rendering Context

-

An OpenGL rendering context is created with the glXCreateContext -function:

-
-
GLXContext glXCreateContext(Display *dpy, XVisualInfo *visInfo, GLXContext shareList, Bool direct)
-
-

The parameters are as follows:

-
-
-
dpy
-
The display handle as returned by XOpenDisplay.
-
visInfo
-
The visual as returned by glXChooseVisual.
-
shareList
-
If non-zero, texture objects and display lists are shared with -the named rendering context. If zero, texture objects and display lists -will (initially) be private to this context. They may be shared when a -subsequent context is created.
-
direct
-
Specifies whether direct or indirect rendering is desired. For -Mini GLX this value is ignored but it should be set to True.
-
-
-

glXCreateContext will return a GLXContext handle if it -succeeds or zero if it fails due to invalid parameter or insufficient -resources.
-
-

-

3.5 Binding a Rendering Context

-

The final step before beginning OpenGL rendering is to bind (i.e. -activate) a rendering context and drawing surface with the -glXMakeCurrent function:

-
-
Bool glXMakeCurrent(Display *dpy, GLXDrawable drawable, GLXContext ctx)
-
-

The parameters are as follows:

-
-
-
dpy
-
The display handle, as returned by XOpenDisplay.
-
drawable
-
The window or drawable to bind to the rendering context. This -should be the value returned by XCreateWindow.
-
ctx
-
The rendering context to bind, as returned by glXCreateContext.
-
-
-

If glXMakeCurrent succeeds True is returned. Otherwise False is -returned to indicate an invalid display, window or context parameter.

-

After the rendering context has been bound to the drawing surface -OpenGL rendering can begin.

-

The current rendering context may be unbound by calling -glXMakeCurrent with the window and context parameters set to zero.

-

An application may create any number of rendering contexts and bind -them as needed. Note that binding a rendering context is generally not a -light-weight operation.  Most simple OpenGL applications create -only one rendering context.
-
-

-

3.6 Color Buffer Swapping

-

A double buffered window has two color buffers: a front buffer and a -back buffer. Normally, rendering is directed to the back buffer while -the front buffer is displayed. When rendering of a frame is finished -the front and back buffers are swapped to provide the illusion of -instanteous screen updates.

-

The color buffers for a particular window (i.e. drawable) may be -swapped with the glXSwapBuffers command:

-
-
void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
-
-Any pending rendering commands will be completed before the buffer swap -takes place.
-
-Calling glXSwapBuffers on a window which is single-buffered has no -effect.
-
-

3.7 Releasing Resources

-

3.7.1 Releasing Rendering Contexts

-

A rendering context may be destroyed by calling glXDestroyContext:

-
-
void glXDestroyContext(Display *dpy, GLXContext ctx)
-
-

3.7.2 Releasing Windows

-

A window may be destroyed by calling XDestroyWindow:

-
-
void XDestroyWindow(Display *dpy, Window window)
-
-

3.7.3 Releasing Visuals

-

An XVisualInfo object may be freed by calling XFree:

-
-
void XFree(void *data)
-
-

3.7.4 Releasing Colormaps

-

A colormap may be freed by calling XFreeColormap:

-
-
void XFreeColormap(Display *dpy, Colormap colormap)
-
-

3.7.4 Releasing Display Resources

-

When the application is about to exit, the resources associated with -the graphics system can be released by calling XCloseDisplay:

-
-
void XCloseDisplay(Display *dpy)
-
-

The display handle becomes invalid at this point.
-
-

-

3.8 Query Functions

-

3.8.1 Querying Available Visuals

-A list of all available visuals can be obtained with the XGetVisualInfo -function:
-
-
XVisualInfo -*XGetVisualInfo(Display *dpy, long vinfo_mask, XVisualInfo -*vinfo_template, int *nitems_return)
-
-
-The parameters are as follows:
-
-
-
dpy
-
The display handle, as returned by XOpenDisplay.
-
vinfo_mask
-
A bitmask indicating which fields of the vinfo_template are to -be matched.  The value must be VisualScreenMask.
-
vinfo_template
-
A template whose fields indicate which visual attributes must -be matched by the results.  The screen field of this structure must -be zero.
-
nitems_return
-
Returns the number of visuals returned.
-
-
-The return value is the address of an array of all available visuals.
-
-An example of using XGetVisualInfo to get all available visuals follows:
-
-
XVisualInfo visTemplate, *results;
-int numVisuals;
-Display *dpy = XOpenDisplay(NULL);
-visTemplate.screen = 0;
-results = XGetVisualInfo(dpy, VisualScreenMask, &visTemplate, -&numVisuals);
-
-
-

3.8.2 Querying Visual Attributes

-

The GLX attributes of an X visual may be queried with the -glXGetConfig function:

-
-
int glXGetConfig(Display *dpy, XVisualInfo *vis, int attribute, int *value)
-
-

The parameters are as follows:

-
-
-
dpy
-
The display handle, as returned by XOpenDisplay.
-
vis
-
The visual, as returned by glXChooseVisual.
-
attribute
-
The attribute to query. The attributes are listed below.
-
value
-
Pointer to an integer in which the result of the query will be -stored.
-
-
-

The return value will be zero if no error occurs. - GLX_INVALID_ATTRIBUTE will be returned if the attribute -parameter is invalid.  GLX_BAD_VISUAL will be returned -if the XVisualInfo parameter is invalid.

-

The following attributes may be queried:

-
-
-
GLX_USE_GL
-
The result will be True or False to -indicate if OpenGL rendering is supported with the visual. Mini GLX -always return True.
-
GLX_RGBA
-
The result will be True for RGBA visuals or False -for color index visuals.
-
GLX_DOUBLEBUFFER
-
The result will be True if the visual has two -color buffers or False if the visual has one color buffer.
-
GLX_RED_SIZE
-
The result will be the number of red bits per pixel.
-
GLX_GREEN_SIZE
-
The result will be the number of green bits per pixel.
-
GLX_BLUE_SIZE
-
The result will be the number of blue bits per pixel.
-
GLX_ALPHA_SIZE
-
The result will be the number of alpha bits per pixel.
-
GLX_DEPTH_SIZE
-
The result will be the number of bits per Z value.
-
GLX_STENCIL_SIZE
-
The result will be the number of bits per stencil value.
-
-
-
-
-

3.8.3 Querying the Current Rendering Context

-

The current rendering context can be queried with -glXGetCurrentContext:

-
-
GLXContext glXGetCurrentContext(void)
-
-

Zero will be returned if no context is currently bound.
-
-

-

3.8.4 Querying the Current Drawable

-

The current drawable (i.e. window or drawing surface) can be queried -with glXGetCurrentDrawable:

-
-
GLXDrawable glXGetCurrentDrawable(void)
-
-

Zero will be returned if no drawable is currently bound.
-
-

-

3.8.5 Function Address Queries

-

The glXGetProcAddress function will return the address of any -available OpenGL or Mini GLX function:

-
-
void *glXGetProcAddress(const GLubyte *procName)
-
-

If procName is a valid function name, a pointer to that -function will be returned.  Otherwise, NULL will be returned.

-

The purpose of glXGetProcAddress is to facilitate using future -extensions to OpenGL or Mini GLX. If a future version of the library -adds new extension functions they'll be accessible via -glXGetProcAddress. The alternative is to hard-code calls to the new -functions in the application but doing so will prevent linking the -application with older versions of the library.
-
-

-

3.9 Versioning

-The Mini GLX version can be queried at run time with glXQueryVersion: -
-
Bool glXQueryVersion(Display *dpy, int *major, int *minor)
-
-

major will be set to the major version number andminor -will be set to the minor version number.True will be -returned if the function succeeds. False will be returned -if the function fails due to invalid parameters. The dpy -argument is currently ignored, but should be the value returned by -XOpenDisplay.

-

At compile time, the Mini GLX interface version can be tested with -the MINI_GLX_VERSION_1_x preprocessor tokens. For example, if -version 1.0 of Mini GLX is supported, then MINI_GLX_VERSION_1_0 -will be defined. If version 1.1 of Mini GLX is supported, then -MINI_GLX_VERSION_1_1 will be defined.

-

At the time of writing the current Mini GLX version is 1.0.
-
-

-

4.0 Interoperability with GLX and Xlib

-While Mini GLX strives to be compatible with GLX and Xlib there are -some unavoidable differences which must be taken into consideration.
-

4.1 Public vs Private Structures

-The structure of many X data types is public.  For example, the Display -data type is defined as a structure in /usr/include/X11/Xlib.h and -programmers may access any fields of that structure at will.  Mini -GLX also defines a Display data type but its fields are hidden and not -visiblein miniglx.h.  Duplicating the Xlib -declaration for the Display data type in minigl.h would -require defining a large number of other superfluous Xlib datatypes.
-
-Mini GLX users are discouraged from directly accessing the fields of -Xlib data types to maximize portability - though this is unavoidable to -some extent.  For example, the XVisualInfo and XSetWindowAtttributes -data types must be completely public. -

4.2 Macros

-In some cases, Xlib defines macros which are meant to be used instead -of direct structure accesses.  For example, the RootWindow(dpy, -screen) macro returns the root window for a given screen on a -given display.  Unfortunately, macros do nothing to aid in ABI -compatibility since they are resolved at compile time instead of at -link/run time.
-
-Mini GLX also defines a RootWindow macro since it's -essential for creating windows.  But the implementation of this -macro by Xlib and Mini GLX is completely different.
-

4.3 Summary

-Because Xlib and Mini GLX define data types and macros differently, -Mini GLX applications must be recompiled when retargeting Mini GLX or -native Xlib/GLX.  That is, applications can't simply be re-linked -because of ABI incompatibilities.
-
-Nevertheless, the fact that Mini GLX programs can be recompiled for -Xlib and GLX increases portability and flexibility for testing and -prototyping.
-
-

5.0 Example Program

-

This section shows an example program which uses the Mini GLX -interface. The program simply draws several frames of a rotating square.
-

-

The program may be compiled for use with Xlib/GLX or Mini GLX by -setting the USE_MINIGLX token to 0 or 1, respectively. - Note that the only difference is the header files which are -included.
-

-

-

#define USE_MINIGLX 1 /* 1 = use Mini GLX, 0 = use Xlib/GLX */

#include <stdio.h>
#include <stdlib.h>
#include <GL/gl.h>

#if USE_MINIGLX
#include <GL/miniglx.h>
#else
#include <GL/glx.h>
#include <X11/Xlib.h>
#endif

/*
* Create a simple double-buffered RGBA window.
*/
static Window
MakeWindow(Display * dpy, unsigned int width, unsigned int height)
{
int visAttributes[] = {
GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DOUBLEBUFFER,
None
};
XSetWindowAttributes attr;
unsigned long attrMask;
Window root;
Window win;
GLXContext ctx;
XVisualInfo *visinfo;

root = RootWindow(dpy, 0);

/* Choose GLX visual / pixel format */
visinfo = glXChooseVisual(dpy, 0, visAttributes);
if (!visinfo) {
printf("Error: couldn't get an RGB, Double-buffered visual\n");
exit(1);
}

/* Create the window */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
attrMask = CWBackPixel | CWBorderPixel | CWColormap;
win = XCreateWindow(dpy, root, 0, 0, width, height,
0, visinfo->depth, InputOutput,
visinfo->visual, attrMask, &attr);
if (!win) {
printf("Error: XCreateWindow failed\n");
exit(1);
}

/* Display the window */
XMapWindow(dpy, win);

/* Create GLX rendering context */
ctx = glXCreateContext(dpy, visinfo, NULL, True);
if (!ctx) {
printf("Error: glXCreateContext failed\n");
exit(1);
}

/* Bind the rendering context and window */
glXMakeCurrent(dpy, win, ctx);

return win;
}


/*
* Draw a few frames of a rotating square.
*/
static void
DrawFrames(Display * dpy, Window win)
{
int angle;
glShadeModel(GL_FLAT);
glClearColor(0.5, 0.5, 0.5, 1.0);
for (angle = 0; angle < 360; angle += 10) {
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 0.0);
glPushMatrix();
glRotatef(angle, 0, 0, 1);
glRectf(-0.8, -0.8, 0.8, 0.8);
glPopMatrix();
glXSwapBuffers(dpy, win);
}
}


int
main(int argc, char *argv[])
{
Display *dpy;
Window win;

dpy = XOpenDisplay(NULL);
if (!dpy) {
printf("Error: XOpenDisplay failed\n");
return 1;
}

win = MakeWindow(dpy, 300, 300);

DrawFrames(dpy, win);

return 0;
}
-
- - diff --git a/doxygen/Makefile b/doxygen/Makefile index 15ade4043b..120372e1da 100644 --- a/doxygen/Makefile +++ b/doxygen/Makefile @@ -22,8 +22,7 @@ full: $(FULL:.doxy=.tag) SUBSET = \ main.doxy \ - math.doxy \ - miniglx.doxy + math.doxy subset: $(SUBSET:.doxy=.tag) $(foreach FILE,$(SUBSET),doxygen $(FILE);) diff --git a/doxygen/miniglx.doxy b/doxygen/miniglx.doxy deleted file mode 100644 index 61c376caf2..0000000000 --- a/doxygen/miniglx.doxy +++ /dev/null @@ -1,179 +0,0 @@ -# Doxyfile 0.1 - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "MiniGLX" -PROJECT_NUMBER = -OUTPUT_DIRECTORY = -OUTPUT_LANGUAGE = English -EXTRACT_ALL = NO -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = YES -EXTRACT_LOCAL_CLASSES = YES -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = NO -STRIP_FROM_PATH = -INTERNAL_DOCS = YES -STRIP_CODE_COMMENTS = YES -CASE_SENSE_NAMES = YES -SHORT_NAMES = NO -HIDE_SCOPE_NAMES = NO -VERBATIM_HEADERS = NO -SHOW_INCLUDE_FILES = NO -JAVADOC_AUTOBRIEF = NO -INHERIT_DOCS = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = NO -DISTRIBUTE_GROUP_DOC = NO -TAB_SIZE = 8 -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -ALIASES = -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -OPTIMIZE_OUTPUT_FOR_C = NO -SHOW_USED_FILES = YES -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = YES -WARNINGS = YES -WARN_IF_UNDOCUMENTED = NO -WARN_FORMAT = -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ../src/glx/mini/ ../include/GL/miniglx.h -FILE_PATTERNS = *.h *.c -RECURSIVE = NO -EXCLUDE = ../src/glx/mini/glapi.c -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO -REFERENCED_BY_RELATION = YES -REFERENCES_RELATION = YES -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = NO -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = miniglx -HTML_HEADER = header_subset.html -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO -GENERATE_CHI = NO -BINARY_TOC = NO -TOC_EXPAND = NO -DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = NO -TREEVIEW_WIDTH = 250 -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = NO -USE_PDFLATEX = NO -LATEX_BATCHMODE = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = -MAN_EXTENSION = -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = ../include/ -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- -TAGFILES = \ - core_subset.tag=../core_subset \ - math_subset.tag=../math_subset -GENERATE_TAGFILE = miniglx.tag -ALLEXTERNALS = NO -PERL_PATH = -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = NO -HAVE_DOT = NO -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -TEMPLATE_RELATIONS = YES -HIDE_UNDOC_RELATIONS = YES -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -GRAPHICAL_HIERARCHY = YES -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1024 -GENERATE_LEGEND = YES -DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO -CGI_NAME = -CGI_URL = -DOC_URL = -DOC_ABSPATH = -BIN_ABSPATH = -EXT_DOC_PATHS = diff --git a/include/GL/miniglx.h b/include/GL/miniglx.h deleted file mode 100644 index 8c6180be60..0000000000 --- a/include/GL/miniglx.h +++ /dev/null @@ -1,482 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.1 - * - * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -/** - * \file miniglx.h - * \brief Mini GLX interface functions. - * \author Brian Paul - * - * See comments miniglx.c for more information. - */ - -#ifndef MINIGLX_H -#define MINIGLX_H - -#include -#include - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * \name Replacement Xlib/GLX types - */ -/*@{*/ -/** - * \brief Boolean type. - * - * It can have the values #True or #False. - */ -#ifndef MINIGLX_NO_XTYPES -typedef int Bool; -#endif -typedef int MINI_Bool; - -/** - * \brief Color map. - * - * Alias for private ::MiniGLXColormapRec structure. - */ -typedef struct MiniGLXColormapRec *MINI_Colormap; -#ifndef MINIGLX_NO_XTYPES -typedef struct MiniGLXColormapRec *Colormap; -#endif - -/** - * \brief Window attributes. - */ -typedef struct MiniGLXSetWindowAttributesRec { - int background_pixel; /**< \brief background pixel */ - int border_pixel; /**< \brief border pixel value */ - MINI_Colormap colormap; /**< \brief color map to be associated with window */ - int event_mask; /**< \brief set of events that should be saved */ -} XSetWindowAttributes; - -/** - * \brief Visual. - * - * Alias for the private ::MiniGLXVisualRec structure. - * - * \sa \ref datatypes. - */ -typedef struct MiniGLXVisualRec Visual; - -/** - * \brief Visual information. - * - * \sa \ref datatypes. - */ -#ifndef MINIGLX_NO_XTYPES -typedef unsigned long VisualID; -#endif -typedef unsigned long MINI_VisualID; -typedef struct MiniGLXXVisualInfoRec { - Visual *visual; /**< \brief pointer to the GLX Visual */ - MINI_VisualID visualid; /**< \brief visual ID */ - int screen; /**< \brief screen number */ - int depth; /**< \brief bit depth */ -#if defined(__cplusplus) || defined(c_plusplus) - int c_class; /**< \brief class */ -#else - int class; /**< \brief class */ -#endif - int bits_per_rgb; /**< \brief total bits per pixel */ -} XVisualInfo; - -/** - * \brief GLX Frame Buffer Configuration (for pbuffers) - * \sa \ref datatypes. - */ -typedef struct MiniGLXFBConfigRec { - XVisualInfo *visInfo; -} GLXFBConfig; - - -/** - * \brief Display handle. - * - * Alias for the private ::MiniGLXDisplayRec structure. - * - * \sa \ref datatypes. - */ -#ifndef MINIGLX_NO_XTYPES -typedef struct MiniGLXDisplayRec Display; -#endif -typedef struct MiniGLXDisplayRec MINI_Display; - -/** - * \brief Window handle. - * - * Alias for the private ::MiniGLXWindowRec structure. - * - * \sa \ref datatypes. - */ -#ifndef MINIGLX_NO_XTYPES -typedef struct MiniGLXWindowRec *Window; -#endif -typedef struct MiniGLXWindowRec *MINI_Window; - -/** - * \brief Drawable. - * - * Alias for the private ::MiniGLXWindowRec structure. - * - * For Mini GLX only the full-screen window can be used as source and - * destination in graphics operations. - * - * \sa \ref datatypes. - */ -#ifndef MINIGLX_NO_XTYPES -typedef struct MiniGLXWindowRec *Drawable; -#endif -typedef struct MiniGLXWindowRec *MINI_Drawable; - -/** - * \brief GLX drawable. - * - * Alias for the private ::MiniGLXWindowRec structure. - * - * Same as #Drawable. - * - * \sa \ref datatypes. - */ -typedef struct MiniGLXWindowRec *GLXDrawable; - -/** - * \brief GLX pbuffer. - * - * Alias for the private ::MiniGLXWindowRec structure. - * - * Same as #Drawable. - * - * \sa \ref datatypes. - */ -typedef struct MiniGLXWindowRec *GLXPbuffer; - -/** - * \brief GLX context. - * - * Alias for the private ::MiniGLXContext structure. - * - * \sa \ref datatypes. - */ -typedef struct MiniGLXContextRec *GLXContext; -/*@}*/ - - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - MINI_Bool send_event; /* true if this came from a SendEvent request */ - MINI_Display *display; /* Display the event was read from */ - MINI_Window window; - int x, y; - int width, height; - int count; /* if non-zero, at least this many more */ -} XExposeEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - MINI_Bool send_event; /* true if this came from a SendEvent request */ - MINI_Display *display; /* Display the event was read from */ - MINI_Window parent; /* parent of the window */ - MINI_Window window; /* window id of window created */ - int x, y; /* window location */ - int width, height; /* size of window */ - int border_width; /* border width */ - MINI_Bool override_redirect; /* creation should be overridden */ -} XCreateWindowEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - MINI_Bool send_event; /* true if this came from a SendEvent request */ - MINI_Display *display; /* Display the event was read from */ - MINI_Window event; - MINI_Window window; -} XDestroyWindowEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - MINI_Bool send_event; /* true if this came from a SendEvent request */ - MINI_Display *display; /* Display the event was read from */ - MINI_Window event; - MINI_Window window; - MINI_Bool from_configure; -} XUnmapEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - MINI_Bool send_event; /* true if this came from a SendEvent request */ - MINI_Display *display; /* Display the event was read from */ - MINI_Window event; - MINI_Window window; - MINI_Bool override_redirect; /* boolean, is override set... */ -} XMapEvent; - - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - MINI_Bool send_event; /* true if this came from a SendEvent request */ - MINI_Display *display; /* Display the event was read from */ - MINI_Window parent; - MINI_Window window; -} XMapRequestEvent; - -typedef union _XEvent { - int type; /* must not be changed; first element */ - XExposeEvent xexpose; - XCreateWindowEvent xcreatewindow; - XDestroyWindowEvent xdestroywindow; - XUnmapEvent xunmap; - XMapEvent xmap; - XMapRequestEvent xmaprequest; - long pad[24]; -} XEvent; - - -/** - * \name Xlib constants - */ -/*@{*/ -#define False 0 -#define True 1 -#define None 0 -#define AllocNone 0 -#define InputOutput 1 -#define ExposureMask (1L<<15) -#define StructureNotifyMask (1L<<17) -#define CWBackPixel (1L<<1) -#define CWBorderPixel (1L<<3) -#define CWEventMask (1L<<11) -#define CWColormap (1L<<13) -#define PseudoColor 3 -#define TrueColor 4 -#define VisualIDMask 0x1 -#define VisualScreenMask 0x2 -#define Expose 12 -#define CreateNotify 16 -#define DestroyNotify 17 -#define UnmapNotify 18 -#define MapNotify 19 -#define MapRequest 20 - -/*@}*/ - -/** - * \name Standard GLX tokens - */ -/*@{*/ -#define GLX_USE_GL 1 -#define GLX_BUFFER_SIZE 2 -#define GLX_LEVEL 3 -#define GLX_RGBA 4 -#define GLX_DOUBLEBUFFER 5 -#define GLX_STEREO 6 -#define GLX_AUX_BUFFERS 7 -#define GLX_RED_SIZE 8 -#define GLX_GREEN_SIZE 9 -#define GLX_BLUE_SIZE 10 -#define GLX_ALPHA_SIZE 11 -#define GLX_DEPTH_SIZE 12 -#define GLX_STENCIL_SIZE 13 -#define GLX_ACCUM_RED_SIZE 14 -#define GLX_ACCUM_GREEN_SIZE 15 -#define GLX_ACCUM_BLUE_SIZE 16 -#define GLX_ACCUM_ALPHA_SIZE 17 -#define GLX_BAD_ATTRIBUTE 1 -#define GLX_BAD_VISUAL 4 -/*@}*/ - - -/** - * \name Unique to Mini GLX - * - * At compile time, the Mini GLX interface version can be tested with the - * MINI_GLX_VERSION_1_x preprocessor tokens. - * - * \sa glXQueryVersion() - */ -/*@{*/ -/** \brief Defined if version 1.0 of Mini GLX is supported. */ -#define MINI_GLX_VERSION_1_0 1 -/** \brief Defined if version 1.1 of Mini GLX is supported. */ -#define MINI_GLX_VERSION_1_1 1 -/*@}*/ - - -/** - * \name Server-specific functions - */ -extern MINI_Display * -__miniglx_StartServer( const char *display_name ); - -extern int -__miniglx_Select( MINI_Display *dpy, int maxfd, - fd_set *rfds, fd_set *wfds, fd_set *xfds, - struct timeval *tv ); - - -/** - * \name Simulated Xlib functions - */ -/*@{*/ -extern MINI_Display * -XOpenDisplay( const char *dpy_name ); - - -extern void -XCloseDisplay( MINI_Display *display ); - -extern MINI_Window -XCreateWindow( MINI_Display *display, MINI_Window parent, int x, int y, - unsigned int width, unsigned int height, - unsigned int border_width, int depth, unsigned int winclass, - Visual *visual, unsigned long valuemask, - XSetWindowAttributes *attributes ); - -extern int -XNextEvent(MINI_Display *display, XEvent *event_return); - -extern MINI_Bool -XCheckMaskEvent( MINI_Display *dpy, long event_mask, XEvent *event_return ); - -/** - * \brief Return the root window. - * - * \param display the display handle. It is ignored by Mini GLX, but should be - * the value returned by XOpenDisplay(). - * \param screen the screen number on the host server. It is ignored by Mini - * GLX but should be zero. - * - * \return the root window. Always zero on Mini GLX. - */ -#define RootWindow(display, screen) 0 -#define DefaultScreen(dpy) 0 - -extern void -XDestroyWindow( MINI_Display *display, MINI_Window w ); - -extern void -XMapWindow( MINI_Display *display, MINI_Window w ); - -/* Should clients have access to this? - */ -extern void -XUnmapWindow( MINI_Display *display, MINI_Window w ); - -extern MINI_Colormap -XCreateColormap( MINI_Display *display, MINI_Window w, Visual *visual, int alloc ); - -extern void -XFreeColormap( MINI_Display *display, MINI_Colormap cmap ); - -extern void -XFree( void *data ); - -extern XVisualInfo * -XGetVisualInfo( MINI_Display *display, long vinfo_mask, - XVisualInfo *vinfo_template, int *nitems_return ); -/*@}*/ - - - -/** - * \name GLX functions - */ -/*@{*/ -extern XVisualInfo* -glXChooseVisual( MINI_Display *dpy, int screen, int *attribList ); - -extern int -glXGetConfig( MINI_Display *dpy, XVisualInfo *vis, int attrib, int *value ); - -extern GLXContext -glXCreateContext( MINI_Display *dpy, XVisualInfo *vis, - GLXContext shareList, MINI_Bool direct ); - -extern void -glXDestroyContext( MINI_Display *dpy, GLXContext ctx ); - -extern MINI_Bool -glXMakeCurrent( MINI_Display *dpy, GLXDrawable drawable, GLXContext ctx); - -extern void -glXSwapBuffers( MINI_Display *dpy, GLXDrawable drawable ); - -extern GLXContext -glXGetCurrentContext( void ); - -extern GLXDrawable -glXGetCurrentDrawable( void ); - -extern void -(*glXGetProcAddress(const GLubyte *procname))( void ); - -extern MINI_Bool -glXQueryVersion( MINI_Display *dpy, int *major, int *minor ); - -/* Added in MiniGLX 1.1 */ -extern GLXPbuffer -glXCreatePbuffer( MINI_Display *dpy, GLXFBConfig config, const int *attribList ); - -extern void -glXDestroyPbuffer( MINI_Display *dpy, GLXPbuffer pbuf ); - -extern GLXFBConfig * -glXChooseFBConfig( MINI_Display *dpy, int screen, const int *attribList, - int *nitems ); - -extern XVisualInfo * -glXGetVisualFromFBConfig( MINI_Display *dpy, GLXFBConfig config ); - -extern void *glXAllocateMemoryMESA(Display *dpy, int scrn, - size_t size, float readFreq, - float writeFreq, float priority); - -extern void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer); - -extern GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn, - const void *pointer ); -/*@}*/ - -extern void -__glXScrEnableExtension( void *, const char * name ); - -/*@}*/ - - -#ifdef __cplusplus -} -#endif - -#endif /* MINIGLX_H */ diff --git a/progs/miniglx/.gitignore b/progs/miniglx/.gitignore deleted file mode 100644 index f630f591f6..0000000000 --- a/progs/miniglx/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -manytex -miniglxsample -miniglxtest -sample_server -sample_server2 -texline diff --git a/progs/miniglx/Makefile b/progs/miniglx/Makefile deleted file mode 100644 index e6f5fa558e..0000000000 --- a/progs/miniglx/Makefile +++ /dev/null @@ -1,61 +0,0 @@ -# Makefile for miniglx demo programs - -TOP = ../.. - -include $(TOP)/configs/current - - -SOURCES = miniglxtest.c \ - miniglxsample.c \ - sample_server.c \ - sample_server2.c \ - manytex.c \ - texline.c - -OBJECTS = $(SOURCES:.c=.o) - -PROGS = $(SOURCES:%.c=%) - -INCLUDES = \ - -I. \ - -I$(TOP)/include - -LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) - - -##### RULES ##### - -.SUFFIXES: -.SUFFIXES: .c - -.c: - $(CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@ - -.c.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@ - -.S.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@ - - -##### TARGETS ##### - -default: depend $(PROGS) - -clean: - -rm -f $(PROGS) - -rm -f *.o - - -depend: $(SOURCES) - rm -f depend - touch depend - $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) > /dev/null - - -# Emacs tags -tags: - etags `find . -name \*.[ch]` `find ../include` - - -include depend diff --git a/progs/miniglx/glfbdevtest.c b/progs/miniglx/glfbdevtest.c deleted file mode 100644 index d4efb96930..0000000000 --- a/progs/miniglx/glfbdevtest.c +++ /dev/null @@ -1,477 +0,0 @@ - -/* - * Test the GLFBDev interface. Only tested with radeonfb driver!!!! - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "GL/glfbdev.h" - -#define DEFAULT_DEPTH 8 - -static struct fb_fix_screeninfo FixedInfo; -static struct fb_var_screeninfo VarInfo, OrigVarInfo; -static int DesiredDepth = 0; -static int OriginalVT = -1; -static int ConsoleFD = -1; -static int FrameBufferFD = -1; -static caddr_t FrameBuffer = (caddr_t) -1; -static caddr_t MMIOAddress = (caddr_t) -1; - - -static void -print_fixed_info(const struct fb_fix_screeninfo *fixed, const char *s) -{ - static const char *visuals[] = { - "MONO01", "MONO10", "TRUECOLOR", "PSEUDOCOLOR", - "DIRECTCOLOR", "STATIC_PSEUDOCOLOR" - }; - - printf("%s info -----------------------\n", s); - printf("id = %16s\n", fixed->id); - printf("smem_start = 0x%x\n", fixed->smem_start); - printf("smem_len = %d (0x%x)\n", fixed->smem_len, fixed->smem_len); - printf("type = 0x%x\n", fixed->type); - printf("type_aux = 0x%x\n", fixed->type_aux); - printf("visual = 0x%x (%s)\n", fixed->visual, visuals[fixed->visual]); - printf("xpanstep = %d\n", fixed->xpanstep); - printf("ypanstep = %d\n", fixed->ypanstep); - printf("ywrapstep = %d\n", fixed->ywrapstep); - printf("line_length = %d\n", fixed->line_length); - printf("mmio_start = 0x%x\n", fixed->mmio_start); - printf("mmio_len = %d (0x%x)\n", fixed->mmio_len, fixed->mmio_len); - printf("accel = 0x%x\n", fixed->accel); -} - - -static void -print_var_info(const struct fb_var_screeninfo *var, const char *s) -{ - printf("%s info -----------------------\n", s); - printf("xres = %d\n", var->xres); - printf("yres = %d\n", var->yres); - printf("xres_virtual = %d\n", var->xres_virtual); - printf("yres_virtual = %d\n", var->yres_virtual); - printf("xoffset = %d\n", var->xoffset); - printf("yoffset = %d\n", var->yoffset); - printf("bits_per_pixel = %d\n", var->bits_per_pixel); - printf("grayscale = %d\n", var->grayscale); - - printf("red.offset = %d length = %d msb_right = %d\n", - var->red.offset, var->red.length, var->red.msb_right); - printf("green.offset = %d length = %d msb_right = %d\n", - var->green.offset, var->green.length, var->green.msb_right); - printf("blue.offset = %d length = %d msb_right = %d\n", - var->blue.offset, var->blue.length, var->blue.msb_right); - printf("transp.offset = %d length = %d msb_right = %d\n", - var->transp.offset, var->transp.length, var->transp.msb_right); - - printf("nonstd = %d\n", var->nonstd); - printf("activate = %d\n", var->activate); - printf("height = %d mm\n", var->height); - printf("width = %d mm\n", var->width); - printf("accel_flags = 0x%x\n", var->accel_flags); - printf("pixclock = %d\n", var->pixclock); - printf("left_margin = %d\n", var->left_margin); - printf("right_margin = %d\n", var->right_margin); - printf("upper_margin = %d\n", var->upper_margin); - printf("lower_margin = %d\n", var->lower_margin); - printf("hsync_len = %d\n", var->hsync_len); - printf("vsync_len = %d\n", var->vsync_len); - printf("sync = %d\n", var->sync); - printf("vmode = %d\n", var->vmode); -} - - -static void -signal_handler(int signumber) -{ - signal(signumber, SIG_IGN); /* prevent recursion! */ - fprintf(stderr, "error: got signal %d (exiting)\n", signumber); - exit(1); -} - - -static void -initialize_fbdev( void ) -{ - char ttystr[1000]; - int fd, vtnumber, ttyfd; - int sz; - - if (geteuid()) { - fprintf(stderr, "error: you need to be root\n"); - exit(1); - } - -#if 1 - /* open the framebuffer device */ - FrameBufferFD = open("/dev/fb0", O_RDWR); - if (FrameBufferFD < 0) { - fprintf(stderr, "Error opening /dev/fb0: %s\n", strerror(errno)); - exit(1); - } -#endif - - /* open /dev/tty0 and get the vt number */ - if ((fd = open("/dev/tty0", O_WRONLY, 0)) < 0) { - fprintf(stderr, "error opening /dev/tty0\n"); - exit(1); - } - if (ioctl(fd, VT_OPENQRY, &vtnumber) < 0 || vtnumber < 0) { - fprintf(stderr, "error: couldn't get a free vt\n"); - exit(1); - } - close(fd); - - /* open the console tty */ - sprintf(ttystr, "/dev/tty%d", vtnumber); /* /dev/tty1-64 */ - ConsoleFD = open(ttystr, O_RDWR | O_NDELAY, 0); - if (ConsoleFD < 0) { - fprintf(stderr, "error couldn't open console fd\n"); - exit(1); - } - - /* save current vt number */ - { - struct vt_stat vts; - if (ioctl(ConsoleFD, VT_GETSTATE, &vts) == 0) - OriginalVT = vts.v_active; - } - - /* disconnect from controlling tty */ - ttyfd = open("/dev/tty", O_RDWR); - if (ttyfd >= 0) { - ioctl(ttyfd, TIOCNOTTY, 0); - close(ttyfd); - } - - /* some magic to restore the vt when we exit */ - { - struct vt_mode vt; - if (ioctl(ConsoleFD, VT_ACTIVATE, vtnumber) != 0) - printf("ioctl VT_ACTIVATE: %s\n", strerror(errno)); - if (ioctl(ConsoleFD, VT_WAITACTIVE, vtnumber) != 0) - printf("ioctl VT_WAITACTIVE: %s\n", strerror(errno)); - - if (ioctl(ConsoleFD, VT_GETMODE, &vt) < 0) { - fprintf(stderr, "error: ioctl VT_GETMODE: %s\n", strerror(errno)); - exit(1); - } - - vt.mode = VT_PROCESS; - vt.relsig = SIGUSR1; - vt.acqsig = SIGUSR1; - if (ioctl(ConsoleFD, VT_SETMODE, &vt) < 0) { - fprintf(stderr, "error: ioctl(VT_SETMODE) failed: %s\n", - strerror(errno)); - exit(1); - } - } - - /* go into graphics mode */ - if (ioctl(ConsoleFD, KDSETMODE, KD_GRAPHICS) < 0) { - fprintf(stderr, "error: ioctl(KDSETMODE, KD_GRAPHICS) failed: %s\n", - strerror(errno)); - exit(1); - } - - -#if 0 - /* open the framebuffer device */ - FrameBufferFD = open("/dev/fb0", O_RDWR); - if (FrameBufferFD < 0) { - fprintf(stderr, "Error opening /dev/fb0: %s\n", strerror(errno)); - exit(1); - } -#endif - - /* Get the fixed screen info */ - if (ioctl(FrameBufferFD, FBIOGET_FSCREENINFO, &FixedInfo)) { - fprintf(stderr, "error: ioctl(FBIOGET_FSCREENINFO) failed: %s\n", - strerror(errno)); - exit(1); - } - - print_fixed_info(&FixedInfo, "Fixed"); - - - /* get the variable screen info */ - if (ioctl(FrameBufferFD, FBIOGET_VSCREENINFO, &OrigVarInfo)) { - fprintf(stderr, "error: ioctl(FBIOGET_VSCREENINFO) failed: %s\n", - strerror(errno)); - exit(1); - } - - print_var_info(&OrigVarInfo, "Orig Var"); - - /* operate on a copy */ - VarInfo = OrigVarInfo; - - /* set the depth, resolution, etc */ - DesiredDepth = 32; - if (DesiredDepth) - VarInfo.bits_per_pixel = DesiredDepth; - - if (VarInfo.bits_per_pixel == 16) { - VarInfo.red.offset = 11; - VarInfo.green.offset = 5; - VarInfo.blue.offset = 0; - VarInfo.red.length = 5; - VarInfo.green.length = 6; - VarInfo.blue.length = 5; - VarInfo.transp.offset = 0; - VarInfo.transp.length = 0; - } - else if (VarInfo.bits_per_pixel == 32) { - VarInfo.red.offset = 16; - VarInfo.green.offset = 8; - VarInfo.blue.offset = 0; - VarInfo.transp.offset = 24; - VarInfo.red.length = 8; - VarInfo.green.length = 8; - VarInfo.blue.length = 8; - VarInfo.transp.length = 8; - } - /* timing values taken from /etc/fb.modes (1280x1024 @ 75Hz) */ - VarInfo.xres_virtual = VarInfo.xres = 1280; - VarInfo.yres_virtual = VarInfo.yres = 1024; - VarInfo.pixclock = 7408; - VarInfo.left_margin = 248; - VarInfo.right_margin = 16; - VarInfo.upper_margin = 38; - VarInfo.lower_margin = 1; - VarInfo.hsync_len = 144; - VarInfo.vsync_len = 3; - - VarInfo.xoffset = 0; - VarInfo.yoffset = 0; - VarInfo.nonstd = 0; - VarInfo.vmode &= ~FB_VMODE_YWRAP; /* turn off scrolling */ - - /* set new variable screen info */ - if (ioctl(FrameBufferFD, FBIOPUT_VSCREENINFO, &VarInfo)) { - fprintf(stderr, "ioctl(FBIOPUT_VSCREENINFO failed): %s\n", - strerror(errno)); - exit(1); - } - - print_var_info(&VarInfo, "New Var"); - - if (FixedInfo.visual != FB_VISUAL_TRUECOLOR && - FixedInfo.visual != FB_VISUAL_DIRECTCOLOR) { - fprintf(stderr, "non-TRUE/DIRECT-COLOR visuals (0x%x) not supported by this demo.\n", FixedInfo.visual); - exit(1); - } - - /* initialize colormap */ - if (FixedInfo.visual == FB_VISUAL_DIRECTCOLOR) { - struct fb_cmap cmap; - unsigned short red[256], green[256], blue[256]; - int i; - - /* we're assuming 256 entries here */ - printf("initializing directcolor colormap\n"); - cmap.start = 0; - cmap.len = 256; - cmap.red = red; - cmap.green = green; - cmap.blue = blue; - cmap.transp = NULL; - for (i = 0; i < cmap.len; i++) { - red[i] = green[i] = blue[i] = (i << 8) | i; - } - if (ioctl(FrameBufferFD, FBIOPUTCMAP, (void *) &cmap) < 0) { - fprintf(stderr, "ioctl(FBIOPUTCMAP) failed [%d]\n", i); - } - } - - /* - * fbdev says the frame buffer is at offset zero, and the mmio region - * is immediately after. - */ - - /* mmap the framebuffer into our address space */ - FrameBuffer = (caddr_t) mmap(0, /* start */ - FixedInfo.smem_len, /* bytes */ - PROT_READ | PROT_WRITE, /* prot */ - MAP_SHARED, /* flags */ - FrameBufferFD, /* fd */ - 0 /* offset */); - if (FrameBuffer == (caddr_t) - 1) { - fprintf(stderr, "error: unable to mmap framebuffer: %s\n", - strerror(errno)); - exit(1); - } - printf("FrameBuffer = %p\n", FrameBuffer); - -#if 1 - /* mmap the MMIO region into our address space */ - MMIOAddress = (caddr_t) mmap(0, /* start */ - FixedInfo.mmio_len, /* bytes */ - PROT_READ | PROT_WRITE, /* prot */ - MAP_SHARED, /* flags */ - FrameBufferFD, /* fd */ - FixedInfo.smem_len /* offset */); - if (MMIOAddress == (caddr_t) - 1) { - fprintf(stderr, "error: unable to mmap mmio region: %s\n", - strerror(errno)); - } - printf("MMIOAddress = %p\n", MMIOAddress); - - /* try out some simple MMIO register reads */ - if (1) - { - typedef unsigned int CARD32; - typedef unsigned char CARD8; -#define RADEON_CONFIG_MEMSIZE 0x00f8 -#define RADEON_MEM_SDRAM_MODE_REG 0x0158 -#define MMIO_IN32(base, offset) \ - *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) -#define INREG(addr) MMIO_IN32(MMIOAddress, addr) - int sz, type; - const char *typeStr[] = {"SDR", "DDR", "64-bit SDR"}; - sz = INREG(RADEON_CONFIG_MEMSIZE); - type = INREG(RADEON_MEM_SDRAM_MODE_REG); - printf("RADEON_CONFIG_MEMSIZE = %d (%d MB)\n", sz, sz / 1024 / 1024); - printf("RADEON_MEM_SDRAM_MODE_REG >> 30 = %d (%s)\n", - type >> 30, typeStr[type>>30]); - } -#endif - -} - - -static void -shutdown_fbdev( void ) -{ - struct vt_mode VT; - - printf("cleaning up...\n"); - /* restore original variable screen info */ - if (ioctl(FrameBufferFD, FBIOPUT_VSCREENINFO, &OrigVarInfo)) { - fprintf(stderr, "ioctl(FBIOPUT_VSCREENINFO failed): %s\n", - strerror(errno)); - exit(1); - } - - munmap(MMIOAddress, FixedInfo.mmio_len); - munmap(FrameBuffer, FixedInfo.smem_len); - close(FrameBufferFD); - - /* restore text mode */ - ioctl(ConsoleFD, KDSETMODE, KD_TEXT); - - /* set vt */ - if (ioctl(ConsoleFD, VT_GETMODE, &VT) != -1) { - VT.mode = VT_AUTO; - ioctl(ConsoleFD, VT_SETMODE, &VT); - } - - /* restore original vt */ - if (OriginalVT >= 0) { - ioctl(ConsoleFD, VT_ACTIVATE, OriginalVT); - OriginalVT = -1; - } - - close(ConsoleFD); -} - - -static void -gltest( void ) -{ - static const int attribs[] = { - GLFBDEV_DOUBLE_BUFFER, - GLFBDEV_DEPTH_SIZE, 16, - GLFBDEV_NONE - }; - GLFBDevContextPtr ctx; - GLFBDevBufferPtr buf; - GLFBDevVisualPtr vis; - int bytes, r, g, b, a; - float ang; - - printf("GLFBDEV_VENDOR = %s\n", glFBDevGetString(GLFBDEV_VENDOR)); - printf("GLFBDEV_VERSION = %s\n", glFBDevGetString(GLFBDEV_VERSION)); - - /* framebuffer size */ - bytes = VarInfo.xres_virtual * VarInfo.yres_virtual * VarInfo.bits_per_pixel / 8; - - vis = glFBDevCreateVisual( &FixedInfo, &VarInfo, attribs ); - assert(vis); - - buf = glFBDevCreateBuffer( &FixedInfo, &VarInfo, vis, FrameBuffer, NULL, bytes ); - assert(buf); - - ctx = glFBDevCreateContext( vis, NULL ); - assert(buf); - - b = glFBDevMakeCurrent( ctx, buf, buf ); - assert(b); - - /*printf("GL_EXTENSIONS: %s\n", glGetString(GL_EXTENSIONS));*/ - glGetIntegerv(GL_RED_BITS, &r); - glGetIntegerv(GL_GREEN_BITS, &g); - glGetIntegerv(GL_BLUE_BITS, &b); - glGetIntegerv(GL_ALPHA_BITS, &a); - printf("RED_BITS=%d GREEN_BITS=%d BLUE_BITS=%d ALPHA_BITS=%d\n", - r, g, b, a); - - glClearColor(0.5, 0.5, 1.0, 0); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1, 1, -1, 1, 2, 30); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0, 0, -15); - glViewport(0, 0, VarInfo.xres_virtual, VarInfo.yres_virtual); - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - glEnable(GL_DEPTH_TEST); - - for (ang = 0; ang <= 180; ang += 15) { - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glPushMatrix(); - glRotatef(ang, 1, 0, 0); - glutSolidTorus(1, 3, 40, 20); - glPopMatrix(); - glFBDevSwapBuffers(buf); - } - - /* clean up */ - b = glFBDevMakeCurrent( NULL, NULL, NULL); - assert(b); - - glFBDevDestroyContext(ctx); - glFBDevDestroyBuffer(buf); - glFBDevDestroyVisual(vis); -} - - -int -main( int argc, char *argv[] ) -{ - signal(SIGUSR1, signal_handler); /* exit if someone tries a vt switch */ - signal(SIGSEGV, signal_handler); /* catch segfaults */ - - initialize_fbdev(); - gltest(); - shutdown_fbdev(); - - return 0; -} diff --git a/progs/miniglx/manytex.c b/progs/miniglx/manytex.c deleted file mode 100644 index 74b06649f6..0000000000 --- a/progs/miniglx/manytex.c +++ /dev/null @@ -1,381 +0,0 @@ - -/* - * test handling of many texture maps - * Also tests texture priority and residency. - * - * Brian Paul - * August 2, 2000 - */ - - -#include -#include -#include -#include -#include -#include - - -static GLint NumTextures = 20; -static GLuint *TextureID = NULL; -static GLint *TextureWidth = NULL, *TextureHeight = NULL; -static GLboolean *TextureResidency = NULL; -static GLint TexWidth = 128, TexHeight = 128; -static GLfloat Zrot = 0; -static GLboolean Anim = GL_TRUE; -static GLint WinWidth = 500, WinHeight = 400; -static GLboolean MipMap = GL_FALSE; -static GLboolean LinearFilter = GL_FALSE; -static GLboolean RandomSize = GL_FALSE; -static GLint Rows, Columns; -static GLint LowPriorityCount = 0; - - -static void Idle( void ) -{ - Zrot += 1.0; - glutPostRedisplay(); -} - - -static void Display( void ) -{ - GLfloat spacing = WinWidth / Columns; - GLfloat size = spacing * 0.4; - GLint i; - - /* test residency */ - if (0) - { - GLboolean b; - GLint i, resident; - b = glAreTexturesResident(NumTextures, TextureID, TextureResidency); - if (b) { - printf("all resident\n"); - } - else { - resident = 0; - for (i = 0; i < NumTextures; i++) { - if (TextureResidency[i]) { - resident++; - } - } - printf("%d of %d texture resident\n", resident, NumTextures); - } - } - - /* render the textured quads */ - glClear( GL_COLOR_BUFFER_BIT ); - for (i = 0; i < NumTextures; i++) { - GLint row = i / Columns; - GLint col = i % Columns; - GLfloat x = col * spacing + spacing * 0.5; - GLfloat y = row * spacing + spacing * 0.5; - - GLfloat maxDim = (TextureWidth[i] > TextureHeight[i]) - ? TextureWidth[i] : TextureHeight[i]; - GLfloat w = TextureWidth[i] / maxDim; - GLfloat h = TextureHeight[i] / maxDim; - - glPushMatrix(); - glTranslatef(x, y, 0.0); - glRotatef(Zrot, 0, 0, 1); - glScalef(size, size, 1); - - glBindTexture(GL_TEXTURE_2D, TextureID[i]); - glBegin(GL_POLYGON); -#if 0 - glTexCoord2f(0, 0); glVertex2f(-1, -1); - glTexCoord2f(1, 0); glVertex2f( 1, -1); - glTexCoord2f(1, 1); glVertex2f( 1, 1); - glTexCoord2f(0, 1); glVertex2f(-1, 1); -#else - glTexCoord2f(0, 0); glVertex2f(-w, -h); - glTexCoord2f(1, 0); glVertex2f( w, -h); - glTexCoord2f(1, 1); glVertex2f( w, h); - glTexCoord2f(0, 1); glVertex2f(-w, h); -#endif - glEnd(); - glPopMatrix(); - } - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - WinWidth = width; - WinHeight = height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(0, width, 0, height, -1, 1); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); -} - - -/* - * Return a random int in [min, max]. - */ -static int RandomInt(int min, int max) -{ - int i = rand(); - int j = i % (max - min + 1); - return min + j; -} - - - -static void Init( void ) -{ - GLint i; - - if (RandomSize) { - printf("Creating %d %s random-size textures, ", NumTextures, - MipMap ? "Mipmapped" : "non-Mipmapped"); - } - else { - printf("Creating %d %s %d x %d textures, ", NumTextures, - MipMap ? "Mipmapped" : "non-Mipmapped", - TexWidth, TexHeight); - } - - if (LinearFilter) { - printf("bilinear filtering\n"); - } - else { - printf("nearest filtering\n"); - } - - - /* compute number of rows and columns of rects */ - { - GLfloat area = (GLfloat) (WinWidth * WinHeight) / (GLfloat) NumTextures; - GLfloat edgeLen = sqrt(area); - - Columns = WinWidth / edgeLen; - Rows = (NumTextures + Columns - 1) / Columns; - printf("Rows: %d Cols: %d\n", Rows, Columns); - } - - - if (!TextureID) { - TextureID = (GLuint *) malloc(sizeof(GLuint) * NumTextures); - assert(TextureID); - glGenTextures(NumTextures, TextureID); - } - - if (!TextureResidency) { - TextureResidency = (GLboolean *) malloc(sizeof(GLboolean) * NumTextures); - assert(TextureResidency); - } - - if (!TextureWidth) { - TextureWidth = (GLint *) malloc(sizeof(GLint) * NumTextures); - assert(TextureWidth); - } - if (!TextureHeight) { - TextureHeight = (GLint *) malloc(sizeof(GLint) * NumTextures); - assert(TextureHeight); - } - - for (i = 0; i < NumTextures; i++) { - GLubyte color[4]; - GLubyte *texImage; - GLint j, row, col; - - row = i / Columns; - col = i % Columns; - - glBindTexture(GL_TEXTURE_2D, TextureID[i]); - - if (i < LowPriorityCount) - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_PRIORITY, 0.5F); - - if (RandomSize) { -#if 0 - int k = (glutGet(GLUT_ELAPSED_TIME) % 7) + 2; - TexWidth = 1 << k; - TexHeight = 1 << k; -#else - TexWidth = 1 << RandomInt(2, 7); - TexHeight = 1 << RandomInt(2, 7); - printf("Random size of %3d: %d x %d\n", i, TexWidth, TexHeight); -#endif - } - - TextureWidth[i] = TexWidth; - TextureHeight[i] = TexHeight; - - texImage = (GLubyte*) malloc(4 * TexWidth * TexHeight * sizeof(GLubyte)); - assert(texImage); - - /* determine texture color */ - color[0] = (GLint) (255.0 * ((float) col / (Columns - 1))); - color[1] = 127; - color[2] = (GLint) (255.0 * ((float) row / (Rows - 1))); - color[3] = 255; - - /* fill in solid-colored teximage */ - for (j = 0; j < TexWidth * TexHeight; j++) { - texImage[j*4+0] = color[0]; - texImage[j*4+1] = color[1]; - texImage[j*4+2] = color[2]; - texImage[j*4+3] = color[3]; - } - - if (MipMap) { - GLint level = 0; - GLint w = TexWidth, h = TexHeight; - while (1) { - glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA, w, h, 0, - GL_RGBA, GL_UNSIGNED_BYTE, texImage); - if (w == 1 && h == 1) - break; - if (w > 1) - w /= 2; - if (h > 1) - h /= 2; - level++; - /*printf("%d: %d x %d\n", level, w, h);*/ - } - if (LinearFilter) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_LINEAR_MIPMAP_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } - else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_NEAREST_MIPMAP_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } - } - else { - /* Set corners to white */ - int k = 0; - texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255; - k = (TexWidth - 1) * 4; - texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255; - k = (TexWidth * TexHeight - TexWidth) * 4; - texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255; - k = (TexWidth * TexHeight - 1) * 4; - texImage[k+0] = texImage[k+1] = texImage[k+2] = texImage[k+3] = 255; - - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TexWidth, TexHeight, 0, - GL_RGBA, GL_UNSIGNED_BYTE, texImage); - if (LinearFilter) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } - else { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } - } - - free(texImage); - } - - glEnable(GL_TEXTURE_2D); -} - - -static void Key( unsigned char key, int x, int y ) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case 'a': - Anim = !Anim; - if (Anim) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 's': - Idle(); - break; - case 'z': - Zrot -= step; - break; - case 'Z': - Zrot += step; - break; - case ' ': - Init(); - break; - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - -int main( int argc, char *argv[] ) -{ - GLint i; - - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( WinWidth, WinHeight ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow(argv[0]); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - if (Anim) - glutIdleFunc(Idle); - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-n") == 0) { - NumTextures = atoi(argv[i+1]); - if (NumTextures <= 0) { - printf("Error, bad number of textures\n"); - return 1; - } - i++; - } - else if (strcmp(argv[i], "-mipmap") == 0) { - MipMap = GL_TRUE; - } - else if (strcmp(argv[i], "-linear") == 0) { - LinearFilter = GL_TRUE; - } - else if (strcmp(argv[i], "-size") == 0) { - TexWidth = atoi(argv[i+1]); - TexHeight = atoi(argv[i+2]); - assert(TexWidth >= 1); - assert(TexHeight >= 1); - i += 2; - } - else if (strcmp(argv[i], "-randomsize") == 0) { - RandomSize = GL_TRUE; - } - else if (strcmp(argv[i], "-lowpri") == 0) { - LowPriorityCount = atoi(argv[i+1]); - i++; - } - else { - printf("Usage:\n"); - printf(" manytex [options]\n"); - printf("Options:\n"); - printf(" -n \n"); - printf(" -size - specify texture size\n"); - printf(" -randomsize - use random size textures\n"); - printf(" -mipmap - generate mipmaps\n"); - printf(" -linear - use linear filtering instead of nearest\n"); - printf(" -lowpri - Set lower priority on textures\n"); - return 0; - } - } - - Init(); - - glutMainLoop(); - - return 0; -} diff --git a/progs/miniglx/miniglxsample.c b/progs/miniglx/miniglxsample.c deleted file mode 100644 index d4d6729f93..0000000000 --- a/progs/miniglx/miniglxsample.c +++ /dev/null @@ -1,128 +0,0 @@ - -#define USE_MINIGLX 1 /* 1 = use Mini GLX, 0 = use Xlib/GLX */ - -#include -#include -#include -#include - -#if USE_MINIGLX -#include -#else -#include -#include -#endif - -static void _subset_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ) -{ - glBegin( GL_QUADS ); - glVertex2f( x1, y1 ); - glVertex2f( x2, y1 ); - glVertex2f( x2, y2 ); - glVertex2f( x1, y2 ); - glEnd(); -} - - -/* - * Create a simple double-buffered RGBA window. - */ -static Window -MakeWindow(Display * dpy, unsigned int width, unsigned int height) -{ - int visAttributes[] = { - GLX_RGBA, - GLX_RED_SIZE, 1, - GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, - GLX_DOUBLEBUFFER, - None - }; - XSetWindowAttributes attr; - unsigned long attrMask; - Window root; - Window win; - GLXContext ctx; - XVisualInfo *visinfo; - - root = RootWindow(dpy, 0); - - /* Choose GLX visual / pixel format */ - visinfo = glXChooseVisual(dpy, 0, visAttributes); - if (!visinfo) { - printf("Error: couldn't get an RGB, Double-buffered visual\n"); - exit(1); - } - - /* Create the window */ - attr.background_pixel = 0; - attr.border_pixel = 0; - attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone); - attrMask = CWBackPixel | CWBorderPixel | CWColormap; - win = XCreateWindow(dpy, root, 0, 0, width, height, - 0, visinfo->depth, InputOutput, - visinfo->visual, attrMask, &attr); - if (!win) { - printf("Error: XCreateWindow failed\n"); - exit(1); - } - - /* Display the window */ - XMapWindow(dpy, win); - - /* Create GLX rendering context */ - ctx = glXCreateContext(dpy, visinfo, NULL, True); - if (!ctx) { - printf("Error: glXCreateContext failed\n"); - exit(1); - } - - /* Bind the rendering context and window */ - glXMakeCurrent(dpy, win, ctx); - - glViewport(0, 0, width, height); - - return win; -} - - -/* - * Draw a few frames of a rotating square. - */ -static void -DrawFrames(Display * dpy, Window win) -{ - int angle; - glShadeModel(GL_FLAT); - glClearColor(0.5, 0.5, 0.5, 1.0); - for (angle = 0; angle < 360; angle += 10) { - glClear(GL_COLOR_BUFFER_BIT); - glColor3f(1.0, 1.0, 0.0); - glPushMatrix(); - glRotatef(angle, 0, 0, 1); - _subset_Rectf(-0.8, -0.8, 0.8, 0.8); - glPopMatrix(); - glXSwapBuffers(dpy, win); - sleep(1); - } -} - - -int -main(int argc, char *argv[]) -{ - Display *dpy; - Window win; - - dpy = XOpenDisplay(NULL); - if (!dpy) { - printf("Error: XOpenDisplay failed\n"); - return 1; - } - - win = MakeWindow(dpy, 300, 300); - - DrawFrames(dpy, win); - - return 0; -} diff --git a/progs/miniglx/miniglxtest.c b/progs/miniglx/miniglxtest.c deleted file mode 100644 index 85c25be4ed..0000000000 --- a/progs/miniglx/miniglxtest.c +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Test the mini GLX interface. - */ - - -#include -#include -#include -#include -#include -#define USE_MINI_GLX 1 -#if USE_MINI_GLX -#include -#else -#include -#endif - -static GLXContext ctx; - -static GLuint NumFrames = 100; -static GLuint NumDisplays = 1; -static GLboolean Texture = GL_FALSE; -static GLboolean SingleBuffer = GL_FALSE; -static GLboolean Sleeps = GL_TRUE; - - -static void -rect(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) -{ - glBegin(GL_QUADS); - glTexCoord2f(0, 0); glColor3f(0, 0, 1); glVertex2f(x1, y1); - glTexCoord2f(1, 0); glColor3f(1, 0, 0); glVertex2f(x2, y1); - glTexCoord2f(1, 1); glColor3f(0, 1, 0); glVertex2f(x2, y2); - glTexCoord2f(0, 1); glColor3f(0, 0, 0); glVertex2f(x1, y2); - glEnd(); -} - - -static void -redraw(Display *dpy, Window w, int rot) -{ - GLfloat a; - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glPushMatrix(); - glRotatef(rot, 0, 0, 1); - glScalef(.5, .5, .5); - for (a = 0.0; a < 360.0; a += 30.0) { - glPushMatrix(); - glRotatef(a, 0, 0, 1); - glRotatef(40, 1, 0, 0); - glColor3f(a / 360.0, 1-a/360.0, 0); - rect(0.3, -0.25, 1.5, 0.25); - glPopMatrix(); - } - glPopMatrix(); - - if (SingleBuffer) - glFlush(); - else - glXSwapBuffers(dpy, w); -} - - -static Window -make_window(Display *dpy, unsigned int width, unsigned int height) -{ - int attrib_single[] = { GLX_RGBA, - GLX_RED_SIZE, 1, - GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, - GLX_DEPTH_SIZE, 1, - None }; - int attrib_double[] = { GLX_RGBA, - GLX_RED_SIZE, 1, - GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, - GLX_DEPTH_SIZE, 1, - GLX_DOUBLEBUFFER, - None }; - int *attrib = SingleBuffer ? attrib_single : attrib_double; - int scrnum = 0; - XSetWindowAttributes attr; - unsigned long mask; - Window root; - Window win; - XVisualInfo *visinfo; - - root = RootWindow(dpy, scrnum); - - if (!(visinfo = glXChooseVisual(dpy, scrnum, attrib))) { - printf("Error: couldn't get an RGB, Double-buffered visual\n"); - exit(1); - } - - if (!(ctx = glXCreateContext(dpy, visinfo, NULL, True))) { - printf("Error: glXCreateContext failed\n"); - exit(1); - } - - /* window attributes */ - attr.background_pixel = 0; - attr.border_pixel = 0; - attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone); - attr.event_mask = StructureNotifyMask | ExposureMask; - mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; - - win = XCreateWindow(dpy, root, 0, 0, width, height, - 0, visinfo->depth, InputOutput, - visinfo->visual, mask, &attr); - if (!win) { - printf("Error: XCreateWindow failed\n"); - exit(1); - } - - glXMakeCurrent(dpy, win, ctx); - - glViewport(0, 0, width, height); - - return win; -} - - -static void -event_loop(Display *dpy, Window win) -{ - int i; - - printf("Drawing %d frames\n", NumFrames); - - for (i = 0; i < NumFrames; i++) { - redraw(dpy, win, -i*2); - if (Sleeps) { - usleep(20000); - } - } -} - - -static int -runtest(void) -{ - Display *dpy; - Window win; - - dpy = XOpenDisplay(NULL); - if (!dpy) { - printf("Error: XOpenDisplay failed\n"); - return 1; - } - - win = make_window(dpy, 800, 600); - - srand(getpid()); - - /* init GL state */ - glClearColor(0.5, 0.5, 0.5, 1.0); - glEnable(GL_DEPTH_TEST); - if (Texture) { - GLubyte image[16][16][4]; - GLint i, j; - for (i = 0; i < 16; i++) { - for (j = 0; j < 16; j++) { - if (((i / 2) ^ (j / 2)) & 1) { - image[i][j][0] = 255; - image[i][j][1] = 255; - image[i][j][2] = 255; - image[i][j][3] = 255; - } - else { - image[i][j][0] = 128; - image[i][j][1] = 128; - image[i][j][2] = 128; - image[i][j][3] = 128; - } - } - } - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, - GL_RGBA, GL_UNSIGNED_BYTE, image); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glEnable(GL_TEXTURE_2D); - } - if (SingleBuffer) { - glDrawBuffer(GL_FRONT); - glReadBuffer(GL_FRONT); - } - else { - glDrawBuffer(GL_BACK); - } - - XMapWindow(dpy, win); - - /* wait for window to get mapped */ - { - XEvent e; - while (1) { - XNextEvent(dpy, &e); - if (e.type == MapNotify && e.xmap.window == win) { - break; - } - } - } - - event_loop(dpy, win); - - glXDestroyContext(dpy, ctx); - XDestroyWindow(dpy, win); - - XCloseDisplay(dpy); - - return 0; -} - - -static void -usage(void) -{ - printf("Usage:\n"); - printf(" -f N render N frames (default %d)\n", NumFrames); - printf(" -d N do N display cycles\n"); - printf(" -t texturing\n"); - printf(" -s single buffering\n"); - printf(" -n no usleep() delay\n"); -} - - -static void -parse_args(int argc, char *argv[]) -{ - int i; - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-f") == 0) { - NumFrames = atoi(argv[i + 1]); - i++; - } - else if (strcmp(argv[i], "-d") == 0) { - NumDisplays = atoi(argv[i + 1]); - i++; - } - else if (strcmp(argv[i], "-n") == 0) { - Sleeps = GL_FALSE; - } - else if (strcmp(argv[i], "-s") == 0) { - SingleBuffer = GL_TRUE; - } - else if (strcmp(argv[i], "-t") == 0) { - Texture = GL_TRUE; - } - else { - usage(); - exit(1); - } - } -} - - -int -main(int argc, char *argv[]) -{ - int i; - - parse_args(argc, argv); - - for (i = 0; i < NumDisplays; i++) { - if (runtest() != 0) - break; - } - - return 0; -} diff --git a/progs/miniglx/sample_server.c b/progs/miniglx/sample_server.c deleted file mode 100644 index 62456eca25..0000000000 --- a/progs/miniglx/sample_server.c +++ /dev/null @@ -1,111 +0,0 @@ - -/* - * Sample server that just keeps first available window mapped. - */ - - -#include -#include -#include -#include - -struct client { - struct client *next; - Window windowid; - int mappable; -}; - -struct client *clients = 0, *mapped_client = 0; - - -static struct client *find_client( Window id ) -{ - struct client *c; - - for (c = clients ; c ; c = c->next) - if (c->windowid == id) - return c; - - return 0; -} - -int main( int argc, char *argv[] ) -{ - Display *dpy; - XEvent ev; - - dpy = __miniglx_StartServer(NULL); - if (!dpy) { - fprintf(stderr, "Error: __miniglx_StartServer failed\n"); - return 1; - } - - while (XNextEvent( dpy, &ev )) { - struct client *c; - - switch (ev.type) { - case MapRequest: - fprintf(stderr, "MapRequest\n"); - c = find_client(ev.xmaprequest.window); - if (!c) break; - c->mappable = True; - break; - - case UnmapNotify: - fprintf(stderr, "UnmapNotify\n"); - c = find_client(ev.xunmap.window); - if (!c) break; - c->mappable = False; - if (c == mapped_client) - mapped_client = 0; - break; - - case CreateNotify: - fprintf(stderr, "CreateNotify\n"); - c = malloc(sizeof(*c)); - c->next = clients; - c->windowid = ev.xcreatewindow.window; - c->mappable = False; - clients = c; - break; - - case DestroyNotify: - fprintf(stderr, "DestroyNotify\n"); - c = find_client(ev.xdestroywindow.window); - if (!c) break; - if (c == clients) - clients = c->next; - else { - struct client *t; - for (t = clients ; t->next != c ; t = t->next) - ; - t->next = c->next; - } - - if (c == mapped_client) - mapped_client = 0; - - free(c); - break; - - default: - break; - } - - /* Search for first mappable client if none already mapped. - */ - if (!mapped_client) { - for (c = clients ; c ; c = c->next) { - if (c->mappable) { - XMapWindow( dpy, c->windowid ); - mapped_client = c; - break; - } - } - } - } - - XCloseDisplay( dpy ); - - return 0; -} diff --git a/progs/miniglx/sample_server2.c b/progs/miniglx/sample_server2.c deleted file mode 100644 index efd382a6d9..0000000000 --- a/progs/miniglx/sample_server2.c +++ /dev/null @@ -1,228 +0,0 @@ - -/* - * Sample server that just keeps first available window mapped. - * - * It also reads and echos anything that happens on stdin as an - * example of tracking events from sources other than miniglx clients. - * - * It reads & writes without blocking, so that eg. piping a lot of - * text to stdin and then hitting 'ctrl-S' on the output stream won't - * cause it to stop handling miniglx events. - * - * See select_tut in the linux manual pages for a good overview of the - * select(2) system call. - */ - - -#include -#include -#include -#include -#include -#include -#include -#include - -struct client { - struct client *next; - Window windowid; - int mappable; -}; - -struct client *clients = 0, *mapped_client = 0; - -#define BUFSZ 4096 -char rbuf[BUFSZ]; -int rbuf_count; - - -static struct client *find_client( Window id ) -{ - struct client *c; - - for (c = clients ; c ; c = c->next) - if (c->windowid == id) - return c; - - return 0; -} - -int main( int argc, char *argv[] ) -{ - Display *dpy; - XEvent ev; - int autostart = 0; - - if (argc == 2 && strcmp(argv[1], "-autostart") == 0) - autostart = 1; - - dpy = __miniglx_StartServer(NULL); - if (!dpy) { - fprintf(stderr, "Error: __miniglx_StartServer failed\n"); - return 1; - } - - /* How is vt switching communicated through the XNextEvent interface? - */ - while (1) { - int r, n; - struct timeval tv; - fd_set rfds, wfds; - int bored = 0; - - FD_ZERO(&rfds); - FD_ZERO(&wfds); - tv.tv_sec = 1; - tv.tv_usec = 0; - - if (rbuf_count) { - FD_SET( 1, &wfds ); /* notify when we can write out buffer */ - n = 1; - } - else { - FD_SET( 0, &rfds ); /* else notify when new data to read */ - n = 0; - } - - /* __miniglx_Select waits until any of these file groups becomes - * readable/writable/etc (like regular select), until timeout - * expires (like regular select), until a signal is received - * (like regular select) or until an event is available for - * XCheckMaskEvent(). - */ - r = __miniglx_Select( dpy, n+1, &rfds, &wfds, 0, &tv ); - - /* This can happen if select() is interrupted by a signal: - */ - if (r < 0 && errno != EINTR && errno != EAGAIN) { - perror ("select()"); - exit (1); - } - - if (tv.tv_sec == 0 && tv.tv_usec == 0) - bored = 1; - - /* Check and handle events on our local file descriptors - */ - if (FD_ISSET( 0, &rfds )) { - /* Something on stdin */ - assert(rbuf_count == 0); - r = read(0, rbuf, BUFSZ); - if (r < 1) { - perror("read"); - abort(); - } - rbuf_count = r; - } - - if (FD_ISSET( 1, &wfds )) { - /* Can write to stdout */ - assert(rbuf_count > 0); - r = write(1, rbuf, rbuf_count); - if (r < 1) { - perror("write"); - abort(); - } - rbuf_count -= r; - if (rbuf_count) - memmove(rbuf + r, rbuf, rbuf_count); - } - - - /* Check and handle events generated by miniglx: - */ - while (XCheckMaskEvent( dpy, ~0, &ev )) { - struct client *c; - bored = 0; - - fprintf(stderr, "Received event %d\n", ev.type); - - switch (ev.type) { - case CreateNotify: - fprintf(stderr, "CreateNotify -- new client\n"); - c = malloc(sizeof(*c)); - c->next = clients; - c->windowid = ev.xcreatewindow.window; - c->mappable = False; - clients = c; - break; - - case DestroyNotify: - fprintf(stderr, "DestroyNotify\n"); - c = find_client(ev.xdestroywindow.window); - if (!c) break; - if (c == clients) - clients = c->next; - else { - struct client *t; - for (t = clients ; t->next != c ; t = t->next) - ; - t->next = c->next; - } - - if (c == mapped_client) - mapped_client = 0; - - free(c); - break; - - case MapRequest: - fprintf(stderr, "MapRequest\n"); - c = find_client(ev.xmaprequest.window); - if (!c) break; - c->mappable = True; - break; - - case UnmapNotify: - fprintf(stderr, "UnmapNotify\n"); - c = find_client(ev.xunmap.window); - if (!c) break; - c->mappable = False; - if (c == mapped_client) - mapped_client = 0; - break; - - default: - break; - } - } - - - /* Search for first mappable client if none already mapped. - */ - if (!mapped_client) { - struct client *c; - for (c = clients ; c ; c = c->next) { - if (c->mappable) { - XMapWindow( dpy, c->windowid ); - mapped_client = c; - break; - } - } - if (!clients && autostart) { - system("nohup ./texline &"); - system("nohup ./manytex &"); - } - } - else if (bored) { - struct client *c; - /* bored of mapped client now, let's try & find another one */ - for (c = mapped_client->next ; c && !c->mappable ; c = c->next) - ; - if (!c) - for (c = clients ; c && !c->mappable ; c = c->next) - ; - if (c && c != mapped_client) { - XUnmapWindow( dpy, mapped_client->windowid ); - XMapWindow( dpy, c->windowid ); - mapped_client = c; - } - else - fprintf(stderr, "I'm bored!\n"); - } - } - - XCloseDisplay( dpy ); - - return 0; -} diff --git a/progs/miniglx/texline.c b/progs/miniglx/texline.c deleted file mode 100644 index 098077f247..0000000000 --- a/progs/miniglx/texline.c +++ /dev/null @@ -1,267 +0,0 @@ - -/* - * Test textured lines. - * - * Brian Paul - * September 2000 - */ - - -#include -#include -#include -#include -#include "../util/readtex.c" /* I know, this is a hack. */ - -#define TEXTURE_FILE "../images/girl.rgb" - -static GLboolean Antialias = GL_FALSE; -static GLboolean Animate = GL_FALSE; -static GLint Texture = 1; -static GLboolean Stipple = GL_FALSE; -static GLfloat LineWidth = 1.0; - -static GLfloat Xrot = -60.0, Yrot = 0.0, Zrot = 0.0; -static GLfloat DYrot = 1.0; -static GLboolean Points = GL_FALSE; -static GLfloat Scale = 1.0; - -static void Idle( void ) -{ - if (Animate) { - Zrot += DYrot; - glutPostRedisplay(); - } -} - - -static void Display( void ) -{ - GLfloat x, y, s, t; - - glClear( GL_COLOR_BUFFER_BIT ); - - glPushMatrix(); - glRotatef(Xrot, 1.0, 0.0, 0.0); - glRotatef(Yrot, 0.0, 1.0, 0.0); - glRotatef(Zrot, 0.0, 0.0, 1.0); - glScalef(Scale, Scale, Scale); - - if (Texture) - glColor3f(1, 1, 1); - - if (Points) { - glBegin(GL_POINTS); - for (t = 0.0; t <= 1.0; t += 0.025) { - for (s = 0.0; s <= 1.0; s += 0.025) { - x = s * 2.0 - 1.0; - y = t * 2.0 - 1.0; - if (!Texture) - glColor3f(1, 0, 1); - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, t, s); - glTexCoord2f(s, t); - glVertex2f(x, y); - } - } - glEnd(); - } - else { - glBegin(GL_LINES); - for (t = 0.0; t <= 1.0; t += 0.025) { - x = t * 2.0 - 1.0; - if (!Texture) - glColor3f(1, 0, 1); - glTexCoord2f(t, 0.0); - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.0, t); - glVertex2f(x, -1.0); - if (!Texture) - glColor3f(0, 1, 0); - glTexCoord2f(t, 1.0); - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 1.0, t); - glVertex2f(x, 1.0); - } - glEnd(); - } - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - GLfloat ar = (float) width / height; - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glFrustum( -ar, ar, -1.0, 1.0, 10.0, 100.0 ); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - glTranslatef( 0.0, 0.0, -12.0 ); -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 'a': - Antialias = !Antialias; - if (Antialias) { - glEnable(GL_LINE_SMOOTH); - glEnable(GL_POINT_SMOOTH); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } - else { - glDisable(GL_LINE_SMOOTH); - glDisable(GL_POINT_SMOOTH); - glDisable(GL_BLEND); - } - break; - case 't': - Texture++; - if (Texture > 2) - Texture = 0; - if (Texture == 0) { - glActiveTextureARB(GL_TEXTURE0_ARB); - glDisable(GL_TEXTURE_2D); - glActiveTextureARB(GL_TEXTURE1_ARB); - glDisable(GL_TEXTURE_2D); - } - else if (Texture == 1) { - glActiveTextureARB(GL_TEXTURE0_ARB); - glEnable(GL_TEXTURE_2D); - glActiveTextureARB(GL_TEXTURE1_ARB); - glDisable(GL_TEXTURE_2D); - } - else { - glActiveTextureARB(GL_TEXTURE0_ARB); - glEnable(GL_TEXTURE_2D); - glActiveTextureARB(GL_TEXTURE1_ARB); - glEnable(GL_TEXTURE_2D); - } - break; - case 'w': - LineWidth -= 0.25; - if (LineWidth < 0.25) - LineWidth = 0.25; - glLineWidth(LineWidth); - glPointSize(LineWidth); - break; - case 'W': - LineWidth += 0.25; - if (LineWidth > 8.0) - LineWidth = 8.0; - glLineWidth(LineWidth); - glPointSize(LineWidth); - break; - case 'p': - Points = !Points; - break; - case 's': - Stipple = !Stipple; - if (Stipple) - glEnable(GL_LINE_STIPPLE); - else - glDisable(GL_LINE_STIPPLE); - break; - case ' ': - Animate = !Animate; - if (Animate) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 27: - exit(0); - break; - } - printf("LineWidth, PointSize = %f\n", LineWidth); - glutPostRedisplay(); -} - - -static void SpecialKey( int key, int x, int y ) -{ - float step = 3.0; - (void) x; - (void) y; - - switch (key) { - case GLUT_KEY_UP: - Xrot += step; - break; - case GLUT_KEY_DOWN: - Xrot -= step; - break; - case GLUT_KEY_LEFT: - Yrot += step; - break; - case GLUT_KEY_RIGHT: - Yrot -= step; - break; - } - glutPostRedisplay(); -} - - -static void Init( int argc, char *argv[] ) -{ - GLuint u; - for (u = 0; u < 2; u++) { - glActiveTextureARB(GL_TEXTURE0_ARB + u); - glBindTexture(GL_TEXTURE_2D, 10+u); - if (u == 0) - glEnable(GL_TEXTURE_2D); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - if (u == 0) - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - else - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) { - printf("Error: couldn't load texture image\n"); - exit(1); - } - } - - glLineStipple(1, 0xff); - - if (argc > 1 && strcmp(argv[1], "-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[] ) -{ - glutInit( &argc, argv ); - glutInitWindowSize( 400, 300 ); - - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - - glutCreateWindow(argv[0] ); - - Init(argc, argv); - - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutSpecialFunc( SpecialKey ); - glutDisplayFunc( Display ); - if (Animate) - glutIdleFunc( Idle ); - - glutMainLoop(); - return 0; -} diff --git a/src/glut/mini/Makefile b/src/glut/mini/Makefile deleted file mode 100644 index b82a758d2c..0000000000 --- a/src/glut/mini/Makefile +++ /dev/null @@ -1,103 +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) - -CORE_SOURCES = \ - bitmap.c \ - callback.c \ - color.c \ - globals.c \ - init.c \ - menu.c \ - models.c \ - overlay.c \ - state.c \ - teapot.c \ - window.c - - -MARK_SOURCES = \ - $(MARK)/glut_8x13.c \ - $(MARK)/glut_9x15.c \ - $(MARK)/glut_hel10.c \ - $(MARK)/glut_hel12.c \ - $(MARK)/glut_hel18.c \ - $(MARK)/glut_tr10.c \ - $(MARK)/glut_tr24.c - -SOURCES = $(CORE_SOURCES) $(MARK_SOURCES) - -OBJECTS = $(SOURCES:.c=.o) - - -##### RULES ##### - -.c.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - -.S.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - - -##### TARGETS ##### - -default: depend $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME) - - -# Make the library -$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS) - $(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` - - -# glut pkgconfig file -pcedit = sed \ - -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ - -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ - -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ - -e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),' \ - -e 's,@GLUT_PC_REQ_PRIV@,$(GLUT_PC_REQ_PRIV),' \ - -e 's,@GLUT_PC_LIB_PRIV@,$(GLUT_PC_LIB_PRIV),' \ - -e 's,@GLUT_PC_CFLAGS@,$(GLUT_PC_CFLAGS),' \ - -e 's,@GLUT_LIB@,$(GLUT_LIB),' -glut.pc: glut.pc.in - $(pcedit) $< > $@ - -install: glut.pc - $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL - $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) - $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig - $(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_INC_DIR)/GL - $(MINSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_LIB_DIR) - $(INSTALL) -m 644 glut.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig - - -# Remove .o and backup files -clean: depend - -rm -f depend depend.bak - -rm -f *.o *~ *.o *~ *.so *.pc libglut.so.3.7 - -include depend diff --git a/src/glut/mini/bitmap.c b/src/glut/mini/bitmap.c deleted file mode 100644 index 55a031af0a..0000000000 --- a/src/glut/mini/bitmap.c +++ /dev/null @@ -1,56 +0,0 @@ - -/* Copyright (c) Mark J. Kilgard, 1994. */ - -/* This program is freely distributable without licensing fees - and is provided without guarantee or warrantee expressed or - implied. This program is -not- in the public domain. */ - -#include "glutbitmap.h" - -void APIENTRY -glutBitmapCharacter(GLUTbitmapFont font, int c) -{ - const BitmapCharRec *ch; - BitmapFontPtr fontinfo; - GLfloat swapbytes, lsbfirst, rowlength; - GLfloat skiprows, skippixels, alignment; - -#if defined(_WIN32) - fontinfo = (BitmapFontPtr) __glutFont(font); -#else - fontinfo = (BitmapFontPtr) font; -#endif - - if (c < fontinfo->first || - c >= fontinfo->first + fontinfo->num_chars) - return; - ch = fontinfo->ch[c - fontinfo->first]; - if (ch) { - /* Save current modes. */ -/* glGetFloatv(GL_UNPACK_SWAP_BYTES, &swapbytes); */ -/* glGetFloatv(GL_UNPACK_LSB_FIRST, &lsbfirst); */ -/* glGetFloatv(GL_UNPACK_ROW_LENGTH, &rowlength); */ -/* glGetFloatv(GL_UNPACK_SKIP_ROWS, &skiprows); */ -/* glGetFloatv(GL_UNPACK_SKIP_PIXELS, &skippixels); */ - glGetFloatv(GL_UNPACK_ALIGNMENT, &alignment); - /* Little endian machines (DEC Alpha for example) could - benefit from setting GL_UNPACK_LSB_FIRST to GL_TRUE - instead of GL_FALSE, but this would require changing the - generated bitmaps too. */ -/* glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); */ -/* glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE); */ -/* glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); */ -/* glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); */ -/* glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); */ - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glBitmap(ch->width, ch->height, ch->xorig, ch->yorig, - ch->advance, 0, ch->bitmap); - /* Restore saved modes. */ -/* glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes); */ -/* glPixelStorei(GL_UNPACK_LSB_FIRST, (int)lsbfirst); */ -/* glPixelStorei(GL_UNPACK_ROW_LENGTH, (int)rowlength); */ -/* glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows); */ -/* glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels); */ - glPixelStorei(GL_UNPACK_ALIGNMENT, (int)alignment); - } -} diff --git a/src/glut/mini/callback.c b/src/glut/mini/callback.c deleted file mode 100644 index d4e3101cc0..0000000000 --- a/src/glut/mini/callback.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 3.4 - * Copyright (C) 1995-1998 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* - * DOS/DJGPP glut driver v1.0 for Mesa 4.0 - * - * Copyright (C) 2002 - Borca Daniel - * Email : dborca@yahoo.com - * Web : http://www.geocities.com/dborca - */ - - -#include "GL/glut.h" -#include "internal.h" - - -void APIENTRY glutDisplayFunc (void (GLUTCALLBACK *func) (void)) -{ - display_func = func; -} - - -void APIENTRY glutReshapeFunc (void (GLUTCALLBACK *func) (int width, int height)) -{ - reshape_func = func; -} - - -void APIENTRY glutKeyboardFunc (void (GLUTCALLBACK *func) (unsigned char key, int x, int y)) -{ - keyboard_func = func; -} - - -void APIENTRY glutMouseFunc (void (GLUTCALLBACK *func) (int button, int state, int x, int y)) -{ - mouse_func = func; -} - - -void APIENTRY glutMotionFunc (void (GLUTCALLBACK *func) (int x, int y)) -{ - motion_func = func; -} - - -void APIENTRY glutPassiveMotionFunc (void (GLUTCALLBACK *func) (int x, int y)) -{ - passive_motion_func = func; -} - - -void APIENTRY glutEntryFunc (void (GLUTCALLBACK *func) (int state)) -{ - entry_func = func; -} - - -void APIENTRY glutVisibilityFunc (void (GLUTCALLBACK *func) (int state)) -{ - visibility_func = func; -} - - -void APIENTRY glutIdleFunc (void (GLUTCALLBACK *func) (void)) -{ - idle_func = func; -} - - -void APIENTRY glutTimerFunc (unsigned int millis, void (GLUTCALLBACK *func) (int value), int value) -{ -} - - -void APIENTRY glutMenuStateFunc (void (GLUTCALLBACK *func) (int state)) -{ - menu_state_func = func; -} - - -void APIENTRY glutSpecialFunc (void (GLUTCALLBACK *func) (int key, int x, int y)) -{ - special_func = func; -} - - -void APIENTRY glutSpaceballMotionFunc (void (GLUTCALLBACK *func) (int x, int y, int z)) -{ -} - - -void APIENTRY glutSpaceballRotateFunc (void (GLUTCALLBACK *func) (int x, int y, int z)) -{ -} - - -void APIENTRY glutSpaceballButtonFunc (void (GLUTCALLBACK *func) (int button, int state)) -{ -} - - -void APIENTRY glutButtonBoxFunc (void (GLUTCALLBACK *func) (int button, int state)) -{ -} - - -void APIENTRY glutDialsFunc (void (GLUTCALLBACK *func) (int dial, int value)) -{ -} - - -void APIENTRY glutTabletMotionFunc (void (GLUTCALLBACK *func) (int x, int y)) -{ -} - - -void APIENTRY glutTabletButtonFunc (void (GLUTCALLBACK *func) (int button, int state, int x, int y)) -{ -} - - -void APIENTRY glutMenuStatusFunc (void (GLUTCALLBACK *func) (int status, int x, int y)) -{ -} - - -void APIENTRY glutOverlayDisplayFunc (void (GLUTCALLBACK *func) (void)) -{ -} - - -void APIENTRY glutWindowStatusFunc (void (GLUTCALLBACK *func) (int state)) -{ -} diff --git a/src/glut/mini/color.c b/src/glut/mini/color.c deleted file mode 100644 index b53c5b669e..0000000000 --- a/src/glut/mini/color.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 3.4 - * Copyright (C) 1995-1998 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* - * DOS/DJGPP glut driver v1.0 for Mesa 4.0 - * - * Copyright (C) 2002 - Borca Daniel - * Email : dborca@yahoo.com - * Web : http://www.geocities.com/dborca - */ - - -#include "GL/glut.h" - - -void APIENTRY glutSetColor (int ndx, GLfloat red, GLfloat green, GLfloat blue) -{ -} - - -GLfloat APIENTRY glutGetColor (int ndx, int component) -{ - return 0.0; -} - - -void APIENTRY glutCopyColormap (int win) -{ -} diff --git a/src/glut/mini/globals.c b/src/glut/mini/globals.c deleted file mode 100644 index 76db53c695..0000000000 --- a/src/glut/mini/globals.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 3.4 - * Copyright (C) 1995-1998 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* - * DOS/DJGPP glut driver v1.0 for Mesa 4.0 - * - * Copyright (C) 2002 - Borca Daniel - * Email : dborca@yahoo.com - * Web : http://www.geocities.com/dborca - */ - - -#include "GL/glut.h" -#include "internal.h" - -GLenum g_display_mode = 0; -GLuint g_width = DEFAULT_WIDTH; -GLuint g_height = DEFAULT_HEIGHT; -GLint g_mouse = GL_FALSE; -GLboolean g_redisplay = GL_FALSE; -GLint g_xpos = 0; -GLint g_ypos = 0; - -void (GLUTCALLBACK *display_func) (void) = 0; -void (GLUTCALLBACK *reshape_func) (int width, int height) = 0; -void (GLUTCALLBACK *keyboard_func) (unsigned char key, int x, int y) = 0; -void (GLUTCALLBACK *mouse_func) (int button, int state, int x, int y) = 0; -void (GLUTCALLBACK *motion_func) (int x, int y) = 0; -void (GLUTCALLBACK *passive_motion_func) (int x, int y) = 0; -void (GLUTCALLBACK *entry_func) (int state) = 0; -void (GLUTCALLBACK *visibility_func) (int state) = 0; -void (GLUTCALLBACK *idle_func) (void) = 0; -void (GLUTCALLBACK *menu_state_func) (int state) = 0; -void (GLUTCALLBACK *special_func) (int key, int x, int y) = 0; -void (GLUTCALLBACK *spaceball_motion_func) (int x, int y, int z) = 0; -void (GLUTCALLBACK *spaceball_rotate_func) (int x, int y, int z) = 0; -void (GLUTCALLBACK *spaceball_button_func) (int button, int state) = 0; -void (GLUTCALLBACK *button_box_func) (int button, int state) = 0; -void (GLUTCALLBACK *dials_func) (int dial, int value) = 0; -void (GLUTCALLBACK *tablet_motion_func) (int x, int y) = 0; -void (GLUTCALLBACK *tabled_button_func) (int button, int state, int x, int y) = 0; -void (GLUTCALLBACK *menu_status_func) (int status, int x, int y) = 0; -void (GLUTCALLBACK *overlay_display_func) (void) = 0; -void (GLUTCALLBACK *window_status_func) (int state) = 0; diff --git a/src/glut/mini/glut.pc.in b/src/glut/mini/glut.pc.in deleted file mode 100644 index 151dd0b802..0000000000 --- a/src/glut/mini/glut.pc.in +++ /dev/null @@ -1,13 +0,0 @@ -prefix=@INSTALL_DIR@ -exec_prefix=${prefix} -libdir=@INSTALL_LIB_DIR@ -includedir=@INSTALL_INC_DIR@ - -Name: glut -Description: Mesa OpenGL Utility Toolkit library -Requires: gl glu -Requires.private: @GLUT_PC_REQ_PRIV@ -Version: @VERSION@ -Libs: -L${libdir} -l@GLUT_LIB@ -Libs.private: @GLUT_PC_LIB_PRIV@ -Cflags: -I${includedir} @GLUT_PC_CFLAGS@ diff --git a/src/glut/mini/init.c b/src/glut/mini/init.c deleted file mode 100644 index 5588db9aba..0000000000 --- a/src/glut/mini/init.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 4.0 - * Copyright (C) 1995-1998 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* - * DOS/DJGPP glut driver v1.0 for Mesa 4.0 - * - * Copyright (C) 2002 - Borca Daniel - * Email : dborca@yahoo.com - * Web : http://www.geocities.com/dborca - */ - - -#include "GL/glut.h" -#include "internal.h" - - -void APIENTRY glutInit (int *argcp, char **argv) -{ - glutGet(GLUT_ELAPSED_TIME); -} - - -void APIENTRY glutInitDisplayMode (unsigned int mode) -{ - g_display_mode = mode; -} - - -void APIENTRY glutInitWindowPosition (int x, int y) -{ - g_xpos = x; - g_ypos = y; -} - - -void APIENTRY glutInitWindowSize (int width, int height) -{ - g_width = width; - g_height = height; -} - - diff --git a/src/glut/mini/internal.h b/src/glut/mini/internal.h deleted file mode 100644 index ccd12e54af..0000000000 --- a/src/glut/mini/internal.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 4.0 - * Copyright (C) 1995-1998 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* - * DOS/DJGPP glut driver v1.0 for Mesa 4.0 - * - * Copyright (C) 2002 - Borca Daniel - * Email : dborca@yahoo.com - * Web : http://www.geocities.com/dborca - */ - - -#ifndef INTERNAL_H_included -#define INTERNAL_H_included - - -#include "GL/glut.h" -/* #include "pc_hw/pc_hw.h" */ - - -#define MAX_WINDOWS 4 - -#define DEFAULT_WIDTH 640 -#define DEFAULT_HEIGHT 480 -#define DEFAULT_BPP 16 - -#define DEPTH_SIZE 16 -#define STENCIL_SIZE 8 -#define ACCUM_SIZE 16 - -extern GLenum g_display_mode; -extern GLuint g_width; -extern GLuint g_height; -extern GLint g_mouse; -extern GLboolean g_redisplay; -extern GLint g_xpos; -extern GLint g_ypos; - -extern void (GLUTCALLBACK *display_func) (void); -extern void (GLUTCALLBACK *reshape_func) (int width, int height); -extern void (GLUTCALLBACK *keyboard_func) (unsigned char key, int x, int y); -extern void (GLUTCALLBACK *mouse_func) (int button, int state, int x, int y); -extern void (GLUTCALLBACK *motion_func) (int x, int y); -extern void (GLUTCALLBACK *passive_motion_func) (int x, int y); -extern void (GLUTCALLBACK *entry_func) (int state); -extern void (GLUTCALLBACK *visibility_func) (int state); -extern void (GLUTCALLBACK *idle_func) (void); -extern void (GLUTCALLBACK *menu_state_func) (int state); -extern void (GLUTCALLBACK *special_func) (int key, int x, int y); -extern void (GLUTCALLBACK *spaceball_motion_func) (int x, int y, int z); -extern void (GLUTCALLBACK *spaceball_rotate_func) (int x, int y, int z); -extern void (GLUTCALLBACK *spaceball_button_func) (int button, int state); -extern void (GLUTCALLBACK *button_box_func) (int button, int state); -extern void (GLUTCALLBACK *dials_func) (int dial, int value); -extern void (GLUTCALLBACK *tablet_motion_func) (int x, int y); -extern void (GLUTCALLBACK *tabled_button_func) (int button, int state, int x, int y); -extern void (GLUTCALLBACK *menu_status_func) (int status, int x, int y); -extern void (GLUTCALLBACK *overlay_display_func) (void); -extern void (GLUTCALLBACK *window_status_func) (int state); - -#endif diff --git a/src/glut/mini/menu.c b/src/glut/mini/menu.c deleted file mode 100644 index 3c571647b1..0000000000 --- a/src/glut/mini/menu.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 3.4 - * Copyright (C) 1995-1998 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* - * DOS/DJGPP glut driver v1.0 for Mesa 4.0 - * - * Copyright (C) 2002 - Borca Daniel - * Email : dborca@yahoo.com - * Web : http://www.geocities.com/dborca - */ - - -#include "GL/glut.h" - - -int APIENTRY glutCreateMenu (void (GLUTCALLBACK *func) (int)) -{ - return 0; -} - -void APIENTRY glutDestroyMenu (int menu) -{ -} - - -int APIENTRY glutGetMenu (void) -{ - return 0; -} - - -void APIENTRY glutSetMenu (int menu) -{ -} - - -void APIENTRY glutAddMenuEntry (const char *label, int value) -{ -} - - -void APIENTRY glutAddSubMenu (const char *label, int submenu) -{ -} - - -void APIENTRY glutChangeToMenuEntry (int item, const char *label, int value) -{ -} - - -void APIENTRY glutChangeToSubMenu (int item, const char *label, int submenu) -{ -} - - -void APIENTRY glutRemoveMenuItem (int item) -{ -} - - -void APIENTRY glutAttachMenu (int button) -{ -} - - -void APIENTRY glutDetachMenu (int button) -{ -} diff --git a/src/glut/mini/models.c b/src/glut/mini/models.c deleted file mode 100644 index 3f955b88ff..0000000000 --- a/src/glut/mini/models.c +++ /dev/null @@ -1,598 +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 -#include -#include -#include "GL/glut.h" - -/* Some files do not define M_PI... */ -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -static GLUquadricObj *quadObj; - -#define QUAD_OBJ_INIT() { if(!quadObj) initQuadObj(); } - -static void -initQuadObj(void) -{ - quadObj = gluNewQuadric(); -/* if (!quadObj) - __glutFatalError("out of memory."); */ -} - -/* CENTRY */ -void APIENTRY -glutWireSphere(GLdouble radius, GLint slices, GLint stacks) -{ - QUAD_OBJ_INIT(); - gluQuadricDrawStyle(quadObj, GLU_LINE); - gluQuadricNormals(quadObj, GLU_SMOOTH); - /* If we ever changed/used the texture or orientation state - of quadObj, we'd need to change it to the defaults here - with gluQuadricTexture and/or gluQuadricOrientation. */ - gluSphere(quadObj, radius, slices, stacks); -} - -void APIENTRY -glutSolidSphere(GLdouble radius, GLint slices, GLint stacks) -{ - QUAD_OBJ_INIT(); - gluQuadricDrawStyle(quadObj, GLU_FILL); - gluQuadricNormals(quadObj, GLU_SMOOTH); - /* If we ever changed/used the texture or orientation state - of quadObj, we'd need to change it to the defaults here - with gluQuadricTexture and/or gluQuadricOrientation. */ - gluSphere(quadObj, radius, slices, stacks); -} - -void APIENTRY -glutWireCone(GLdouble base, GLdouble height, - GLint slices, GLint stacks) -{ - QUAD_OBJ_INIT(); - gluQuadricDrawStyle(quadObj, GLU_LINE); - gluQuadricNormals(quadObj, GLU_SMOOTH); - /* If we ever changed/used the texture or orientation state - of quadObj, we'd need to change it to the defaults here - with gluQuadricTexture and/or gluQuadricOrientation. */ - gluCylinder(quadObj, base, 0.0, height, slices, stacks); -} - -void APIENTRY -glutSolidCone(GLdouble base, GLdouble height, - GLint slices, GLint stacks) -{ - QUAD_OBJ_INIT(); - gluQuadricDrawStyle(quadObj, GLU_FILL); - gluQuadricNormals(quadObj, GLU_SMOOTH); - /* If we ever changed/used the texture or orientation state - of quadObj, we'd need to change it to the defaults here - with gluQuadricTexture and/or gluQuadricOrientation. */ - gluCylinder(quadObj, base, 0.0, height, slices, stacks); -} - -/* ENDCENTRY */ - -static void -drawBox(GLfloat size, GLenum type) -{ - static GLfloat n[6][3] = - { - {-1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {1.0, 0.0, 0.0}, - {0.0, -1.0, 0.0}, - {0.0, 0.0, 1.0}, - {0.0, 0.0, -1.0} - }; - static GLint faces[6][4] = - { - {0, 1, 2, 3}, - {3, 2, 6, 7}, - {7, 6, 5, 4}, - {4, 5, 1, 0}, - {5, 6, 2, 1}, - {7, 4, 0, 3} - }; - GLfloat v[8][3]; - GLint i; - - v[0][0] = v[1][0] = v[2][0] = v[3][0] = -size / 2; - v[4][0] = v[5][0] = v[6][0] = v[7][0] = size / 2; - v[0][1] = v[1][1] = v[4][1] = v[5][1] = -size / 2; - v[2][1] = v[3][1] = v[6][1] = v[7][1] = size / 2; - v[0][2] = v[3][2] = v[4][2] = v[7][2] = -size / 2; - v[1][2] = v[2][2] = v[5][2] = v[6][2] = size / 2; - - for (i = 5; i >= 0; i--) { - glBegin(type); - glNormal3fv(&n[i][0]); - glVertex3fv(&v[faces[i][0]][0]); - glVertex3fv(&v[faces[i][1]][0]); - glVertex3fv(&v[faces[i][2]][0]); - glVertex3fv(&v[faces[i][3]][0]); - glEnd(); - } -} - -/* CENTRY */ -void APIENTRY -glutWireCube(GLdouble size) -{ - drawBox(size, GL_LINE_LOOP); -} - -void APIENTRY -glutSolidCube(GLdouble size) -{ - drawBox(size, GL_QUADS); -} - -/* ENDCENTRY */ - -static void -doughnut(GLfloat r, GLfloat R, GLint nsides, GLint rings) -{ - int i, j; - GLfloat theta, phi, theta1; - GLfloat cosTheta, sinTheta; - GLfloat cosTheta1, sinTheta1; - GLfloat ringDelta, sideDelta; - - ringDelta = 2.0 * M_PI / rings; - sideDelta = 2.0 * M_PI / nsides; - - theta = 0.0; - cosTheta = 1.0; - sinTheta = 0.0; - for (i = rings - 1; i >= 0; i--) { - theta1 = theta + ringDelta; - cosTheta1 = cos(theta1); - sinTheta1 = sin(theta1); - glBegin(GL_QUAD_STRIP); - phi = 0.0; - for (j = nsides; j >= 0; j--) { - GLfloat cosPhi, sinPhi, dist; - - phi += sideDelta; - cosPhi = cos(phi); - sinPhi = sin(phi); - dist = R + r * cosPhi; - - glNormal3f(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi); - glVertex3f(cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi); - glNormal3f(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi); - glVertex3f(cosTheta * dist, -sinTheta * dist, r * sinPhi); - } - glEnd(); - theta = theta1; - cosTheta = cosTheta1; - sinTheta = sinTheta1; - } -} - -/* CENTRY */ -void APIENTRY -glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, - GLint nsides, GLint rings) -{ - glPushAttrib(GL_POLYGON_BIT); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - doughnut(innerRadius, outerRadius, nsides, rings); - glPopAttrib(); -} - -void APIENTRY -glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, - GLint nsides, GLint rings) -{ - doughnut(innerRadius, outerRadius, nsides, rings); -} - -/* ENDCENTRY */ - -static GLfloat dodec[20][3]; - -static void -initDodecahedron(void) -{ - GLfloat alpha, beta; - - alpha = sqrt(2.0 / (3.0 + sqrt(5.0))); - beta = 1.0 + sqrt(6.0 / (3.0 + sqrt(5.0)) - - 2.0 + 2.0 * sqrt(2.0 / (3.0 + sqrt(5.0)))); - /* *INDENT-OFF* */ - dodec[0][0] = -alpha; dodec[0][1] = 0; dodec[0][2] = beta; - dodec[1][0] = alpha; dodec[1][1] = 0; dodec[1][2] = beta; - dodec[2][0] = -1; dodec[2][1] = -1; dodec[2][2] = -1; - dodec[3][0] = -1; dodec[3][1] = -1; dodec[3][2] = 1; - dodec[4][0] = -1; dodec[4][1] = 1; dodec[4][2] = -1; - dodec[5][0] = -1; dodec[5][1] = 1; dodec[5][2] = 1; - dodec[6][0] = 1; dodec[6][1] = -1; dodec[6][2] = -1; - dodec[7][0] = 1; dodec[7][1] = -1; dodec[7][2] = 1; - dodec[8][0] = 1; dodec[8][1] = 1; dodec[8][2] = -1; - dodec[9][0] = 1; dodec[9][1] = 1; dodec[9][2] = 1; - dodec[10][0] = beta; dodec[10][1] = alpha; dodec[10][2] = 0; - dodec[11][0] = beta; dodec[11][1] = -alpha; dodec[11][2] = 0; - dodec[12][0] = -beta; dodec[12][1] = alpha; dodec[12][2] = 0; - dodec[13][0] = -beta; dodec[13][1] = -alpha; dodec[13][2] = 0; - dodec[14][0] = -alpha; dodec[14][1] = 0; dodec[14][2] = -beta; - dodec[15][0] = alpha; dodec[15][1] = 0; dodec[15][2] = -beta; - dodec[16][0] = 0; dodec[16][1] = beta; dodec[16][2] = alpha; - dodec[17][0] = 0; dodec[17][1] = beta; dodec[17][2] = -alpha; - dodec[18][0] = 0; dodec[18][1] = -beta; dodec[18][2] = alpha; - dodec[19][0] = 0; dodec[19][1] = -beta; dodec[19][2] = -alpha; - /* *INDENT-ON* */ - -} - -#define DIFF3(_a,_b,_c) { \ - (_c)[0] = (_a)[0] - (_b)[0]; \ - (_c)[1] = (_a)[1] - (_b)[1]; \ - (_c)[2] = (_a)[2] - (_b)[2]; \ -} - -static void -crossprod(GLfloat v1[3], GLfloat v2[3], GLfloat prod[3]) -{ - GLfloat p[3]; /* in case prod == v1 or v2 */ - - p[0] = v1[1] * v2[2] - v2[1] * v1[2]; - p[1] = v1[2] * v2[0] - v2[2] * v1[0]; - p[2] = v1[0] * v2[1] - v2[0] * v1[1]; - prod[0] = p[0]; - prod[1] = p[1]; - prod[2] = p[2]; -} - -static void -normalize(GLfloat v[3]) -{ - GLfloat d; - - d = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); - if (d == 0.0) { -/* __glutWarning("normalize: zero length vector"); */ - v[0] = d = 1.0; - } - d = 1 / d; - v[0] *= d; - v[1] *= d; - v[2] *= d; -} - -static void -pentagon(int a, int b, int c, int d, int e, GLenum shadeType) -{ - GLfloat n0[3], d1[3], d2[3]; - - DIFF3(dodec[a], dodec[b], d1); - DIFF3(dodec[b], dodec[c], d2); - crossprod(d1, d2, n0); - normalize(n0); - - glBegin(shadeType); - glNormal3fv(n0); - glVertex3fv(&dodec[a][0]); - glVertex3fv(&dodec[b][0]); - glVertex3fv(&dodec[c][0]); - glVertex3fv(&dodec[d][0]); - glVertex3fv(&dodec[e][0]); - glEnd(); -} - -static void -dodecahedron(GLenum type) -{ - static int inited = 0; - - if (inited == 0) { - inited = 1; - initDodecahedron(); - } - pentagon(0, 1, 9, 16, 5, type); - pentagon(1, 0, 3, 18, 7, type); - pentagon(1, 7, 11, 10, 9, type); - pentagon(11, 7, 18, 19, 6, type); - pentagon(8, 17, 16, 9, 10, type); - pentagon(2, 14, 15, 6, 19, type); - pentagon(2, 13, 12, 4, 14, type); - pentagon(2, 19, 18, 3, 13, type); - pentagon(3, 0, 5, 12, 13, type); - pentagon(6, 15, 8, 10, 11, type); - pentagon(4, 17, 8, 15, 14, type); - pentagon(4, 12, 5, 16, 17, type); -} - -/* CENTRY */ -void APIENTRY -glutWireDodecahedron(void) -{ - dodecahedron(GL_LINE_LOOP); -} - -void APIENTRY -glutSolidDodecahedron(void) -{ - dodecahedron(GL_TRIANGLE_FAN); -} - -/* ENDCENTRY */ - -static void -recorditem(GLfloat * n1, GLfloat * n2, GLfloat * n3, - GLenum shadeType) -{ - GLfloat q0[3], q1[3]; - - DIFF3(n1, n2, q0); - DIFF3(n2, n3, q1); - crossprod(q0, q1, q1); - normalize(q1); - - glBegin(shadeType); - glNormal3fv(q1); - glVertex3fv(n1); - glVertex3fv(n2); - glVertex3fv(n3); - glEnd(); -} - -static void -subdivide(GLfloat * v0, GLfloat * v1, GLfloat * v2, - GLenum shadeType) -{ - int depth; - GLfloat w0[3], w1[3], w2[3]; - GLfloat l; - int i, j, k, n; - - depth = 1; - for (i = 0; i < depth; i++) { - for (j = 0; i + j < depth; j++) { - k = depth - i - j; - for (n = 0; n < 3; n++) { - w0[n] = (i * v0[n] + j * v1[n] + k * v2[n]) / depth; - w1[n] = ((i + 1) * v0[n] + j * v1[n] + (k - 1) * v2[n]) - / depth; - w2[n] = (i * v0[n] + (j + 1) * v1[n] + (k - 1) * v2[n]) - / depth; - } - l = sqrt(w0[0] * w0[0] + w0[1] * w0[1] + w0[2] * w0[2]); - w0[0] /= l; - w0[1] /= l; - w0[2] /= l; - l = sqrt(w1[0] * w1[0] + w1[1] * w1[1] + w1[2] * w1[2]); - w1[0] /= l; - w1[1] /= l; - w1[2] /= l; - l = sqrt(w2[0] * w2[0] + w2[1] * w2[1] + w2[2] * w2[2]); - w2[0] /= l; - w2[1] /= l; - w2[2] /= l; - recorditem(w1, w0, w2, shadeType); - } - } -} - -static void -drawtriangle(int i, GLfloat data[][3], int ndx[][3], - GLenum shadeType) -{ - GLfloat *x0, *x1, *x2; - - x0 = data[ndx[i][0]]; - x1 = data[ndx[i][1]]; - x2 = data[ndx[i][2]]; - subdivide(x0, x1, x2, shadeType); -} - -/* octahedron data: The octahedron produced is centered at the - origin and has radius 1.0 */ -static GLfloat odata[6][3] = -{ - {1.0, 0.0, 0.0}, - {-1.0, 0.0, 0.0}, - {0.0, 1.0, 0.0}, - {0.0, -1.0, 0.0}, - {0.0, 0.0, 1.0}, - {0.0, 0.0, -1.0} -}; - -static int ondex[8][3] = -{ - {0, 4, 2}, - {1, 2, 4}, - {0, 3, 4}, - {1, 4, 3}, - {0, 2, 5}, - {1, 5, 2}, - {0, 5, 3}, - {1, 3, 5} -}; - -static void -octahedron(GLenum shadeType) -{ - int i; - - for (i = 7; i >= 0; i--) { - drawtriangle(i, odata, ondex, shadeType); - } -} - -/* CENTRY */ -void APIENTRY -glutWireOctahedron(void) -{ - octahedron(GL_LINE_LOOP); -} - -void APIENTRY -glutSolidOctahedron(void) -{ - octahedron(GL_TRIANGLES); -} - -/* ENDCENTRY */ - -/* icosahedron data: These numbers are rigged to make an - icosahedron of radius 1.0 */ - -#define X .525731112119133606 -#define Z .850650808352039932 - -static GLfloat idata[12][3] = -{ - {-X, 0, Z}, - {X, 0, Z}, - {-X, 0, -Z}, - {X, 0, -Z}, - {0, Z, X}, - {0, Z, -X}, - {0, -Z, X}, - {0, -Z, -X}, - {Z, X, 0}, - {-Z, X, 0}, - {Z, -X, 0}, - {-Z, -X, 0} -}; - -static int index[20][3] = -{ - {0, 4, 1}, - {0, 9, 4}, - {9, 5, 4}, - {4, 5, 8}, - {4, 8, 1}, - {8, 10, 1}, - {8, 3, 10}, - {5, 3, 8}, - {5, 2, 3}, - {2, 7, 3}, - {7, 10, 3}, - {7, 6, 10}, - {7, 11, 6}, - {11, 0, 6}, - {0, 1, 6}, - {6, 1, 10}, - {9, 0, 11}, - {9, 11, 2}, - {9, 2, 5}, - {7, 2, 11}, -}; - -static void -icosahedron(GLenum shadeType) -{ - int i; - - for (i = 19; i >= 0; i--) { - drawtriangle(i, idata, index, shadeType); - } -} - -/* CENTRY */ -void APIENTRY -glutWireIcosahedron(void) -{ - icosahedron(GL_LINE_LOOP); -} - -void APIENTRY -glutSolidIcosahedron(void) -{ - icosahedron(GL_TRIANGLES); -} - -/* ENDCENTRY */ - -/* tetrahedron data: */ - -#define T 1.73205080756887729 - -static GLfloat tdata[4][3] = -{ - {T, T, T}, - {T, -T, -T}, - {-T, T, -T}, - {-T, -T, T} -}; - -static int tndex[4][3] = -{ - {0, 1, 3}, - {2, 1, 0}, - {3, 2, 0}, - {1, 2, 3} -}; - -static void -tetrahedron(GLenum shadeType) -{ - int i; - - for (i = 3; i >= 0; i--) - drawtriangle(i, tdata, tndex, shadeType); -} - -/* CENTRY */ -void APIENTRY -glutWireTetrahedron(void) -{ - tetrahedron(GL_LINE_LOOP); -} - -void APIENTRY -glutSolidTetrahedron(void) -{ - tetrahedron(GL_TRIANGLES); -} - -/* ENDCENTRY */ diff --git a/src/glut/mini/overlay.c b/src/glut/mini/overlay.c deleted file mode 100644 index fc8a8e5b0d..0000000000 --- a/src/glut/mini/overlay.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 3.4 - * Copyright (C) 1995-1998 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* - * DOS/DJGPP glut driver v1.0 for Mesa 4.0 - * - * Copyright (C) 2002 - Borca Daniel - * Email : dborca@yahoo.com - * Web : http://www.geocities.com/dborca - */ - - -#include "GL/glut.h" - - -void APIENTRY glutEstablishOverlay (void) -{ -} - - -void APIENTRY glutRemoveOverlay (void) -{ -} - - -void APIENTRY glutUseLayer (GLenum layer) -{ -} - - -void APIENTRY glutPostOverlayRedisplay (void) -{ -} - - -void APIENTRY glutShowOverlay (void) -{ -} - - -void APIENTRY glutHideOverlay (void) -{ -} diff --git a/src/glut/mini/state.c b/src/glut/mini/state.c deleted file mode 100644 index 81aefc53bd..0000000000 --- a/src/glut/mini/state.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 3.4 - * Copyright (C) 1995-1998 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* - * DOS/DJGPP glut driver v1.0 for Mesa 4.0 - * - * Copyright (C) 2002 - Borca Daniel - * Email : dborca@yahoo.com - * Web : http://www.geocities.com/dborca - */ - - -#include "GL/glut.h" -#include - - -#define TIMEDELTA(dest, src1, src2) { \ - if(((dest).tv_usec = (src1).tv_usec - (src2).tv_usec) < 0) { \ - (dest).tv_usec += 1000000; \ - (dest).tv_sec = (src1).tv_sec - (src2).tv_sec - 1; \ - } else { \ - (dest).tv_sec = (src1).tv_sec - (src2).tv_sec; \ - } \ -} - -int APIENTRY glutGet (GLenum type) -{ - - switch (type) { - case GLUT_WINDOW_RGBA: - return 1; - case GLUT_ELAPSED_TIME: { - static int inited = 0; - static struct timeval elapsed, beginning, now; - if (!inited) { - gettimeofday(&beginning, 0); - inited = 1; - } - gettimeofday(&now, 0); - TIMEDELTA(elapsed, now, beginning); - /* Return elapsed milliseconds. */ - return (int) ((elapsed.tv_sec * 1000) + (elapsed.tv_usec / 1000)); - } - default: - return 0; - } -} - - -int APIENTRY glutDeviceGet (GLenum type) -{ - return 0; -} diff --git a/src/glut/mini/teapot.c b/src/glut/mini/teapot.c deleted file mode 100644 index aa96fcbbbd..0000000000 --- a/src/glut/mini/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 -#include -#include "GL/glut.h" - -/* Rim, body, lid, and bottom data must be reflected in x and - y; handle and spout data across the y axis only. */ - -static int patchdata[][16] = -{ - /* rim */ - {102, 103, 104, 105, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15}, - /* body */ - {12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27}, - {24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40}, - /* lid */ - {96, 96, 96, 96, 97, 98, 99, 100, 101, 101, 101, - 101, 0, 1, 2, 3,}, - {0, 1, 2, 3, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, 117}, - /* bottom */ - {118, 118, 118, 118, 124, 122, 119, 121, 123, 126, - 125, 120, 40, 39, 38, 37}, - /* handle */ - {41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56}, - {53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 28, 65, 66, 67}, - /* spout */ - {68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 81, 82, 83}, - {80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95} -}; -/* *INDENT-OFF* */ - -static float cpdata[][3] = -{ - {0.2, 0, 2.7}, {0.2, -0.112, 2.7}, {0.112, -0.2, 2.7}, {0, - -0.2, 2.7}, {1.3375, 0, 2.53125}, {1.3375, -0.749, 2.53125}, - {0.749, -1.3375, 2.53125}, {0, -1.3375, 2.53125}, {1.4375, - 0, 2.53125}, {1.4375, -0.805, 2.53125}, {0.805, -1.4375, - 2.53125}, {0, -1.4375, 2.53125}, {1.5, 0, 2.4}, {1.5, -0.84, - 2.4}, {0.84, -1.5, 2.4}, {0, -1.5, 2.4}, {1.75, 0, 1.875}, - {1.75, -0.98, 1.875}, {0.98, -1.75, 1.875}, {0, -1.75, - 1.875}, {2, 0, 1.35}, {2, -1.12, 1.35}, {1.12, -2, 1.35}, - {0, -2, 1.35}, {2, 0, 0.9}, {2, -1.12, 0.9}, {1.12, -2, - 0.9}, {0, -2, 0.9}, {-2, 0, 0.9}, {2, 0, 0.45}, {2, -1.12, - 0.45}, {1.12, -2, 0.45}, {0, -2, 0.45}, {1.5, 0, 0.225}, - {1.5, -0.84, 0.225}, {0.84, -1.5, 0.225}, {0, -1.5, 0.225}, - {1.5, 0, 0.15}, {1.5, -0.84, 0.15}, {0.84, -1.5, 0.15}, {0, - -1.5, 0.15}, {-1.6, 0, 2.025}, {-1.6, -0.3, 2.025}, {-1.5, - -0.3, 2.25}, {-1.5, 0, 2.25}, {-2.3, 0, 2.025}, {-2.3, -0.3, - 2.025}, {-2.5, -0.3, 2.25}, {-2.5, 0, 2.25}, {-2.7, 0, - 2.025}, {-2.7, -0.3, 2.025}, {-3, -0.3, 2.25}, {-3, 0, - 2.25}, {-2.7, 0, 1.8}, {-2.7, -0.3, 1.8}, {-3, -0.3, 1.8}, - {-3, 0, 1.8}, {-2.7, 0, 1.575}, {-2.7, -0.3, 1.575}, {-3, - -0.3, 1.35}, {-3, 0, 1.35}, {-2.5, 0, 1.125}, {-2.5, -0.3, - 1.125}, {-2.65, -0.3, 0.9375}, {-2.65, 0, 0.9375}, {-2, - -0.3, 0.9}, {-1.9, -0.3, 0.6}, {-1.9, 0, 0.6}, {1.7, 0, - 1.425}, {1.7, -0.66, 1.425}, {1.7, -0.66, 0.6}, {1.7, 0, - 0.6}, {2.6, 0, 1.425}, {2.6, -0.66, 1.425}, {3.1, -0.66, - 0.825}, {3.1, 0, 0.825}, {2.3, 0, 2.1}, {2.3, -0.25, 2.1}, - {2.4, -0.25, 2.025}, {2.4, 0, 2.025}, {2.7, 0, 2.4}, {2.7, - -0.25, 2.4}, {3.3, -0.25, 2.4}, {3.3, 0, 2.4}, {2.8, 0, - 2.475}, {2.8, -0.25, 2.475}, {3.525, -0.25, 2.49375}, - {3.525, 0, 2.49375}, {2.9, 0, 2.475}, {2.9, -0.15, 2.475}, - {3.45, -0.15, 2.5125}, {3.45, 0, 2.5125}, {2.8, 0, 2.4}, - {2.8, -0.15, 2.4}, {3.2, -0.15, 2.4}, {3.2, 0, 2.4}, {0, 0, - 3.15}, {0.8, 0, 3.15}, {0.8, -0.45, 3.15}, {0.45, -0.8, - 3.15}, {0, -0.8, 3.15}, {0, 0, 2.85}, {1.4, 0, 2.4}, {1.4, - -0.784, 2.4}, {0.784, -1.4, 2.4}, {0, -1.4, 2.4}, {0.4, 0, - 2.55}, {0.4, -0.224, 2.55}, {0.224, -0.4, 2.55}, {0, -0.4, - 2.55}, {1.3, 0, 2.55}, {1.3, -0.728, 2.55}, {0.728, -1.3, - 2.55}, {0, -1.3, 2.55}, {1.3, 0, 2.4}, {1.3, -0.728, 2.4}, - {0.728, -1.3, 2.4}, {0, -1.3, 2.4}, {0, 0, 0}, {1.425, - -0.798, 0}, {1.5, 0, 0.075}, {1.425, 0, 0}, {0.798, -1.425, - 0}, {0, -1.5, 0.075}, {0, -1.425, 0}, {1.5, -0.84, 0.075}, - {0.84, -1.5, 0.075} -}; - -static float tex[2][2][2] = -{ - { {0, 0}, - {1, 0}}, - { {0, 1}, - {1, 1}} -}; - -/* *INDENT-ON* */ - -static void -teapot(GLint grid, GLdouble scale, GLenum type) -{ - float p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3]; - long i, j, k, l; - - glPushAttrib(GL_ENABLE_BIT | GL_EVAL_BIT); - glEnable(GL_AUTO_NORMAL); - glEnable(GL_NORMALIZE); - glEnable(GL_MAP2_VERTEX_3); - glEnable(GL_MAP2_TEXTURE_COORD_2); - glPushMatrix(); - glRotatef(270.0, 1.0, 0.0, 0.0); - glScalef(0.5 * scale, 0.5 * scale, 0.5 * scale); - glTranslatef(0.0, 0.0, -1.5); - for (i = 0; i < 10; i++) { - for (j = 0; j < 4; j++) { - for (k = 0; k < 4; k++) { - for (l = 0; l < 3; l++) { - p[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l]; - q[j][k][l] = cpdata[patchdata[i][j * 4 + (3 - k)]][l]; - if (l == 1) - q[j][k][l] *= -1.0; - if (i < 6) { - r[j][k][l] = - cpdata[patchdata[i][j * 4 + (3 - k)]][l]; - if (l == 0) - r[j][k][l] *= -1.0; - s[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l]; - if (l == 0) - s[j][k][l] *= -1.0; - if (l == 1) - s[j][k][l] *= -1.0; - } - } - } - } - glMap2f(GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2, - &tex[0][0][0]); - glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, - &p[0][0][0]); - glMapGrid2f(grid, 0.0, 1.0, grid, 0.0, 1.0); - glEvalMesh2(type, 0, grid, 0, grid); - glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, - &q[0][0][0]); - glEvalMesh2(type, 0, grid, 0, grid); - if (i < 6) { - glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, - &r[0][0][0]); - glEvalMesh2(type, 0, grid, 0, grid); - glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, - &s[0][0][0]); - glEvalMesh2(type, 0, grid, 0, grid); - } - } - glPopMatrix(); - glPopAttrib(); -} - -/* CENTRY */ -void APIENTRY -glutSolidTeapot(GLdouble scale) -{ - teapot(7, scale, GL_FILL); -} - -void APIENTRY -glutWireTeapot(GLdouble scale) -{ - teapot(10, scale, GL_LINE); -} - -/* ENDCENTRY */ diff --git a/src/glut/mini/window.c b/src/glut/mini/window.c deleted file mode 100644 index 5a59e64de6..0000000000 --- a/src/glut/mini/window.c +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 4.1 - * Copyright (C) 1995-1998 Brian Paul - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* - * DOS/DJGPP glut driver v1.2 for Mesa 4.1 - * - * Copyright (C) 2002 - Borca Daniel - * Email : dborca@yahoo.com - * Web : http://www.geocities.com/dborca - */ - - -#include -#include -#include "GL/glut.h" -#include "internal.h" - -#define USE_MINI_GLX 1 -#if USE_MINI_GLX -#include "GL/miniglx.h" -#else -#include -#endif - - - -static GLXContext context = 0; -static Window win; -static XVisualInfo *visinfo = 0; -static Display *dpy = 0; - - -int APIENTRY glutCreateWindow (const char *title) -{ - XSetWindowAttributes attr; - unsigned long mask; - GLXContext ctx; - int scrnum = 0; - Window root = RootWindow( dpy, scrnum ); - - if (win) - return 0; - - if (!dpy) { - dpy = XOpenDisplay(NULL); - if (!dpy) { - printf("Error: XOpenDisplay failed\n"); - exit(1); - } - } - - if (!visinfo) { - int attrib[] = {GLX_RGBA, - GLX_RED_SIZE, 1, - GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, - GLX_DEPTH_SIZE, 1, - GLX_DOUBLEBUFFER, - None }; - - - visinfo = glXChooseVisual( dpy, scrnum, attrib ); - if (!visinfo) { - printf("Error: couldn't get an RGB, Double-buffered visual\n"); - exit(1); - } - } - - /* window attributes */ - attr.background_pixel = 0; - attr.border_pixel = 0; - attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone); - attr.event_mask = StructureNotifyMask | ExposureMask; - mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; - - win = XCreateWindow( dpy, root, g_xpos, g_ypos, g_width, g_height, - 0, visinfo->depth, InputOutput, - visinfo->visual, mask, &attr ); - if (!win) { - printf("Error: XCreateWindow failed\n"); - exit(1); - } - - ctx = glXCreateContext( dpy, visinfo, NULL, True ); - if (!ctx) { - printf("Error: glXCreateContext failed\n"); - exit(1); - } - - if (!glXMakeCurrent( dpy, win, ctx )) { - printf("Error: glXMakeCurrent failed\n"); - exit(1); - } - - if (!(g_display_mode & GLUT_DOUBLE)) - glDrawBuffer( GL_FRONT ); - - - XMapWindow( dpy, win ); - -#if !USE_MINI_GLX - { - XEvent e; - while (1) { - XNextEvent( dpy, &e ); - if (e.type == MapNotify && e.xmap.window == win) { - break; - } - } - } -#endif - - return 1; -} - - -int APIENTRY glutCreateSubWindow (int win, int x, int y, int width, int height) -{ - return GL_FALSE; -} - - -void APIENTRY glutDestroyWindow (int idx) -{ - if (dpy && win) - XDestroyWindow( dpy, win ); - - if (dpy) - XCloseDisplay( dpy ); - - win = 0; - dpy = 0; -} - - -void APIENTRY glutPostRedisplay (void) -{ - g_redisplay = GL_TRUE; -} - - -void APIENTRY glutSwapBuffers (void) -{ -/* if (g_mouse) pc_scare_mouse(); */ - if (dpy && win) glXSwapBuffers( dpy, win ); -/* if (g_mouse) pc_unscare_mouse(); */ -} - - -int APIENTRY glutGetWindow (void) -{ - return 0; -} - - -void APIENTRY glutSetWindow (int win) -{ -} - - -void APIENTRY glutSetWindowTitle (const char *title) -{ -} - - -void APIENTRY glutSetIconTitle (const char *title) -{ -} - - -void APIENTRY glutPositionWindow (int x, int y) -{ -} - - -void APIENTRY glutReshapeWindow (int width, int height) -{ -} - - -void APIENTRY glutPopWindow (void) -{ -} - - -void APIENTRY glutPushWindow (void) -{ -} - - -void APIENTRY glutIconifyWindow (void) -{ -} - - -void APIENTRY glutShowWindow (void) -{ -} - - -void APIENTRY glutHideWindow (void) -{ -} - -void APIENTRY glutMainLoop (void) -{ - GLboolean idle; - GLboolean have_event; - XEvent evt; - int visible = 0; - - glutPostRedisplay(); - if (reshape_func) reshape_func(g_width, g_height); - - while (GL_TRUE) { - idle = GL_TRUE; - - - if (visible && idle_func) - have_event = XCheckMaskEvent( dpy, ~0, &evt ); - else - have_event = XNextEvent( dpy, &evt ); - - if (have_event) { - idle = GL_FALSE; - switch(evt.type) { - case MapNotify: - if (visibility_func) { - visibility_func(GLUT_VISIBLE); - } - visible = 1; - break; - case UnmapNotify: - if (visibility_func) { - visibility_func(GLUT_NOT_VISIBLE); - } - visible = 0; - break; - case Expose: - g_redisplay = 1; - break; - } - } - - if (visible && g_redisplay && display_func) { - idle = GL_FALSE; - g_redisplay = GL_FALSE; - - display_func(); - } - - if (visible && idle && idle_func) { - idle_func(); - } - } -} -- cgit v1.2.3