1994-08-01 11:34:53 +00:00
|
|
|
/***********************************************************
|
1995-01-04 19:10:35 +00:00
|
|
|
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
|
|
|
|
The Netherlands.
|
1994-08-01 11:34:53 +00:00
|
|
|
|
|
|
|
All Rights Reserved
|
|
|
|
|
1996-10-25 14:44:06 +00:00
|
|
|
Permission to use, copy, modify, and distribute this software and its
|
|
|
|
documentation for any purpose and without fee is hereby granted,
|
1994-08-01 11:34:53 +00:00
|
|
|
provided that the above copyright notice appear in all copies and that
|
1996-10-25 14:44:06 +00:00
|
|
|
both that copyright notice and this permission notice appear in
|
1994-08-01 11:34:53 +00:00
|
|
|
supporting documentation, and that the names of Stichting Mathematisch
|
1996-10-25 14:44:06 +00:00
|
|
|
Centrum or CWI or Corporation for National Research Initiatives or
|
|
|
|
CNRI not be used in advertising or publicity pertaining to
|
|
|
|
distribution of the software without specific, written prior
|
|
|
|
permission.
|
|
|
|
|
|
|
|
While CWI is the initial source for this software, a modified version
|
|
|
|
is made available by the Corporation for National Research Initiatives
|
|
|
|
(CNRI) at the Internet address ftp://ftp.python.org.
|
|
|
|
|
|
|
|
STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
|
|
|
|
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
|
|
|
|
CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
|
|
|
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
|
|
|
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
|
|
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
PERFORMANCE OF THIS SOFTWARE.
|
1994-08-01 11:34:53 +00:00
|
|
|
|
|
|
|
******************************************************************/
|
|
|
|
|
1990-10-14 12:07:46 +00:00
|
|
|
/*
|
|
|
|
Input used to generate the Python module "glmodule.c".
|
1991-08-16 08:59:21 +00:00
|
|
|
The stub generator is a Python script called "cgen.py".
|
1990-10-14 12:07:46 +00:00
|
|
|
|
|
|
|
Each definition must be contained on one line:
|
|
|
|
|
|
|
|
<returntype> <name> <type> <arg> <type> <arg>
|
|
|
|
|
|
|
|
<returntype> can be: void, short, long (XXX maybe others?)
|
|
|
|
|
|
|
|
<type> can be: char, string, short, float, long, or double
|
|
|
|
string indicates a null terminated string;
|
|
|
|
if <type> is char and <arg> begins with a *, the * is stripped
|
|
|
|
and <type> is changed into string
|
|
|
|
|
|
|
|
<arg> has the form <mode> or <mode>[<subscript>]
|
|
|
|
where <mode> can be
|
|
|
|
s: arg is sent
|
|
|
|
r: arg is received (arg is a pointer)
|
|
|
|
and <subscript> can be (N and I are numbers):
|
|
|
|
N
|
|
|
|
argI
|
|
|
|
retval
|
|
|
|
N*argI
|
1993-12-21 17:06:12 +00:00
|
|
|
N*I
|
1990-10-14 12:07:46 +00:00
|
|
|
N*retval
|
1993-12-21 17:06:12 +00:00
|
|
|
In the case where the subscript consists of two parts
|
|
|
|
separated by *, the first part is the width of the matrix, and
|
|
|
|
the second part is the length of the matrix. This order is
|
|
|
|
opposite from the order used in C to declare a two-dimensional
|
|
|
|
matrix.
|
1990-10-14 12:07:46 +00:00
|
|
|
*/
|
|
|
|
|
1992-08-13 14:13:11 +00:00
|
|
|
/*
|
|
|
|
* An attempt has been made to make this module switch threads on qread
|
|
|
|
* calls. It is far from safe, though.
|
|
|
|
*/
|
|
|
|
|
1990-10-14 12:07:46 +00:00
|
|
|
#include <gl.h>
|
|
|
|
#include <device.h>
|
1990-12-20 15:06:42 +00:00
|
|
|
|
1996-12-09 18:52:11 +00:00
|
|
|
#ifdef __sgi
|
|
|
|
extern int devport();
|
|
|
|
extern int textwritemask();
|
|
|
|
extern int pagewritemask();
|
|
|
|
extern int gewrite();
|
|
|
|
extern int gettp();
|
|
|
|
#endif
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
#include "Python.h"
|
1990-10-14 12:07:46 +00:00
|
|
|
#include "cgensupport.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
Some stubs are too complicated for the stub generator.
|
|
|
|
We can include manually written versions of them here.
|
|
|
|
A line starting with '%' gives the name of the function so the stub
|
|
|
|
generator can include it in the table of functions.
|
|
|
|
*/
|
|
|
|
|
1992-08-13 14:13:11 +00:00
|
|
|
% qread
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *
|
1992-08-13 14:13:11 +00:00
|
|
|
gl_qread(self, args)
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *self;
|
|
|
|
PyObject *args;
|
1992-08-13 14:13:11 +00:00
|
|
|
{
|
|
|
|
long retval;
|
|
|
|
short arg1 ;
|
1997-04-29 15:39:28 +00:00
|
|
|
Py_BEGIN_ALLOW_THREADS
|
1992-08-13 14:13:11 +00:00
|
|
|
retval = qread( & arg1 );
|
1997-04-29 15:39:28 +00:00
|
|
|
Py_END_ALLOW_THREADS
|
|
|
|
{ PyObject *v = PyTuple_New( 2 );
|
1992-08-13 14:13:11 +00:00
|
|
|
if (v == NULL) return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
PyTuple_SetItem(v, 0, mknewlongobject(retval));
|
|
|
|
PyTuple_SetItem(v, 1, mknewshortobject(arg1));
|
1992-08-13 14:13:11 +00:00
|
|
|
return v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1990-10-14 12:07:46 +00:00
|
|
|
/*
|
|
|
|
varray -- an array of v.. calls.
|
|
|
|
The argument is an array (maybe list or tuple) of points.
|
|
|
|
Each point must be a tuple or list of coordinates (x, y, z).
|
|
|
|
The points may be 2- or 3-dimensional but must all have the
|
|
|
|
same dimension. Float and int values may be mixed however.
|
|
|
|
The points are always converted to 3D double precision points
|
|
|
|
by assuming z=0.0 if necessary (as indicated in the man page),
|
|
|
|
and for each point v3d() is called.
|
|
|
|
*/
|
|
|
|
|
|
|
|
% varray
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *
|
1990-10-14 12:07:46 +00:00
|
|
|
gl_varray(self, args)
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *self;
|
|
|
|
PyObject *args;
|
1990-10-14 12:07:46 +00:00
|
|
|
{
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *v, *w=NULL;
|
1990-10-14 12:07:46 +00:00
|
|
|
int i, n, width;
|
|
|
|
double vec[3];
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject * (*getitem) Py_FPROTO((PyObject *, int));
|
1990-10-14 12:07:46 +00:00
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetObject(args, 1, 0, &v))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
if (PyList_Check(v)) {
|
|
|
|
n = PyList_Size(v);
|
|
|
|
getitem = PyList_GetItem;
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
else if (PyTuple_Check(v)) {
|
|
|
|
n = PyTuple_Size(v);
|
|
|
|
getitem = PyTuple_GetItem;
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
|
|
|
else {
|
1997-04-29 15:39:28 +00:00
|
|
|
PyErr_BadArgument();
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (n == 0) {
|
1997-04-29 15:39:28 +00:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
|
|
|
if (n > 0)
|
|
|
|
w = (*getitem)(v, 0);
|
|
|
|
|
|
|
|
width = 0;
|
|
|
|
if (w == NULL) {
|
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
else if (PyList_Check(w)) {
|
|
|
|
width = PyList_Size(w);
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
else if (PyTuple_Check(w)) {
|
|
|
|
width = PyTuple_Size(w);
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (width) {
|
|
|
|
case 2:
|
|
|
|
vec[2] = 0.0;
|
|
|
|
/* Fall through */
|
|
|
|
case 3:
|
|
|
|
break;
|
|
|
|
default:
|
1997-04-29 15:39:28 +00:00
|
|
|
PyErr_BadArgument();
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
w = (*getitem)(v, i);
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetDoubleArray(w, 1, 0, width, vec))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
v3d(vec);
|
|
|
|
}
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
vnarray, nvarray -- an array of n3f and v3f calls.
|
|
|
|
The argument is an array (list or tuple) of pairs of points and normals.
|
|
|
|
Each pair is a tuple (NOT a list) of a point and a normal for that point.
|
|
|
|
Each point or normal must be a tuple (NOT a list) of coordinates (x, y, z).
|
|
|
|
Three coordinates must be given. Float and int values may be mixed.
|
|
|
|
For each pair, n3f() is called for the normal, and then v3f() is called
|
|
|
|
for the vector.
|
|
|
|
|
|
|
|
vnarray and nvarray differ only in the order of the vector and normal in
|
|
|
|
the pair: vnarray expects (v, n) while nvarray expects (n, v).
|
|
|
|
*/
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *gen_nvarray(); /* Forward */
|
1990-10-14 12:07:46 +00:00
|
|
|
|
|
|
|
% nvarray
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *
|
1990-10-14 12:07:46 +00:00
|
|
|
gl_nvarray(self, args)
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *self;
|
|
|
|
PyObject *args;
|
1990-10-14 12:07:46 +00:00
|
|
|
{
|
|
|
|
return gen_nvarray(args, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
% vnarray
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *
|
1990-10-14 12:07:46 +00:00
|
|
|
gl_vnarray(self, args)
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *self;
|
|
|
|
PyObject *args;
|
1990-10-14 12:07:46 +00:00
|
|
|
{
|
|
|
|
return gen_nvarray(args, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Generic, internal version of {nv,nv}array: inorm indicates the
|
|
|
|
argument order, 0: normal first, 1: vector first. */
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *
|
1990-10-14 12:07:46 +00:00
|
|
|
gen_nvarray(args, inorm)
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *args;
|
1990-10-14 12:07:46 +00:00
|
|
|
int inorm;
|
|
|
|
{
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *v, *w, *wnorm, *wvec;
|
1990-10-14 12:07:46 +00:00
|
|
|
int i, n;
|
|
|
|
float norm[3], vec[3];
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject * (*getitem) Py_FPROTO((PyObject *, int));
|
1990-10-14 12:07:46 +00:00
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetObject(args, 1, 0, &v))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
if (PyList_Check(v)) {
|
|
|
|
n = PyList_Size(v);
|
|
|
|
getitem = PyList_GetItem;
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
else if (PyTuple_Check(v)) {
|
|
|
|
n = PyTuple_Size(v);
|
|
|
|
getitem = PyTuple_GetItem;
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
|
|
|
else {
|
1997-04-29 15:39:28 +00:00
|
|
|
PyErr_BadArgument();
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
w = (*getitem)(v, i);
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyTuple_Check(w) || PyTuple_Size(w) != 2) {
|
|
|
|
PyErr_BadArgument();
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
wnorm = PyTuple_GetItem(w, inorm);
|
|
|
|
wvec = PyTuple_GetItem(w, 1 - inorm);
|
|
|
|
if (!PyArg_GetFloatArray(wnorm, 1, 0, 3, norm) ||
|
|
|
|
!PyArg_GetFloatArray(wvec, 1, 0, 3, vec))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
n3f(norm);
|
|
|
|
v3f(vec);
|
|
|
|
}
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* nurbssurface(s_knots[], t_knots[], ctl[][], s_order, t_order, type).
|
|
|
|
The dimensions of ctl[] are computed as follows:
|
|
|
|
[len(s_knots) - s_order], [len(t_knots) - t_order]
|
|
|
|
*/
|
|
|
|
|
|
|
|
% nurbssurface
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *
|
1990-10-14 12:07:46 +00:00
|
|
|
gl_nurbssurface(self, args)
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *self;
|
|
|
|
PyObject *args;
|
1990-10-14 12:07:46 +00:00
|
|
|
{
|
|
|
|
long arg1 ;
|
|
|
|
double * arg2 ;
|
|
|
|
long arg3 ;
|
|
|
|
double * arg4 ;
|
|
|
|
double *arg5 ;
|
|
|
|
long arg6 ;
|
|
|
|
long arg7 ;
|
|
|
|
long arg8 ;
|
|
|
|
long ncoords;
|
|
|
|
long s_byte_stride, t_byte_stride;
|
|
|
|
long s_nctl, t_nctl;
|
|
|
|
long s, t;
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *v, *w, *pt;
|
1990-10-14 12:07:46 +00:00
|
|
|
double *pnext;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetLongArraySize(args, 6, 0, &arg1))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if ((arg2 = PyMem_NEW(double, arg1 )) == NULL) {
|
|
|
|
return PyErr_NoMemory();
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetDoubleArray(args, 6, 0, arg1 , arg2))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetLongArraySize(args, 6, 1, &arg3))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if ((arg4 = PyMem_NEW(double, arg3 )) == NULL) {
|
|
|
|
return PyErr_NoMemory();
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetDoubleArray(args, 6, 1, arg3 , arg4))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetLong(args, 6, 3, &arg6))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetLong(args, 6, 4, &arg7))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetLong(args, 6, 5, &arg8))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
if (arg8 == N_XYZ)
|
|
|
|
ncoords = 3;
|
|
|
|
else if (arg8 == N_XYZW)
|
|
|
|
ncoords = 4;
|
|
|
|
else {
|
1997-04-29 15:39:28 +00:00
|
|
|
PyErr_BadArgument();
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
s_nctl = arg1 - arg6;
|
|
|
|
t_nctl = arg3 - arg7;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetObject(args, 6, 2, &v))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyList_Check(v) || PyList_Size(v) != s_nctl) {
|
|
|
|
PyErr_BadArgument();
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
if ((arg5 = PyMem_NEW(double, s_nctl*t_nctl*ncoords )) == NULL) {
|
|
|
|
return PyErr_NoMemory();
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
|
|
|
pnext = arg5;
|
|
|
|
for (s = 0; s < s_nctl; s++) {
|
1997-04-29 15:39:28 +00:00
|
|
|
w = PyList_GetItem(v, s);
|
|
|
|
if (w == NULL || !PyList_Check(w) ||
|
|
|
|
PyList_Size(w) != t_nctl) {
|
|
|
|
PyErr_BadArgument();
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
for (t = 0; t < t_nctl; t++) {
|
1997-04-29 15:39:28 +00:00
|
|
|
pt = PyList_GetItem(w, t);
|
|
|
|
if (!PyArg_GetDoubleArray(pt, 1, 0, ncoords, pnext))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
pnext += ncoords;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
s_byte_stride = sizeof(double) * ncoords;
|
|
|
|
t_byte_stride = s_byte_stride * s_nctl;
|
|
|
|
nurbssurface( arg1 , arg2 , arg3 , arg4 ,
|
|
|
|
s_byte_stride , t_byte_stride , arg5 , arg6 , arg7 , arg8 );
|
1997-04-29 15:39:28 +00:00
|
|
|
PyMem_DEL(arg2);
|
|
|
|
PyMem_DEL(arg4);
|
|
|
|
PyMem_DEL(arg5);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* nurbscurve(knots, ctlpoints, order, type).
|
|
|
|
The length of ctlpoints is len(knots)-order. */
|
|
|
|
|
|
|
|
%nurbscurve
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *
|
1990-10-14 12:07:46 +00:00
|
|
|
gl_nurbscurve(self, args)
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *self;
|
|
|
|
PyObject *args;
|
1990-10-14 12:07:46 +00:00
|
|
|
{
|
|
|
|
long arg1 ;
|
|
|
|
double * arg2 ;
|
|
|
|
long arg3 ;
|
|
|
|
double * arg4 ;
|
|
|
|
long arg5 ;
|
|
|
|
long arg6 ;
|
|
|
|
int ncoords, npoints;
|
|
|
|
int i;
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *v;
|
1990-10-14 12:07:46 +00:00
|
|
|
double *pnext;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetLongArraySize(args, 4, 0, &arg1))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if ((arg2 = PyMem_NEW(double, arg1 )) == NULL) {
|
|
|
|
return PyErr_NoMemory();
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetDoubleArray(args, 4, 0, arg1 , arg2))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetLong(args, 4, 2, &arg5))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetLong(args, 4, 3, &arg6))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
if (arg6 == N_ST)
|
|
|
|
ncoords = 2;
|
|
|
|
else if (arg6 == N_STW)
|
|
|
|
ncoords = 3;
|
|
|
|
else {
|
1997-04-29 15:39:28 +00:00
|
|
|
PyErr_BadArgument();
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
npoints = arg1 - arg5;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetObject(args, 4, 1, &v))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyList_Check(v) || PyList_Size(v) != npoints) {
|
|
|
|
PyErr_BadArgument();
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
if ((arg4 = PyMem_NEW(double, npoints*ncoords )) == NULL) {
|
|
|
|
return PyErr_NoMemory();
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
|
|
|
pnext = arg4;
|
|
|
|
for (i = 0; i < npoints; i++) {
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetDoubleArray(PyList_GetItem(v, i), 1, 0, ncoords, pnext))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
pnext += ncoords;
|
|
|
|
}
|
|
|
|
arg3 = (sizeof(double)) * ncoords;
|
|
|
|
nurbscurve( arg1 , arg2 , arg3 , arg4 , arg5 , arg6 );
|
1997-04-29 15:39:28 +00:00
|
|
|
PyMem_DEL(arg2);
|
|
|
|
PyMem_DEL(arg4);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* pwlcurve(points, type).
|
|
|
|
Points is a list of points. Type must be N_ST. */
|
|
|
|
|
|
|
|
%pwlcurve
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *
|
1990-10-14 12:07:46 +00:00
|
|
|
gl_pwlcurve(self, args)
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *self;
|
|
|
|
PyObject *args;
|
1990-10-14 12:07:46 +00:00
|
|
|
{
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *v;
|
1990-10-14 12:07:46 +00:00
|
|
|
long type;
|
|
|
|
double *data, *pnext;
|
|
|
|
long npoints, ncoords;
|
|
|
|
int i;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetObject(args, 2, 0, &v))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetLong(args, 2, 1, &type))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyList_Check(v)) {
|
|
|
|
PyErr_BadArgument();
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
npoints = PyList_Size(v);
|
1990-10-14 12:07:46 +00:00
|
|
|
if (type == N_ST)
|
|
|
|
ncoords = 2;
|
|
|
|
else {
|
1997-04-29 15:39:28 +00:00
|
|
|
PyErr_BadArgument();
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
if ((data = PyMem_NEW(double, npoints*ncoords)) == NULL) {
|
|
|
|
return PyErr_NoMemory();
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
|
|
|
pnext = data;
|
|
|
|
for (i = 0; i < npoints; i++) {
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetDoubleArray(PyList_GetItem(v, i), 1, 0, ncoords, pnext))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
pnext += ncoords;
|
|
|
|
}
|
|
|
|
pwlcurve(npoints, data, sizeof(double)*ncoords, type);
|
1997-04-29 15:39:28 +00:00
|
|
|
PyMem_DEL(data);
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Picking and Selecting */
|
|
|
|
|
|
|
|
static short *pickbuffer = NULL;
|
|
|
|
static long pickbuffersize;
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *
|
1990-10-14 12:07:46 +00:00
|
|
|
pick_select(args, func)
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *args;
|
1990-10-14 12:07:46 +00:00
|
|
|
void (*func)();
|
|
|
|
{
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetLong(args, 1, 0, &pickbuffersize))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
if (pickbuffer != NULL) {
|
1997-04-29 15:39:28 +00:00
|
|
|
PyErr_SetString(PyExc_RuntimeError,
|
1990-10-14 12:07:46 +00:00
|
|
|
"pick/gselect: already picking/selecting");
|
|
|
|
return NULL;
|
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
if ((pickbuffer = PyMem_NEW(short, pickbuffersize)) == NULL) {
|
|
|
|
return PyErr_NoMemory();
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
|
|
|
(*func)(pickbuffer, pickbuffersize);
|
1997-04-29 15:39:28 +00:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *
|
1990-10-14 12:07:46 +00:00
|
|
|
endpick_select(args, func)
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *args;
|
1990-10-14 12:07:46 +00:00
|
|
|
long (*func)();
|
|
|
|
{
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *v, *w;
|
1990-10-14 12:07:46 +00:00
|
|
|
int i, nhits, n;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_NoArgs(args))
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
if (pickbuffer == NULL) {
|
1997-04-29 15:39:28 +00:00
|
|
|
PyErr_SetString(PyExc_RuntimeError,
|
1990-10-14 12:07:46 +00:00
|
|
|
"endpick/endselect: not in pick/select mode");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
nhits = (*func)(pickbuffer);
|
|
|
|
if (nhits < 0) {
|
|
|
|
nhits = -nhits; /* How to report buffer overflow otherwise? */
|
|
|
|
}
|
|
|
|
/* Scan the buffer to see how many integers */
|
|
|
|
n = 0;
|
|
|
|
for (; nhits > 0; nhits--) {
|
|
|
|
n += 1 + pickbuffer[n];
|
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
v = PyList_New(n);
|
1990-10-14 12:07:46 +00:00
|
|
|
if (v == NULL)
|
|
|
|
return NULL;
|
|
|
|
/* XXX Could do it nicer and interpret the data structure here,
|
|
|
|
returning a list of lists. But this can be done in Python... */
|
|
|
|
for (i = 0; i < n; i++) {
|
1997-04-29 15:39:28 +00:00
|
|
|
w = PyInt_FromLong((long)pickbuffer[i]);
|
1990-10-14 12:07:46 +00:00
|
|
|
if (w == NULL) {
|
1997-04-29 15:39:28 +00:00
|
|
|
Py_DECREF(v);
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
PyList_SetItem(v, i, w);
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
PyMem_DEL(pickbuffer);
|
1990-10-14 12:07:46 +00:00
|
|
|
pickbuffer = NULL;
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern void pick(), gselect();
|
|
|
|
extern long endpick(), endselect();
|
|
|
|
|
|
|
|
%pick
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *gl_pick(self, args) PyObject *self, *args; {
|
1990-10-14 12:07:46 +00:00
|
|
|
return pick_select(args, pick);
|
|
|
|
}
|
|
|
|
|
|
|
|
%endpick
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *gl_endpick(self, args) PyObject *self, *args; {
|
1990-10-14 12:07:46 +00:00
|
|
|
return endpick_select(args, endpick);
|
|
|
|
}
|
|
|
|
|
|
|
|
%gselect
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *gl_gselect(self, args) PyObject *self, *args; {
|
1990-10-14 12:07:46 +00:00
|
|
|
return pick_select(args, gselect);
|
|
|
|
}
|
|
|
|
|
|
|
|
%endselect
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *gl_endselect(self, args) PyObject *self, *args; {
|
1990-10-14 12:07:46 +00:00
|
|
|
return endpick_select(args, endselect);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1991-08-16 08:59:21 +00:00
|
|
|
/* XXX The generator botches this one. Here's a quick hack to fix it. */
|
|
|
|
|
1990-10-14 12:07:46 +00:00
|
|
|
/* XXX The generator botches this one. Here's a quick hack to fix it. */
|
|
|
|
|
|
|
|
% getmatrix float r[16]
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *
|
1990-10-14 12:07:46 +00:00
|
|
|
gl_getmatrix(self, args)
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *self;
|
|
|
|
PyObject *args;
|
1990-10-14 12:07:46 +00:00
|
|
|
{
|
1993-10-22 12:04:32 +00:00
|
|
|
Matrix arg1;
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *v, *w;
|
1993-10-22 12:04:32 +00:00
|
|
|
int i, j;
|
1990-10-14 12:07:46 +00:00
|
|
|
getmatrix( arg1 );
|
1997-04-29 15:39:28 +00:00
|
|
|
v = PyList_New(16);
|
1990-10-14 12:07:46 +00:00
|
|
|
if (v == NULL) {
|
1997-04-29 15:39:28 +00:00
|
|
|
return PyErr_NoMemory();
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
1993-10-22 12:04:32 +00:00
|
|
|
for (i = 0; i < 4; i++) for (j = 0; j < 4; j++) {
|
|
|
|
w = mknewfloatobject(arg1[i][j]);
|
1990-10-14 12:07:46 +00:00
|
|
|
if (w == NULL) {
|
1997-04-29 15:39:28 +00:00
|
|
|
Py_DECREF(v);
|
1990-10-14 12:07:46 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
PyList_SetItem(v, i*4+j, w);
|
1990-10-14 12:07:46 +00:00
|
|
|
}
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
1991-08-16 08:59:21 +00:00
|
|
|
/* Here's an alternate version that returns a 4x4 matrix instead of
|
|
|
|
a vector. Unfortunately it is incompatible with loadmatrix and
|
|
|
|
multmatrix... */
|
|
|
|
|
|
|
|
% altgetmatrix float r[4][4]
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *
|
1991-08-16 08:59:21 +00:00
|
|
|
gl_altgetmatrix(self, args)
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *self;
|
|
|
|
PyObject *args;
|
1991-08-16 08:59:21 +00:00
|
|
|
{
|
1993-10-22 12:04:32 +00:00
|
|
|
Matrix arg1;
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *v, *w;
|
1991-08-16 08:59:21 +00:00
|
|
|
int i, j;
|
|
|
|
getmatrix( arg1 );
|
1997-04-29 15:39:28 +00:00
|
|
|
v = PyList_New(4);
|
1991-08-16 08:59:21 +00:00
|
|
|
if (v == NULL) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
for (i = 0; i < 4; i++) {
|
1997-04-29 15:39:28 +00:00
|
|
|
w = PyList_New(4);
|
1991-08-16 08:59:21 +00:00
|
|
|
if (w == NULL) {
|
1997-04-29 15:39:28 +00:00
|
|
|
Py_DECREF(v);
|
1991-08-16 08:59:21 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
PyList_SetItem(v, i, w);
|
1991-08-16 08:59:21 +00:00
|
|
|
}
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
for (j = 0; j < 4; j++) {
|
|
|
|
w = mknewfloatobject(arg1[i][j]);
|
|
|
|
if (w == NULL) {
|
1997-04-29 15:39:28 +00:00
|
|
|
Py_DECREF(v);
|
1991-08-16 08:59:21 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
PyList_SetItem(PyList_GetItem(v, i), j, w);
|
1991-08-16 08:59:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
1991-10-20 20:13:40 +00:00
|
|
|
% lrectwrite
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *
|
1991-10-20 20:13:40 +00:00
|
|
|
gl_lrectwrite(self, args)
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *self;
|
|
|
|
PyObject *args;
|
1991-10-20 20:13:40 +00:00
|
|
|
{
|
|
|
|
short x1 ;
|
|
|
|
short y1 ;
|
|
|
|
short x2 ;
|
|
|
|
short y2 ;
|
|
|
|
string parray ;
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *s;
|
1996-12-09 18:52:11 +00:00
|
|
|
#if 0
|
1991-10-20 20:13:40 +00:00
|
|
|
int pixcount;
|
1996-12-09 18:52:11 +00:00
|
|
|
#endif
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetShort(args, 5, 0, &x1))
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetShort(args, 5, 1, &y1))
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetShort(args, 5, 2, &x2))
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetShort(args, 5, 3, &y2))
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetString(args, 5, 4, &parray))
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetObject(args, 5, 4, &s))
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
1991-11-12 15:41:00 +00:00
|
|
|
#if 0
|
|
|
|
/* Don't check this, it breaks experiments with pixmode(PM_SIZE, ...) */
|
1991-10-20 20:13:40 +00:00
|
|
|
pixcount = (long)(x2+1-x1) * (long)(y2+1-y1);
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyString_Check(s) || PyString_Size(s) != pixcount*sizeof(long)) {
|
|
|
|
PyErr_SetString(PyExc_RuntimeError,
|
1991-11-12 15:41:00 +00:00
|
|
|
"string arg to lrectwrite has wrong size");
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
1991-11-12 15:41:00 +00:00
|
|
|
#endif
|
1991-10-20 20:13:40 +00:00
|
|
|
lrectwrite( x1 , y1 , x2 , y2 , (unsigned long *) parray );
|
1997-04-29 15:39:28 +00:00
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
1991-10-20 20:13:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
% lrectread
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *
|
1991-10-20 20:13:40 +00:00
|
|
|
gl_lrectread(self, args)
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *self;
|
|
|
|
PyObject *args;
|
1991-10-20 20:13:40 +00:00
|
|
|
{
|
|
|
|
short x1 ;
|
|
|
|
short y1 ;
|
|
|
|
short x2 ;
|
|
|
|
short y2 ;
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *parray;
|
1991-10-20 20:13:40 +00:00
|
|
|
int pixcount;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetShort(args, 4, 0, &x1))
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetShort(args, 4, 1, &y1))
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetShort(args, 4, 2, &x2))
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetShort(args, 4, 3, &y2))
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
|
|
|
pixcount = (long)(x2+1-x1) * (long)(y2+1-y1);
|
1997-04-29 15:39:28 +00:00
|
|
|
parray = PyString_FromStringAndSize((char *)NULL, pixcount*sizeof(long));
|
1991-10-20 20:13:40 +00:00
|
|
|
if (parray == NULL)
|
|
|
|
return NULL; /* No memory */
|
1997-04-29 15:39:28 +00:00
|
|
|
lrectread(x1, y1, x2, y2, (unsigned long *) PyString_AsString(parray));
|
1991-10-20 20:13:40 +00:00
|
|
|
return parray;
|
|
|
|
}
|
|
|
|
|
1993-02-16 09:25:15 +00:00
|
|
|
% readdisplay
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *
|
1993-02-16 09:25:15 +00:00
|
|
|
gl_readdisplay(self, args)
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *self;
|
|
|
|
PyObject *args;
|
1993-02-16 09:25:15 +00:00
|
|
|
{
|
|
|
|
short x1, y1, x2, y2;
|
|
|
|
unsigned long *parray, hints;
|
|
|
|
long size, size_ret;
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *rv;
|
1993-02-16 09:25:15 +00:00
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
if ( !PyArg_Parse(args, "hhhhl", &x1, &y1, &x2, &y2, &hints) )
|
1993-02-16 09:25:15 +00:00
|
|
|
return 0;
|
|
|
|
size = (long)(x2+1-x1) * (long)(y2+1-y1);
|
1997-04-29 15:39:28 +00:00
|
|
|
rv = PyString_FromStringAndSize((char *)NULL, size*sizeof(long));
|
1993-02-16 09:25:15 +00:00
|
|
|
if ( rv == NULL )
|
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
parray = (unsigned long *)PyString_AsString(rv);
|
1993-02-16 09:25:15 +00:00
|
|
|
size_ret = readdisplay(x1, y1, x2, y2, parray, hints);
|
|
|
|
if ( size_ret != size ) {
|
1996-12-09 18:52:11 +00:00
|
|
|
printf("gl_readdisplay: got %ld pixels, expected %ld\n",
|
1993-02-16 09:25:15 +00:00
|
|
|
size_ret, size);
|
1997-04-29 15:39:28 +00:00
|
|
|
PyErr_SetString(PyExc_RuntimeError, "readdisplay returned unexpected length");
|
1993-02-16 09:25:15 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
1991-10-20 20:13:40 +00:00
|
|
|
/* Desperately needed, here are tools to compress and decompress
|
|
|
|
the data manipulated by lrectread/lrectwrite.
|
|
|
|
|
|
|
|
gl.packrect(width, height, packfactor, bigdata) --> smalldata
|
|
|
|
makes 'bigdata' 4*(packfactor**2) times smaller by:
|
|
|
|
- turning it into B/W (a factor 4)
|
|
|
|
- replacing squares of size pacfactor by one
|
|
|
|
representative
|
|
|
|
|
|
|
|
gl.unpackrect(width, height, packfactor, smalldata) --> bigdata
|
|
|
|
is the inverse; the numeric arguments must be *the same*.
|
|
|
|
|
|
|
|
Both work best if width and height are multiples of packfactor
|
|
|
|
(in fact unpackrect will leave garbage bytes).
|
|
|
|
*/
|
|
|
|
|
|
|
|
% packrect
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *
|
1991-10-20 20:13:40 +00:00
|
|
|
gl_packrect(self, args)
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *self;
|
|
|
|
PyObject *args;
|
1991-10-20 20:13:40 +00:00
|
|
|
{
|
|
|
|
long width, height, packfactor;
|
|
|
|
char *s;
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *unpacked, *packed;
|
1991-10-20 20:13:40 +00:00
|
|
|
int pixcount, packedcount, x, y, r, g, b;
|
|
|
|
unsigned long pixel;
|
|
|
|
unsigned char *p;
|
|
|
|
unsigned long *parray;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetLong(args, 4, 0, &width))
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetLong(args, 4, 1, &height))
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetLong(args, 4, 2, &packfactor))
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetString(args, 4, 3, &s)) /* For type checking only */
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetObject(args, 4, 3, &unpacked))
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
|
|
|
if (width <= 0 || height <= 0 || packfactor <= 0) {
|
1997-04-29 15:39:28 +00:00
|
|
|
PyErr_SetString(PyExc_RuntimeError, "packrect args must be > 0");
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
pixcount = width*height;
|
|
|
|
packedcount = ((width+packfactor-1)/packfactor) *
|
|
|
|
((height+packfactor-1)/packfactor);
|
1997-04-29 15:39:28 +00:00
|
|
|
if (PyString_Size(unpacked) != pixcount*sizeof(long)) {
|
|
|
|
PyErr_SetString(PyExc_RuntimeError,
|
1991-11-12 15:41:00 +00:00
|
|
|
"string arg to packrect has wrong size");
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
packed = PyString_FromStringAndSize((char *)NULL, packedcount);
|
1991-10-20 20:13:40 +00:00
|
|
|
if (packed == NULL)
|
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
parray = (unsigned long *) PyString_AsString(unpacked);
|
|
|
|
p = (unsigned char *) PyString_AsString(packed);
|
1991-10-20 20:13:40 +00:00
|
|
|
for (y = 0; y < height; y += packfactor, parray += packfactor*width) {
|
|
|
|
for (x = 0; x < width; x += packfactor) {
|
|
|
|
pixel = parray[x];
|
|
|
|
r = pixel & 0xff;
|
|
|
|
g = (pixel >> 8) & 0xff;
|
|
|
|
b = (pixel >> 16) & 0xff;
|
1991-11-12 15:41:00 +00:00
|
|
|
*p++ = (30*r+59*g+11*b) / 100;
|
1991-10-20 20:13:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return packed;
|
|
|
|
}
|
|
|
|
|
|
|
|
% unpackrect
|
|
|
|
|
|
|
|
static unsigned long unpacktab[256];
|
|
|
|
static int unpacktab_inited = 0;
|
|
|
|
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *
|
1991-10-20 20:13:40 +00:00
|
|
|
gl_unpackrect(self, args)
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *self;
|
|
|
|
PyObject *args;
|
1991-10-20 20:13:40 +00:00
|
|
|
{
|
|
|
|
long width, height, packfactor;
|
|
|
|
char *s;
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *unpacked, *packed;
|
1996-12-09 18:52:11 +00:00
|
|
|
int pixcount, packedcount;
|
1991-10-20 20:13:40 +00:00
|
|
|
register unsigned char *p;
|
|
|
|
register unsigned long *parray;
|
|
|
|
if (!unpacktab_inited) {
|
|
|
|
register int white;
|
|
|
|
for (white = 256; --white >= 0; )
|
|
|
|
unpacktab[white] = white * 0x010101L;
|
|
|
|
unpacktab_inited++;
|
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetLong(args, 4, 0, &width))
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetLong(args, 4, 1, &height))
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetLong(args, 4, 2, &packfactor))
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetString(args, 4, 3, &s)) /* For type checking only */
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
if (!PyArg_GetObject(args, 4, 3, &packed))
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
|
|
|
if (width <= 0 || height <= 0 || packfactor <= 0) {
|
1997-04-29 15:39:28 +00:00
|
|
|
PyErr_SetString(PyExc_RuntimeError, "packrect args must be > 0");
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
pixcount = width*height;
|
|
|
|
packedcount = ((width+packfactor-1)/packfactor) *
|
|
|
|
((height+packfactor-1)/packfactor);
|
1997-04-29 15:39:28 +00:00
|
|
|
if (PyString_Size(packed) != packedcount) {
|
|
|
|
PyErr_SetString(PyExc_RuntimeError,
|
1991-11-12 15:41:00 +00:00
|
|
|
"string arg to unpackrect has wrong size");
|
1991-10-20 20:13:40 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
1997-04-29 15:39:28 +00:00
|
|
|
unpacked = PyString_FromStringAndSize((char *)NULL, pixcount*sizeof(long));
|
1991-10-20 20:13:40 +00:00
|
|
|
if (unpacked == NULL)
|
|
|
|
return NULL;
|
1997-04-29 15:39:28 +00:00
|
|
|
parray = (unsigned long *) PyString_AsString(unpacked);
|
|
|
|
p = (unsigned char *) PyString_AsString(packed);
|
1991-10-20 20:13:40 +00:00
|
|
|
if (packfactor == 1 && width*height > 0) {
|
|
|
|
/* Just expand bytes to longs */
|
|
|
|
register int x = width * height;
|
|
|
|
do {
|
|
|
|
*parray++ = unpacktab[*p++];
|
|
|
|
} while (--x >= 0);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
register int y;
|
|
|
|
for (y = 0; y < height-packfactor+1;
|
|
|
|
y += packfactor, parray += packfactor*width) {
|
|
|
|
register int x;
|
|
|
|
for (x = 0; x < width-packfactor+1; x += packfactor) {
|
|
|
|
register unsigned long pixel = unpacktab[*p++];
|
|
|
|
register int i;
|
|
|
|
for (i = packfactor*width; (i-=width) >= 0;) {
|
|
|
|
register int j;
|
|
|
|
for (j = packfactor; --j >= 0; )
|
|
|
|
parray[i+x+j] = pixel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return unpacked;
|
|
|
|
}
|
|
|
|
|
1992-09-08 09:05:33 +00:00
|
|
|
% gversion
|
1997-04-29 15:39:28 +00:00
|
|
|
static PyObject *
|
1992-09-08 09:05:33 +00:00
|
|
|
gl_gversion(self, args)
|
1997-04-29 15:39:28 +00:00
|
|
|
PyObject *self;
|
|
|
|
PyObject *args;
|
1992-09-08 09:05:33 +00:00
|
|
|
{
|
|
|
|
char buf[20];
|
|
|
|
gversion(buf);
|
1997-04-29 15:39:28 +00:00
|
|
|
return PyString_FromString(buf);
|
1992-09-08 09:05:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1990-10-14 12:07:46 +00:00
|
|
|
/* End of manually written stubs */
|
|
|
|
|
|
|
|
%%
|
|
|
|
|
|
|
|
long getshade
|
1993-12-21 17:06:12 +00:00
|
|
|
if !solaris void devport short s long s
|
1990-10-14 12:07:46 +00:00
|
|
|
void rdr2i long s long s
|
|
|
|
void rectfs short s short s short s short s
|
|
|
|
void rects short s short s short s short s
|
|
|
|
void rmv2i long s long s
|
|
|
|
void noport
|
|
|
|
void popviewport
|
|
|
|
void clear
|
|
|
|
void clearhitcode
|
|
|
|
void closeobj
|
|
|
|
void cursoff
|
|
|
|
void curson
|
|
|
|
void doublebuffer
|
|
|
|
void finish
|
|
|
|
void gconfig
|
|
|
|
void ginit
|
|
|
|
void greset
|
|
|
|
void multimap
|
|
|
|
void onemap
|
|
|
|
void popattributes
|
|
|
|
void popmatrix
|
|
|
|
void pushattributes
|
|
|
|
void pushmatrix
|
|
|
|
void pushviewport
|
|
|
|
void qreset
|
|
|
|
void RGBmode
|
|
|
|
void singlebuffer
|
|
|
|
void swapbuffers
|
|
|
|
void gsync
|
1992-02-26 15:19:45 +00:00
|
|
|
void gflush
|
1990-10-14 12:07:46 +00:00
|
|
|
void tpon
|
|
|
|
void tpoff
|
|
|
|
void clkon
|
|
|
|
void clkoff
|
|
|
|
void ringbell
|
|
|
|
#void callfunc
|
|
|
|
void gbegin
|
|
|
|
void textinit
|
|
|
|
void initnames
|
|
|
|
void pclos
|
|
|
|
void popname
|
1993-12-21 17:06:12 +00:00
|
|
|
if !solaris void spclos
|
1990-10-14 12:07:46 +00:00
|
|
|
void zclear
|
|
|
|
void screenspace
|
|
|
|
void reshapeviewport
|
|
|
|
void winpush
|
|
|
|
void winpop
|
|
|
|
void foreground
|
|
|
|
void endfullscrn
|
1993-12-21 17:06:12 +00:00
|
|
|
if !solaris void endpupmode
|
1990-10-14 12:07:46 +00:00
|
|
|
void fullscrn
|
1993-12-21 17:06:12 +00:00
|
|
|
if !solaris void pupmode
|
1990-10-14 12:07:46 +00:00
|
|
|
void winconstraints
|
|
|
|
void pagecolor short s
|
|
|
|
void textcolor short s
|
|
|
|
void color short s
|
|
|
|
void curveit short s
|
|
|
|
void font short s
|
|
|
|
void linewidth short s
|
|
|
|
void setlinestyle short s
|
|
|
|
void setmap short s
|
|
|
|
void swapinterval short s
|
|
|
|
void writemask short s
|
1993-12-21 17:06:12 +00:00
|
|
|
if !solaris void textwritemask short s
|
1990-10-14 12:07:46 +00:00
|
|
|
void qdevice short s
|
|
|
|
void unqdevice short s
|
|
|
|
void curvebasis short s
|
|
|
|
void curveprecision short s
|
|
|
|
void loadname short s
|
|
|
|
void passthrough short s
|
|
|
|
void pushname short s
|
|
|
|
void setmonitor short s
|
1993-12-21 17:06:12 +00:00
|
|
|
if !solaris void setshade short s
|
1990-10-14 12:07:46 +00:00
|
|
|
void setpattern short s
|
1993-12-21 17:06:12 +00:00
|
|
|
if !solaris void pagewritemask short s
|
1990-10-14 12:07:46 +00:00
|
|
|
#
|
|
|
|
void callobj long s
|
|
|
|
void delobj long s
|
|
|
|
void editobj long s
|
|
|
|
void makeobj long s
|
|
|
|
void maketag long s
|
|
|
|
void chunksize long s
|
|
|
|
void compactify long s
|
|
|
|
void deltag long s
|
|
|
|
void lsrepeat long s
|
|
|
|
void objinsert long s
|
|
|
|
void objreplace long s
|
|
|
|
void winclose long s
|
|
|
|
void blanktime long s
|
|
|
|
void freepup long s
|
|
|
|
# This is not in the library!?
|
|
|
|
###void pupcolor long s
|
|
|
|
#
|
|
|
|
void backbuffer long s
|
|
|
|
void frontbuffer long s
|
1993-12-21 17:06:12 +00:00
|
|
|
if !solaris void lsbackup long s
|
1990-10-14 12:07:46 +00:00
|
|
|
void resetls long s
|
|
|
|
void lampon long s
|
|
|
|
void lampoff long s
|
|
|
|
void setbell long s
|
|
|
|
void blankscreen long s
|
|
|
|
void depthcue long s
|
|
|
|
void zbuffer long s
|
|
|
|
void backface long s
|
|
|
|
#
|
|
|
|
void cmov2i long s long s
|
|
|
|
void draw2i long s long s
|
|
|
|
void move2i long s long s
|
|
|
|
void pnt2i long s long s
|
|
|
|
void patchbasis long s long s
|
|
|
|
void patchprecision long s long s
|
|
|
|
void pdr2i long s long s
|
|
|
|
void pmv2i long s long s
|
|
|
|
void rpdr2i long s long s
|
|
|
|
void rpmv2i long s long s
|
|
|
|
void xfpt2i long s long s
|
|
|
|
void objdelete long s long s
|
|
|
|
void patchcurves long s long s
|
|
|
|
void minsize long s long s
|
|
|
|
void maxsize long s long s
|
|
|
|
void keepaspect long s long s
|
|
|
|
void prefsize long s long s
|
|
|
|
void stepunit long s long s
|
|
|
|
void fudge long s long s
|
|
|
|
void winmove long s long s
|
|
|
|
#
|
|
|
|
void attachcursor short s short s
|
|
|
|
void deflinestyle short s short s
|
|
|
|
void noise short s short s
|
|
|
|
void picksize short s short s
|
|
|
|
void qenter short s short s
|
|
|
|
void setdepth short s short s
|
|
|
|
void cmov2s short s short s
|
|
|
|
void draw2s short s short s
|
|
|
|
void move2s short s short s
|
|
|
|
void pdr2s short s short s
|
|
|
|
void pmv2s short s short s
|
|
|
|
void pnt2s short s short s
|
|
|
|
void rdr2s short s short s
|
|
|
|
void rmv2s short s short s
|
|
|
|
void rpdr2s short s short s
|
|
|
|
void rpmv2s short s short s
|
|
|
|
void xfpt2s short s short s
|
|
|
|
#
|
|
|
|
void cmov2 float s float s
|
|
|
|
void draw2 float s float s
|
|
|
|
void move2 float s float s
|
|
|
|
void pnt2 float s float s
|
|
|
|
void pdr2 float s float s
|
|
|
|
void pmv2 float s float s
|
|
|
|
void rdr2 float s float s
|
|
|
|
void rmv2 float s float s
|
|
|
|
void rpdr2 float s float s
|
|
|
|
void rpmv2 float s float s
|
|
|
|
void xfpt2 float s float s
|
|
|
|
#
|
1993-12-21 17:06:12 +00:00
|
|
|
void loadmatrix float s[4*4]
|
1991-08-16 08:59:21 +00:00
|
|
|
# Really [4][4]
|
1993-12-21 17:06:12 +00:00
|
|
|
void multmatrix float s[4*4]
|
1991-08-16 08:59:21 +00:00
|
|
|
# Really [4][4]
|
1993-12-21 17:06:12 +00:00
|
|
|
void crv float s[3*4]
|
1991-08-16 08:59:21 +00:00
|
|
|
# Really [4][3]
|
1993-12-21 17:06:12 +00:00
|
|
|
void rcrv float s[4*4]
|
1991-08-16 08:59:21 +00:00
|
|
|
# Really [4][4]
|
1990-10-14 12:07:46 +00:00
|
|
|
#
|
|
|
|
# Methods that have strings.
|
|
|
|
#
|
|
|
|
void addtopup long s char *s long s
|
|
|
|
void charstr char *s
|
|
|
|
void getport char *s
|
|
|
|
long strwidth char *s
|
|
|
|
long winopen char *s
|
|
|
|
void wintitle char *s
|
|
|
|
#
|
|
|
|
# Methods that have 1 long (# of elements) and an array
|
|
|
|
#
|
|
|
|
void polf long s float s[3*arg1]
|
|
|
|
void polf2 long s float s[2*arg1]
|
|
|
|
void poly long s float s[3*arg1]
|
|
|
|
void poly2 long s float s[2*arg1]
|
|
|
|
void crvn long s float s[3*arg1]
|
|
|
|
void rcrvn long s float s[4*arg1]
|
|
|
|
#
|
|
|
|
void polf2i long s long s[2*arg1]
|
|
|
|
void polfi long s long s[3*arg1]
|
|
|
|
void poly2i long s long s[2*arg1]
|
|
|
|
void polyi long s long s[3*arg1]
|
|
|
|
#
|
|
|
|
void polf2s long s short s[2*arg1]
|
|
|
|
void polfs long s short s[3*arg1]
|
|
|
|
void polys long s short s[3*arg1]
|
|
|
|
void poly2s long s short s[2*arg1]
|
|
|
|
#
|
1993-12-21 17:06:12 +00:00
|
|
|
void defcursor short s u_short s[128]
|
1991-08-16 08:59:21 +00:00
|
|
|
# Is this useful?
|
1993-12-21 17:06:12 +00:00
|
|
|
void writepixels short s u_short s[arg1]
|
1991-08-16 08:59:21 +00:00
|
|
|
# Should be unsigned short...
|
1993-12-21 17:06:12 +00:00
|
|
|
void defbasis long s float s[4*4]
|
|
|
|
if !solaris void gewrite short s short s[arg1]
|
1990-10-14 12:07:46 +00:00
|
|
|
#
|
|
|
|
void rotate short s char s
|
|
|
|
# This is not in the library!?
|
|
|
|
###void setbutton short s char s
|
|
|
|
void rot float s char s
|
|
|
|
#
|
|
|
|
void circfi long s long s long s
|
|
|
|
void circi long s long s long s
|
|
|
|
void cmovi long s long s long s
|
|
|
|
void drawi long s long s long s
|
|
|
|
void movei long s long s long s
|
|
|
|
void pnti long s long s long s
|
|
|
|
void newtag long s long s long s
|
|
|
|
void pdri long s long s long s
|
|
|
|
void pmvi long s long s long s
|
|
|
|
void rdri long s long s long s
|
|
|
|
void rmvi long s long s long s
|
|
|
|
void rpdri long s long s long s
|
|
|
|
void rpmvi long s long s long s
|
|
|
|
void xfpti long s long s long s
|
|
|
|
#
|
|
|
|
void circ float s float s float s
|
|
|
|
void circf float s float s float s
|
|
|
|
void cmov float s float s float s
|
|
|
|
void draw float s float s float s
|
|
|
|
void move float s float s float s
|
|
|
|
void pnt float s float s float s
|
|
|
|
void scale float s float s float s
|
|
|
|
void translate float s float s float s
|
|
|
|
void pdr float s float s float s
|
|
|
|
void pmv float s float s float s
|
|
|
|
void rdr float s float s float s
|
|
|
|
void rmv float s float s float s
|
|
|
|
void rpdr float s float s float s
|
|
|
|
void rpmv float s float s float s
|
|
|
|
void xfpt float s float s float s
|
|
|
|
#
|
|
|
|
void RGBcolor short s short s short s
|
|
|
|
void RGBwritemask short s short s short s
|
|
|
|
void setcursor short s short s short s
|
|
|
|
void tie short s short s short s
|
|
|
|
void circfs short s short s short s
|
|
|
|
void circs short s short s short s
|
|
|
|
void cmovs short s short s short s
|
|
|
|
void draws short s short s short s
|
|
|
|
void moves short s short s short s
|
|
|
|
void pdrs short s short s short s
|
|
|
|
void pmvs short s short s short s
|
|
|
|
void pnts short s short s short s
|
|
|
|
void rdrs short s short s short s
|
|
|
|
void rmvs short s short s short s
|
|
|
|
void rpdrs short s short s short s
|
|
|
|
void rpmvs short s short s short s
|
|
|
|
void xfpts short s short s short s
|
|
|
|
void curorigin short s short s short s
|
|
|
|
void cyclemap short s short s short s
|
|
|
|
#
|
1993-12-21 17:06:12 +00:00
|
|
|
void patch float s[4*4] float s[4*4] float s[4*4]
|
|
|
|
void splf long s float s[3*arg1] u_short s[arg1]
|
|
|
|
void splf2 long s float s[2*arg1] u_short s[arg1]
|
|
|
|
void splfi long s long s[3*arg1] u_short s[arg1]
|
|
|
|
void splf2i long s long s[2*arg1] u_short s[arg1]
|
|
|
|
void splfs long s short s[3*arg1] u_short s[arg1]
|
|
|
|
void splf2s long s short s[2*arg1] u_short s[arg1]
|
|
|
|
###void defpattern short s short s u_short s[arg2*arg2/16]
|
1990-10-14 12:07:46 +00:00
|
|
|
#
|
1993-12-21 17:06:12 +00:00
|
|
|
void rpatch float s[4*4] float s[4*4] float s[4*4] float s[4*4]
|
1990-10-14 12:07:46 +00:00
|
|
|
#
|
|
|
|
# routines that send 4 floats
|
|
|
|
#
|
|
|
|
void ortho2 float s float s float s float s
|
|
|
|
void rect float s float s float s float s
|
|
|
|
void rectf float s float s float s float s
|
|
|
|
void xfpt4 float s float s float s float s
|
|
|
|
#
|
|
|
|
void textport short s short s short s short s
|
|
|
|
void mapcolor short s short s short s short s
|
|
|
|
void scrmask short s short s short s short s
|
|
|
|
void setvaluator short s short s short s short s
|
|
|
|
void viewport short s short s short s short s
|
|
|
|
void shaderange short s short s short s short s
|
|
|
|
void xfpt4s short s short s short s short s
|
|
|
|
void rectfi long s long s long s long s
|
|
|
|
void recti long s long s long s long s
|
|
|
|
void xfpt4i long s long s long s long s
|
|
|
|
void prefposition long s long s long s long s
|
|
|
|
#
|
|
|
|
void arc float s float s float s short s short s
|
|
|
|
void arcf float s float s float s short s short s
|
|
|
|
void arcfi long s long s long s short s short s
|
|
|
|
void arci long s long s long s short s short s
|
|
|
|
#
|
|
|
|
void bbox2 short s short s float s float s float s float s
|
|
|
|
void bbox2i short s short s long s long s long s long s
|
|
|
|
void bbox2s short s short s short s short s short s short s
|
|
|
|
void blink short s short s short s short s short s
|
|
|
|
void ortho float s float s float s float s float s float s
|
|
|
|
void window float s float s float s float s float s float s
|
|
|
|
void lookat float s float s float s float s float s float s short s
|
|
|
|
#
|
|
|
|
void perspective short s float s float s float s
|
|
|
|
void polarview float s short s short s short s
|
|
|
|
# XXX getichararray not supported
|
|
|
|
#void writeRGB short s char s[arg1] char s[arg1] char s[arg1]
|
|
|
|
#
|
|
|
|
void arcfs short s short s short s short s short s
|
|
|
|
void arcs short s short s short s short s short s
|
|
|
|
void rectcopy short s short s short s short s short s short s
|
1993-12-21 17:06:12 +00:00
|
|
|
if !solaris void RGBcursor short s short s short s short s short s short s short s
|
1990-10-14 12:07:46 +00:00
|
|
|
#
|
|
|
|
long getbutton short s
|
|
|
|
long getcmmode
|
|
|
|
long getlsbackup
|
|
|
|
long getresetls
|
|
|
|
long getdcm
|
|
|
|
long getzbuffer
|
|
|
|
long ismex
|
|
|
|
long isobj long s
|
|
|
|
long isqueued short s
|
|
|
|
long istag long s
|
|
|
|
#
|
|
|
|
long genobj
|
|
|
|
long gentag
|
|
|
|
long getbuffer
|
|
|
|
long getcolor
|
|
|
|
long getdisplaymode
|
|
|
|
long getfont
|
|
|
|
long getheight
|
|
|
|
long gethitcode
|
|
|
|
long getlstyle
|
|
|
|
long getlwidth
|
|
|
|
long getmap
|
|
|
|
long getplanes
|
|
|
|
long getwritemask
|
|
|
|
long qtest
|
|
|
|
long getlsrepeat
|
|
|
|
long getmonitor
|
|
|
|
long getopenobj
|
|
|
|
long getpattern
|
|
|
|
long winget
|
|
|
|
long winattach
|
|
|
|
long getothermonitor
|
|
|
|
long newpup
|
|
|
|
#
|
|
|
|
long getvaluator short s
|
|
|
|
void winset long s
|
|
|
|
long dopup long s
|
|
|
|
void getdepth short r short r
|
|
|
|
void getcpos short r short r
|
|
|
|
void getsize long r long r
|
|
|
|
void getorigin long r long r
|
|
|
|
void getviewport short r short r short r short r
|
1993-12-21 17:06:12 +00:00
|
|
|
if !solaris void gettp short r short r short r short r
|
1990-10-14 12:07:46 +00:00
|
|
|
void getgpos float r float r float r float r
|
|
|
|
void winposition long s long s long s long s
|
|
|
|
void gRGBcolor short r short r short r
|
|
|
|
void gRGBmask short r short r short r
|
|
|
|
void getscrmask short r short r short r short r
|
1991-10-20 20:13:40 +00:00
|
|
|
###void gRGBcursor short r short r short r short r short r short r short r short r
|
1990-10-14 12:07:46 +00:00
|
|
|
void getmcolor short s short r short r short r
|
|
|
|
void mapw long s short s short s float r float r float r float r float r float r
|
|
|
|
void mapw2 long s short s short s float r float r
|
1991-10-20 20:13:40 +00:00
|
|
|
###void defrasterfont short s short s short s Fontchar s[arg3] short s short s[4*arg5]
|
1992-08-13 14:23:56 +00:00
|
|
|
###long qread short r
|
1993-12-21 17:06:12 +00:00
|
|
|
void getcursor short r u_short r u_short r long r
|
1990-10-14 12:07:46 +00:00
|
|
|
#
|
|
|
|
# For these we receive arrays of stuff
|
|
|
|
#
|
1991-10-20 20:13:40 +00:00
|
|
|
###void getdev long s short s[arg1] short r[arg1]
|
1990-10-14 12:07:46 +00:00
|
|
|
#XXX not generated correctly yet
|
|
|
|
#void getmatrix float r[16]
|
1991-10-20 20:13:40 +00:00
|
|
|
###long readpixels short s short r[retval]
|
|
|
|
###long readRGB short s char r[retval] char r[retval] char r[retval]
|
|
|
|
###long blkqread short s short r[arg1]
|
1990-10-14 12:07:46 +00:00
|
|
|
#
|
|
|
|
# New 4D routines
|
|
|
|
#
|
|
|
|
void cmode
|
|
|
|
void concave long s
|
|
|
|
void curstype long s
|
|
|
|
void drawmode long s
|
|
|
|
void gammaramp short s[256] short s[256] short s[256]
|
|
|
|
long getbackface
|
|
|
|
long getdescender
|
|
|
|
long getdrawmode
|
|
|
|
long getmmode
|
|
|
|
long getsm
|
|
|
|
long getvideo long s
|
|
|
|
void imakebackground
|
|
|
|
void lmbind short s short s
|
|
|
|
void lmdef long s long s long s float s[arg3]
|
|
|
|
void mmode long s
|
|
|
|
void normal float s[3]
|
|
|
|
void overlay long s
|
|
|
|
void RGBrange short s short s short s short s short s short s short s short s
|
1993-12-21 17:06:12 +00:00
|
|
|
if !solaris void setvideo long s long s
|
1990-10-14 12:07:46 +00:00
|
|
|
void shademodel long s
|
|
|
|
void underlay long s
|
|
|
|
#
|
|
|
|
# New Personal Iris/GT Routines
|
|
|
|
#
|
|
|
|
void bgnclosedline
|
|
|
|
void bgnline
|
|
|
|
void bgnpoint
|
|
|
|
void bgnpolygon
|
|
|
|
void bgnsurface
|
|
|
|
void bgntmesh
|
|
|
|
void bgntrim
|
|
|
|
void endclosedline
|
|
|
|
void endline
|
|
|
|
void endpoint
|
|
|
|
void endpolygon
|
|
|
|
void endsurface
|
|
|
|
void endtmesh
|
|
|
|
void endtrim
|
|
|
|
void blendfunction long s long s
|
|
|
|
void c3f float s[3]
|
|
|
|
void c3i long s[3]
|
|
|
|
void c3s short s[3]
|
|
|
|
void c4f float s[4]
|
|
|
|
void c4i long s[4]
|
|
|
|
void c4s short s[4]
|
|
|
|
void colorf float s
|
|
|
|
void cpack long s
|
|
|
|
void czclear long s long s
|
|
|
|
void dglclose long s
|
|
|
|
long dglopen char *s long s
|
|
|
|
long getgdesc long s
|
|
|
|
void getnurbsproperty long s float r
|
|
|
|
void glcompat long s long s
|
|
|
|
void iconsize long s long s
|
|
|
|
void icontitle char *s
|
|
|
|
void lRGBrange short s short s short s short s short s short s long s long s
|
|
|
|
void linesmooth long s
|
|
|
|
void lmcolor long s
|
|
|
|
void logicop long s
|
1991-10-20 20:13:40 +00:00
|
|
|
###long lrectread short s short s short s short s long r[retval]
|
|
|
|
###void lrectwrite short s short s short s short s long s[(arg2-arg1+1)*(arg4-arg3+1)]
|
|
|
|
### Now manual, with string last arg
|
|
|
|
###long rectread short s short s short s short s short r[retval]
|
|
|
|
###void rectwrite short s short s short s short s short s[(arg2-arg1+1)*(arg4-arg3+1)]
|
1990-10-14 12:07:46 +00:00
|
|
|
void lsetdepth long s long s
|
|
|
|
void lshaderange short s short s long s long s
|
|
|
|
void n3f float s[3]
|
|
|
|
void noborder
|
|
|
|
void pntsmooth long s
|
|
|
|
void readsource long s
|
|
|
|
void rectzoom float s float s
|
|
|
|
void sbox float s float s float s float s
|
|
|
|
void sboxi long s long s long s long s
|
|
|
|
void sboxs short s short s short s short s
|
|
|
|
void sboxf float s float s float s float s
|
|
|
|
void sboxfi long s long s long s long s
|
|
|
|
void sboxfs short s short s short s short s
|
|
|
|
void setnurbsproperty long s float s
|
|
|
|
void setpup long s long s long s
|
|
|
|
void smoothline long s
|
|
|
|
void subpixel long s
|
|
|
|
void swaptmesh
|
|
|
|
long swinopen long s
|
|
|
|
void v2f float s[2]
|
|
|
|
void v2i long s[2]
|
|
|
|
void v2s short s[2]
|
|
|
|
void v3f float s[3]
|
|
|
|
void v3i long s[3]
|
|
|
|
void v3s short s[3]
|
|
|
|
void v4f float s[4]
|
|
|
|
void v4i long s[4]
|
|
|
|
void v4s short s[4]
|
|
|
|
void videocmd long s
|
|
|
|
long windepth long s
|
|
|
|
void wmpack long s
|
|
|
|
void zdraw long s
|
|
|
|
void zfunction long s
|
|
|
|
void zsource long s
|
|
|
|
void zwritemask long s
|
|
|
|
#
|
|
|
|
# uses doubles
|
|
|
|
#
|
|
|
|
void v2d double s[2]
|
|
|
|
void v3d double s[3]
|
|
|
|
void v4d double s[4]
|
1991-10-20 20:13:40 +00:00
|
|
|
#
|
|
|
|
# Why isn't this here?
|
|
|
|
#
|
|
|
|
void pixmode long s long s
|
1992-06-29 17:10:40 +00:00
|
|
|
#
|
|
|
|
# New in IRIX 4.0
|
|
|
|
#
|
|
|
|
long qgetfd
|
1993-02-19 12:53:12 +00:00
|
|
|
void dither long s
|