--- a/GLXWorkstation.st Wed Jan 24 14:40:55 2007 +0100
+++ b/GLXWorkstation.st Wed Jan 24 14:41:11 2007 +0100
@@ -24,7 +24,7 @@
/*
* on SGI, this class is compiled with -DGLX, while
* for simulation (using vogl), this is compiled with -DVGL
- *
+ *
* New note: starting to support openGL (tm) (compile with -DOPENGL)
* or its simulation (compile with -DMESA)
*/
@@ -166,7 +166,7 @@
static struct windowIDToGLContextMapping windowIDToGLContextMapping[MAX_OPENGL_VIEWS];
static OPENGLCONTEXT
-__glxWindowIdToGLContext(xId)
+__glxWindowIdToGLContext(xId)
Window xId;
{
int i;
@@ -310,7 +310,7 @@
/*
* check for and fetch an icoord from ST-arg into C-dst
- * ST-object must be SmallInteger. Return from method if invalid.
+ * ST-object must be SmallInteger. Return from method if invalid.
*/
#define _ICOORD_(arg, dst) \
if (__isSmallInteger(arg)) \
@@ -319,7 +319,7 @@
/*
* check for and fetch an scoord from ST-arg into C-dst
- * ST-object must be SmallInteger. Return from method if invalid.
+ * ST-object must be SmallInteger. Return from method if invalid.
*/
#define _SCOORD_(arg, dst) \
if (__isSmallInteger(arg)) \
@@ -405,25 +405,25 @@
{
XGetErrorText(dpy, event->error_code, lastErrorMsg, 80);
if (lastErrorMsg[0] == '\0') {
- sprintf(lastErrorMsg, "code: %d", event->error_code);
+ sprintf(lastErrorMsg, "code: %d", event->error_code);
}
lastRequestCode = event->request_code;
lastMinorCode = event->minor_code;
lastResource = event->resourceid;
if ((event->error_code == BadWindow) && (lastRequestCode == 4) && (lastMinorCode == 0)) {
- /*
- * this is a BadWindow error for X_DestroyWindow.
- * ignore it here, since it results from the GC freeing windows
- * in non bottom-up window order.
- */
- return 0;
+ /*
+ * this is a BadWindow error for X_DestroyWindow.
+ * ignore it here, since it results from the GC freeing windows
+ * in non bottom-up window order.
+ */
+ return 0;
}
if (@global(ErrorPrinting) == true) {
- fprintf(stderr, "GLXWORKSTAT: x-error caught maj=%d (0x%x) min=%d (0x%x) resource=%x\n",
- event->request_code, event->request_code,
- event->minor_code, event->minor_code, event->resourceid);
- fprintf(stderr, "GLXWORKSTAT: x-error message is [%d] '%s'\n", event->error_code, lastErrorMsg);
+ console_fprintf(stderr, "GLXWORKSTAT: x-error caught maj=%d (0x%x) min=%d (0x%x) resource=%x\n",
+ event->request_code, event->request_code,
+ event->minor_code, event->minor_code, event->resourceid);
+ console_fprintf(stderr, "GLXWORKSTAT: x-error message is [%d] '%s'\n", event->error_code, lastErrorMsg);
}
__errorInterruptWithIDAndParameter__(@symbol(DisplayError), __MKOBJ(dpy));
@@ -433,14 +433,14 @@
extern __XErrorHandler__();
#endif
-/*
+/*
* begin moved from GLXsupport.c
*/
/*
* This provides a helper function "GLXCreateWindow", which does
- * all the necessary magic to create an X window suitable for GL drawing
- * to take place within. See the definition of GLXCreateWindow for a
+ * all the necessary magic to create an X window suitable for GL drawing
+ * to take place within. See the definition of GLXCreateWindow for a
* description of how to call it.
*
* claus: I really had no time to look into all this,
@@ -452,7 +452,7 @@
# include <X11/Xlib.h>
# include <X11/Xutil.h>
# ifndef VGL
-# include <gl/glws.h>
+# include <gl/glws.h>
# endif
# include <signal.h>
# include <setjmp.h>
@@ -462,9 +462,9 @@
* glxhelper.h:
*
* List of drawing modes supported by GLXCreateWindow (in glxhelper.c).
- * More than this are possible with mixed model, but this is just an
- * example. You can either expand this list (and the corresponding code in
- * GLXCreateWindow) or call the mixed model calls yourself, using
+ * More than this are possible with mixed model, but this is just an
+ * example. You can either expand this list (and the corresponding code in
+ * GLXCreateWindow) or call the mixed model calls yourself, using
* GLXCreateWindow as an example.
*/
@@ -483,7 +483,7 @@
* Dorky little helper function used to build up a GLXconfig array.
*/
-static void
+static void
set_entry (GLXconfig* ptr, int b, int m, int a)
{
ptr->buffer = b;
@@ -517,7 +517,7 @@
* type the GLXWindowType (see glxhelper.h) desribing the
* typer of GL drawing to be done in this window
*/
-Window
+Window
__GLXCreateWindow(dpy, parent, x, y, w, h, borderWidth, type)
Display* dpy;
Window parent;
@@ -550,26 +550,26 @@
#endif
if (setjmp(errorReturn)) {
- fprintf(stderr, "hard error in GL - return\n");
+ console_fprintf(stderr, "hard error in GL - return\n");
#ifdef HAS_SIGACTION
- sigaction(SIGSEGV, &oldSig, 0);
-#else
- signal(SIGSEGV, oldSig);
+ sigaction(SIGSEGV, &oldSig, 0);
+#else
+ signal(SIGSEGV, oldSig);
#endif
#if !defined(OPENGL)
- __catchExit(0);
-#endif
- return 0;
+ __catchExit(0);
+#endif
+ return 0;
}
__CONT__
if (w <= 0) {
- fprintf(stderr, "GL: bad width: %d\n", w);
- w = 1;
+ console_fprintf(stderr, "GL: bad width: %d\n", w);
+ w = 1;
}
if (h <= 0) {
- fprintf(stderr, "GL: bad height: %d\n", h);
- h = 1;
+ console_fprintf(stderr, "GL: bad height: %d\n", h);
+ h = 1;
}
#if !defined(OPENGL)
@@ -580,22 +580,22 @@
switch (type) {
case GLXcolorIndexSingleBuffer:
case GLXcolorIndexDoubleBuffer:
- break;
+ break;
case GLXrgbSingleBuffer:
case GLXrgbDoubleBuffer:
- fprintf(stderr, "Sorry, VGL can't support %s type of windows\n", typeToName[type]);
- __catchExit(0);
- return 0;
+ console_fprintf(stderr, "Sorry, VGL can't support %s type of windows\n", typeToName[type]);
+ __catchExit(0);
+ return 0;
}
scr = DefaultScreen(dpy);
visual.visualid = CopyFromParent;
cwa.border_pixel = 0; /* Even if we don't use it, it must be something */
win = XCreateWindow(dpy, parent, x, y, w, h,
- borderWidth, DisplayPlanes(dpy, scr),
- InputOutput, &visual,
- CWBorderPixel, &cwa);
+ borderWidth, DisplayPlanes(dpy, scr),
+ InputOutput, &visual,
+ CWBorderPixel, &cwa);
/*
* on some, seg-violations occur in the GL, if too many
@@ -618,9 +618,9 @@
# endif
if (i < 0) {
- fprintf(stderr, "GLXlink returned %d\n", i);
- __catchExit(0);
- return 0;
+ console_fprintf(stderr, "GLXlink returned %d\n", i);
+ __catchExit(0);
+ return 0;
}
# else /* not VGL */
@@ -632,21 +632,21 @@
next = params;
switch (type) {
case GLXcolorIndexSingleBuffer:
- set_entry(next++, GLX_NORMAL, GLX_RGB, FALSE);
- set_entry(next++, GLX_NORMAL, GLX_DOUBLE, FALSE);
- break;
+ set_entry(next++, GLX_NORMAL, GLX_RGB, FALSE);
+ set_entry(next++, GLX_NORMAL, GLX_DOUBLE, FALSE);
+ break;
case GLXcolorIndexDoubleBuffer:
- set_entry(next++, GLX_NORMAL, GLX_RGB, FALSE);
- set_entry(next++, GLX_NORMAL, GLX_DOUBLE, TRUE);
- break;
+ set_entry(next++, GLX_NORMAL, GLX_RGB, FALSE);
+ set_entry(next++, GLX_NORMAL, GLX_DOUBLE, TRUE);
+ break;
case GLXrgbSingleBuffer:
- set_entry(next++, GLX_NORMAL, GLX_RGB, TRUE);
- set_entry(next++, GLX_NORMAL, GLX_DOUBLE, FALSE);
- break;
+ set_entry(next++, GLX_NORMAL, GLX_RGB, TRUE);
+ set_entry(next++, GLX_NORMAL, GLX_DOUBLE, FALSE);
+ break;
case GLXrgbDoubleBuffer:
- set_entry(next++, GLX_NORMAL, GLX_RGB, TRUE);
- set_entry(next++, GLX_NORMAL, GLX_DOUBLE, TRUE);
- break;
+ set_entry(next++, GLX_NORMAL, GLX_RGB, TRUE);
+ set_entry(next++, GLX_NORMAL, GLX_DOUBLE, TRUE);
+ break;
}
set_entry(next, 0, 0, 0); /* The input to GLXgetconfig is null terminated */
@@ -658,9 +658,9 @@
XGetWindowAttributes(dpy, parent, &pwa);
retconfig = GLXgetconfig(dpy, XScreenNumberOfScreen(pwa.screen), params);
if (retconfig == 0) {
- fprintf(stderr, "Sorry, can't support %s type of windows\n", typeToName[type]);
- __catchExit(0);
- return 0;
+ console_fprintf(stderr, "Sorry, can't support %s type of windows\n", typeToName[type]);
+ __catchExit(0);
+ return 0;
}
/*
@@ -668,24 +668,24 @@
* that supports the rendering mode.
*/
for (next = retconfig; next->buffer; next++) {
- unsigned long buffer = next->buffer;
- unsigned long mode = next->mode;
- unsigned long value = next->arg;
- switch (mode) {
- case GLX_COLORMAP:
- if (buffer == GLX_NORMAL) {
- cmap = value;
- }
- break;
- case GLX_VISUAL:
- if (buffer == GLX_NORMAL) {
- template.visualid = value;
- template.screen = DefaultScreen(dpy);
- vis = XGetVisualInfo(dpy, VisualScreenMask|VisualIDMask,
- &template, &nret);
- }
- break;
- }
+ unsigned long buffer = next->buffer;
+ unsigned long mode = next->mode;
+ unsigned long value = next->arg;
+ switch (mode) {
+ case GLX_COLORMAP:
+ if (buffer == GLX_NORMAL) {
+ cmap = value;
+ }
+ break;
+ case GLX_VISUAL:
+ if (buffer == GLX_NORMAL) {
+ template.visualid = value;
+ template.screen = DefaultScreen(dpy);
+ vis = XGetVisualInfo(dpy, VisualScreenMask|VisualIDMask,
+ &template, &nret);
+ }
+ break;
+ }
}
/*
@@ -694,18 +694,18 @@
cwa.colormap = cmap;
cwa.border_pixel = 0; /* Even if we don't use it, it must be something */
win = XCreateWindow(dpy, parent, x, y, w, h,
- borderWidth, vis->depth, InputOutput, vis->visual,
- CWColormap|CWBorderPixel, &cwa);
+ borderWidth, vis->depth, InputOutput, vis->visual,
+ CWColormap|CWBorderPixel, &cwa);
/*
* Rescan configuration info and find window slot that getconfig
* provided. Fill it in with the window we just created.
*/
for (next = retconfig; next->buffer; next++) {
- if ((next->buffer == GLX_NORMAL) && (next->mode == GLX_WINDOW)) {
- next->arg = win;
- break;
- }
+ if ((next->buffer == GLX_NORMAL) && (next->mode == GLX_WINDOW)) {
+ next->arg = win;
+ break;
+ }
}
/*
@@ -732,9 +732,9 @@
# endif
if (i < 0) {
- fprintf(stderr, "GLXlink returned %d\n", i);
- __catchExit(0);
- return 0;
+ console_fprintf(stderr, "GLXlink returned %d\n", i);
+ __catchExit(0);
+ return 0;
}
/*
@@ -750,12 +750,12 @@
visual.visualid = CopyFromParent;
cwa.border_pixel = 0; /* Even if we don't use it, it must be something */
win = XCreateWindow(dpy, parent, x, y, w, h,
- borderWidth, DisplayPlanes(dpy, scr),
- InputOutput, &visual,
- CWBorderPixel, &cwa);
+ borderWidth, DisplayPlanes(dpy, scr),
+ InputOutput, &visual,
+ CWBorderPixel, &cwa);
vis = XGetVisualInfo(dpy, VisualScreenMask|VisualIDMask, &visual, &nret);
- fprintf(stderr, "vis is %x\n", vis);
+ console_fprintf(stderr, "vis is %x\n", vis);
#endif /* GLX || VGL */
return win;
@@ -784,40 +784,40 @@
float f_angle;
if (__isFloat(angle)) {
- f_angle = (float)(_floatVal(angle));
- if (f_angle != 0.0) {
-#ifdef OPENGL
-#else
- rot(f_angle, axis);
-#endif
- }
- return (true);
+ f_angle = (float)(_floatVal(angle));
+ if (f_angle != 0.0) {
+#ifdef OPENGL
+#else
+ rot(f_angle, axis);
+#endif
+ }
+ return (true);
}
if (__isFraction(angle)
&& __isSmallInteger(_FractionInstPtr(angle)->f_numerator)
&& __isSmallInteger(_FractionInstPtr(angle)->f_denominator)) {
- float n, d;
-
- n = (float)(__intVal(_FractionInstPtr(angle)->f_numerator));
- d = (float)(__intVal(_FractionInstPtr(angle)->f_denominator));
- f_angle = n / d;
- if (f_angle != 0.0) {
-#ifdef OPENGL
-#else
- rot(f_angle, axis);
-#endif
- }
- return (true);
+ float n, d;
+
+ n = (float)(__intVal(_FractionInstPtr(angle)->f_numerator));
+ d = (float)(__intVal(_FractionInstPtr(angle)->f_denominator));
+ f_angle = n / d;
+ if (f_angle != 0.0) {
+#ifdef OPENGL
+#else
+ rot(f_angle, axis);
+#endif
+ }
+ return (true);
}
if (__isSmallInteger(angle)) {
- f_angle = (float)(__intVal(angle));
- if (f_angle != 0.0) {
-#ifdef OPENGL
-#else
- rot(f_angle, axis);
-#endif
- }
- return (true);
+ f_angle = (float)(__intVal(angle));
+ if (f_angle != 0.0) {
+#ifdef OPENGL
+#else
+ rot(f_angle, axis);
+#endif
+ }
+ return (true);
}
return false;
}
@@ -842,10 +842,10 @@
pElem = (char *)(_InstPtr(obj)) + nInstBytes;
if (nByte < (count * sizeof(OBJ))) return (long *)NULL;
for (i=0; i<count; i++) {
- o = *(OBJ *)pElem;
- if (! __isSmallInteger(o)) return (long *)NULL;
- vec[i] = (long)__intVal(o);
- pElem += sizeof(OBJ);
+ o = *(OBJ *)pElem;
+ if (! __isSmallInteger(o)) return (long *)NULL;
+ vec[i] = (long)__intVal(o);
+ pElem += sizeof(OBJ);
}
return vec;
}
@@ -870,16 +870,16 @@
pElem = (char *)(_InstPtr(obj)) + nInstBytes;
if (nByte < (count * sizeof(OBJ))) return (short *)NULL;
for (i=0; i<count; i++) {
- o = *(OBJ *)pElem;
- if (! __isSmallInteger(o)) return (short *)NULL;
- vec[i] = (short)__intVal(o);
- pElem += sizeof(OBJ);
+ o = *(OBJ *)pElem;
+ if (! __isSmallInteger(o)) return (short *)NULL;
+ vec[i] = (short)__intVal(o);
+ pElem += sizeof(OBJ);
}
return vec;
}
/*
- * fetch floats from an st-object into a c-float array
+ * fetch floats from an st-object into a c-float array
* which may be a floatArray, doubleArray or array-of-something,
* where something may be a float, fraction or smallInteger,
*/
@@ -904,56 +904,56 @@
switch (__intVal(_ClassInstPtr(cls)->c_flags) & ARRAYMASK) {
case FLOATARRAY:
- /*
- * best speed for float array
- * - the data is already as we want it
- */
- if (nByte < (count * sizeof(float))) return (float *)0;
- return (float *)pElem;
+ /*
+ * best speed for float array
+ * - the data is already as we want it
+ */
+ if (nByte < (count * sizeof(float))) return (float *)0;
+ return (float *)pElem;
case DOUBLEARRAY:
- /*
- * for double array, have to copy-and-cast
- */
- if (nByte < (count * sizeof(double))) return (float *)0;
- for (i=0; i<count; i++) {
- vec[i] = *((double *)pElem);
- pElem += sizeof(double);
- }
- return vec;
+ /*
+ * for double array, have to copy-and-cast
+ */
+ if (nByte < (count * sizeof(double))) return (float *)0;
+ for (i=0; i<count; i++) {
+ vec[i] = *((double *)pElem);
+ pElem += sizeof(double);
+ }
+ return vec;
case POINTERARRAY:
- /*
- * for other array, have to fetch, check and store
- * the elements can be floats, smallintegers or fractions
- */
- if (nByte < (count * sizeof(OBJ))) return (float *)0;
- /* get elements one-by-one */
- for (i=0; i<count; i++) {
- o = *(OBJ *)pElem;
- if (__isFloat(o)) {
- vec[i] = _floatVal(o);
- } else if (__isSmallInteger(o)) {
- vec[i] = (float)(__intVal(o));
- } else if (__isFraction(o)
- && __isSmallInteger(_FractionInstPtr(o)->f_numerator)
- && __isSmallInteger(_FractionInstPtr(o)->f_denominator)) {
- float n, d;
-
- n = (float)(__intVal(_FractionInstPtr(o)->f_numerator));
- d = (float)(__intVal(_FractionInstPtr(o)->f_denominator));
- vec[i] = n / d;
- } else
- return 0;
- pElem += sizeof(OBJ);
- }
- return vec;
+ /*
+ * for other array, have to fetch, check and store
+ * the elements can be floats, smallintegers or fractions
+ */
+ if (nByte < (count * sizeof(OBJ))) return (float *)0;
+ /* get elements one-by-one */
+ for (i=0; i<count; i++) {
+ o = *(OBJ *)pElem;
+ if (__isFloat(o)) {
+ vec[i] = _floatVal(o);
+ } else if (__isSmallInteger(o)) {
+ vec[i] = (float)(__intVal(o));
+ } else if (__isFraction(o)
+ && __isSmallInteger(_FractionInstPtr(o)->f_numerator)
+ && __isSmallInteger(_FractionInstPtr(o)->f_denominator)) {
+ float n, d;
+
+ n = (float)(__intVal(_FractionInstPtr(o)->f_numerator));
+ d = (float)(__intVal(_FractionInstPtr(o)->f_denominator));
+ vec[i] = n / d;
+ } else
+ return 0;
+ pElem += sizeof(OBJ);
+ }
+ return vec;
}
return (float *)0;
}
/*
- * fetch doubles from an st-object into a c-double array
+ * fetch doubles from an st-object into a c-double array
* which may be a floatArray, doubleArray or array-of-something,
* where something may be a float, fraction or smallInteger,
*/
@@ -975,41 +975,41 @@
switch (__intVal(_ClassInstPtr(cls)->c_flags) & ARRAYMASK) {
case DOUBLEARRAY:
- /* best speed for double array - the data is already as we want it */
- if (nByte < (count * sizeof(double))) return (double *)0;
- return (double *)pElem;
+ /* best speed for double array - the data is already as we want it */
+ if (nByte < (count * sizeof(double))) return (double *)0;
+ return (double *)pElem;
case FLOATARRAY:
- if (nByte < (count * sizeof(float))) return (double *)0;
- for (i=0; i<count; i++) {
- vec[i] = *((float *)pElem);
- pElem += sizeof(float);
- }
- return vec;
+ if (nByte < (count * sizeof(float))) return (double *)0;
+ for (i=0; i<count; i++) {
+ vec[i] = *((float *)pElem);
+ pElem += sizeof(float);
+ }
+ return vec;
case POINTERARRAY:
- if (nByte < (count * sizeof(OBJ))) return (double *)0;
- /* get elements one-by-one */
- for (i=0; i<count; i++) {
- o = *(OBJ *)pElem;
- if (__isFloat(o))
- vec[i] = _floatVal(o);
- else if (__isSmallInteger(o))
- vec[i] = (double)(__intVal(o));
- else if (__isFraction(o)
- && __isSmallInteger(_FractionInstPtr(o)->f_numerator)
- && __isSmallInteger(_FractionInstPtr(o)->f_denominator)) {
- double n, d;
-
- n = (double)(__intVal(_FractionInstPtr(o)->f_numerator));
- d = (double)(__intVal(_FractionInstPtr(o)->f_denominator));
- vec[i] = n / d;
-
- } else
- return 0;
- pElem += sizeof(OBJ);
- }
- return vec;
+ if (nByte < (count * sizeof(OBJ))) return (double *)0;
+ /* get elements one-by-one */
+ for (i=0; i<count; i++) {
+ o = *(OBJ *)pElem;
+ if (__isFloat(o))
+ vec[i] = _floatVal(o);
+ else if (__isSmallInteger(o))
+ vec[i] = (double)(__intVal(o));
+ else if (__isFraction(o)
+ && __isSmallInteger(_FractionInstPtr(o)->f_numerator)
+ && __isSmallInteger(_FractionInstPtr(o)->f_denominator)) {
+ double n, d;
+
+ n = (double)(__intVal(_FractionInstPtr(o)->f_numerator));
+ d = (double)(__intVal(_FractionInstPtr(o)->f_denominator));
+ vec[i] = n / d;
+
+ } else
+ return 0;
+ pElem += sizeof(OBJ);
+ }
+ return vec;
}
return (double *)0;
}
@@ -1038,20 +1038,20 @@
switch (__intVal(_ClassInstPtr(cls)->c_flags) & ARRAYMASK) {
case FLOATARRAY:
- if (nByte < (count * sizeof(float))) return 0;
- for (i=0; i<count; i++) {
- *(float *)pElem = vec[i];
- pElem += sizeof(float);
- }
- return 1;
+ if (nByte < (count * sizeof(float))) return 0;
+ for (i=0; i<count; i++) {
+ *(float *)pElem = vec[i];
+ pElem += sizeof(float);
+ }
+ return 1;
case DOUBLEARRAY:
- if (nByte < (count * sizeof(float))) return 0;
- for (i=0; i<count; i++) {
- *(double *)pElem = vec[i];
- pElem += sizeof(double);
- }
- return 1;
+ if (nByte < (count * sizeof(float))) return 0;
+ for (i=0; i<count; i++) {
+ *(double *)pElem = vec[i];
+ pElem += sizeof(double);
+ }
+ return 1;
}
/* not implemented for others */
@@ -1082,52 +1082,52 @@
pElem = (char *)(_InstPtr(obj)) + nInstBytes;
switch (__intVal(_ClassInstPtr(cls)->c_flags) & ARRAYMASK) {
- case FLOATARRAY:
- /*
- * very easy for FLOATARRAY objects - no copying needed
- */
- if (nByte < (16 * sizeof(float))) return (Matrix *)0;
- return (Matrix *) _FloatArrayInstPtr(obj)->f_element;
-
- case DOUBLEARRAY:
- /*
- * for DOUBLEARRAY objects copy and cast
- */
- if (nByte < (16 * sizeof(double))) return (Matrix *)0;
- for (i=0; i<4; i++) {
- for (j=0; j<4; j++) {
- (*mp)[i][j] = _DoubleArrayInstPtr(obj)->d_element[x];
- x++;
- }
- }
- return mp;
-
- case POINTERARRAY:
- if (nByte < (16 * sizeof(OBJ))) return (Matrix *)0;
- /*
- * get elements one-by-one
- */
- for (i=0; i<4; i++) {
- for (j=0; j<4; j++) {
- o = _ArrayInstPtr(obj)->a_element[x];
- if (__isFloat(o)) {
- (*mp)[i][j] = _floatVal(o);
- } else if (__isSmallInteger(o)) {
- (*mp)[i][j] = (double)__intVal(o);
- } else if (__isFraction(o)
- && __isSmallInteger(_FractionInstPtr(o)->f_numerator)
- && __isSmallInteger(_FractionInstPtr(o)->f_denominator)) {
- double n, d;
-
- n = (double)(__intVal(_FractionInstPtr(o)->f_numerator));
- d = (double)(__intVal(_FractionInstPtr(o)->f_denominator));
- (*mp)[i][j] = n / d;
- } else
- return (Matrix *)0;
- x++;
- }
- }
- return mp;
+ case FLOATARRAY:
+ /*
+ * very easy for FLOATARRAY objects - no copying needed
+ */
+ if (nByte < (16 * sizeof(float))) return (Matrix *)0;
+ return (Matrix *) _FloatArrayInstPtr(obj)->f_element;
+
+ case DOUBLEARRAY:
+ /*
+ * for DOUBLEARRAY objects copy and cast
+ */
+ if (nByte < (16 * sizeof(double))) return (Matrix *)0;
+ for (i=0; i<4; i++) {
+ for (j=0; j<4; j++) {
+ (*mp)[i][j] = _DoubleArrayInstPtr(obj)->d_element[x];
+ x++;
+ }
+ }
+ return mp;
+
+ case POINTERARRAY:
+ if (nByte < (16 * sizeof(OBJ))) return (Matrix *)0;
+ /*
+ * get elements one-by-one
+ */
+ for (i=0; i<4; i++) {
+ for (j=0; j<4; j++) {
+ o = _ArrayInstPtr(obj)->a_element[x];
+ if (__isFloat(o)) {
+ (*mp)[i][j] = _floatVal(o);
+ } else if (__isSmallInteger(o)) {
+ (*mp)[i][j] = (double)__intVal(o);
+ } else if (__isFraction(o)
+ && __isSmallInteger(_FractionInstPtr(o)->f_numerator)
+ && __isSmallInteger(_FractionInstPtr(o)->f_denominator)) {
+ double n, d;
+
+ n = (double)(__intVal(_FractionInstPtr(o)->f_numerator));
+ d = (double)(__intVal(_FractionInstPtr(o)->f_denominator));
+ (*mp)[i][j] = n / d;
+ } else
+ return (Matrix *)0;
+ x++;
+ }
+ }
+ return mp;
}
return (Matrix *)0;
}
@@ -1145,11 +1145,11 @@
if (! _isNonNilObject(obj)) return (float *)0;
cls = __qClass(obj);
if (cls == @global(FloatArray))
- return _FloatArrayInstPtr(obj)->f_element;
+ return _FloatArrayInstPtr(obj)->f_element;
if ((__intVal(_ClassInstPtr(cls)->c_flags) & ARRAYMASK) == FLOATARRAY) {
- ninstVars = __intVal(_ClassInstPtr(cls)->c_ninstvars);
- return (float *) &(_InstPtr(obj)->i_instvars[ninstVars]);
+ ninstVars = __intVal(_ClassInstPtr(cls)->c_ninstvars);
+ return (float *) &(_InstPtr(obj)->i_instvars[ninstVars]);
}
/*
@@ -1198,7 +1198,7 @@
The interface offered here provides a very very low level (i.e one-to-one)
interface to GL functions. More high-level stuff is required, to make
- 3D drawing be more object-oriented.
+ 3D drawing be more object-oriented.
(see a bit of this in 'clients/IRIS-specials')
Some functions are duplicated, Jeff and I developed those in parallel -
@@ -1220,7 +1220,7 @@
VGL stuff dec 93
many many additions jan 94 by Jeff McAffer <jeff@is.s.u-tokyo.ac.jp>
- Since this is a demo (consider it a free add-on goody) there is
+ Since this is a demo (consider it a free add-on goody) there is
*** NO WARRANTY ** for this.
Notice: this should be rewritten to use the openGL library functions
@@ -1718,7 +1718,7 @@
"Return the current character position as a point with integer coordinates"
| x y |
-%{
+%{
short s_x, s_y;
SETWIN(aGLXWindowId)
@@ -1779,8 +1779,8 @@
!GLXWorkstation methodsFor:'color'!
glxColor:index in:aGLXWindowId
- "set the drawing color;
- for non gouraud shading, we dont care if the argument is integer or float;
+ "set the drawing color;
+ for non gouraud shading, we dont care if the argument is integer or float;
otherwise, better results are expected with float values."
%{ /* NOCONTEXT */
@@ -1841,8 +1841,8 @@
%{ /* NOCONTEXT */
SETWIN(aGLXWindowId)
#ifdef GLX
- lRGBrange(_shortVal(rmin), _shortVal(gmin), _shortVal(bmin),
- _shortVal(rmax), _shortVal(gmax), _shortVal(bmax),
+ lRGBrange(_shortVal(rmin), _shortVal(gmin), _shortVal(bmin),
+ _shortVal(rmax), _shortVal(gmax), _shortVal(bmax),
_longVal(znear), _longVal(zfar));
#endif
%}
@@ -2334,7 +2334,7 @@
!
glxRmv2:v in: aGLXWindowId
- "change the graphics position to a 2D point,
+ "change the graphics position to a 2D point,
the relative distance is passed in vector v"
%{ /* NOCONTEXT */
@@ -2354,7 +2354,7 @@
!
glxRmv2X: x y: y in: aGLXWindowId
- "change the graphics position to a 2D point,
+ "change the graphics position to a 2D point,
the relative distance is passed in x/y"
%{ /* NOCONTEXT */
@@ -2375,7 +2375,7 @@
!
glxRmv2iX: x y: y in: aGLXWindowId
- "change the graphics position to a 2D point,
+ "change the graphics position to a 2D point,
the relative distance is passed in x/y.
The arguments must be smallIntegers."
@@ -2397,7 +2397,7 @@
!
glxRmv2sX: x y: y in: aGLXWindowId
- "change the graphics position to a 2D point,
+ "change the graphics position to a 2D point,
the relative distance is passed in x/y.
The arguments must be smallIntegers."
@@ -2419,7 +2419,7 @@
!
glxRmv:v in: aGLXWindowId
- "change the graphics position to a 3D point,
+ "change the graphics position to a 3D point,
the relative distance is passed in vector v"
%{ /* NOCONTEXT */
@@ -2439,7 +2439,7 @@
!
glxRmvX: x y: y z: z in: aGLXWindowId
- "change the graphics position to a 3D point,
+ "change the graphics position to a 3D point,
the relative distance is passed in x/y/z"
%{ /* NOCONTEXT */
@@ -2461,7 +2461,7 @@
!
glxRmviX: x y: y z: z in: aGLXWindowId
- "change the graphics position to a 3D point,
+ "change the graphics position to a 3D point,
the relative distance is passed in x/y/z.
The arguments must be smallIntegers."
@@ -2484,7 +2484,7 @@
!
glxRmvsX: x y: y z: z in: aGLXWindowId
- "change the graphics position to a 3D point,
+ "change the graphics position to a 3D point,
the relative distance is passed in x/y/z.
The arguments must be smallIntegers."
@@ -2529,8 +2529,8 @@
"/ Sorry. (I guess, there are some query functions for that available, but I
"/ have no documentation).
"/ Late note: setting the ForceGL classVar overrides above behavior.
- "/ it may be set from a startupScript with: 'GLXWorkstation forceGL:true'
- "/ however: be careful: only set it to true, if you are certain that remoteGL works
+ "/ it may be set from a startupScript with: 'GLXWorkstation forceGL:true'
+ "/ however: be careful: only set it to true, if you are certain that remoteGL works
(self isTrueGL and:[ForceGL ~~ true]) ifTrue:[
glOK := (displayName = ':0') or:[displayName = ':0.0'].
@@ -2961,8 +2961,8 @@
defType = LIGHT7;
else if (target == @symbol(lightModel))
defType = LMODEL;
- else {
- RETURN (nil);
+ else {
+ RETURN (nil);
}
_INT_ (index, i_index);
@@ -3010,7 +3010,7 @@
} else {
RETURN (nil);
}
- }
+ }
}
SETWIN(aGLXWindowId)
lmdef(defType, i_index, i_np, fp);
@@ -3324,9 +3324,9 @@
#ifdef OPENGL
#else
if (__isSmallInteger(obj)) {
- SETWIN(aGLXWindowId)
- delobj(_objectVal(obj));
- RETURN (true);
+ SETWIN(aGLXWindowId)
+ delobj(_objectVal(obj));
+ RETURN (true);
}
#endif
%}
@@ -3452,18 +3452,18 @@
%}
!
-glxNurbsSurfaceUKnotCount: uKnotCount uKnot: uKnot
+glxNurbsSurfaceUKnotCount: uKnotCount uKnot: uKnot
vKnotCount: vKnotCount vKnot: vKnot
- uOffset: uOffset vOffset: vOffset
- ctlArray: ctlArray
- uOrder: uOrder vOrder: vOrder
+ uOffset: uOffset vOffset: vOffset
+ ctlArray: ctlArray
+ uOrder: uOrder vOrder: vOrder
type: type in: aGLXWindowId
| ctlPoints i |
ctlPoints := DoubleArray new: ctlArray size * (ctlArray first size).
i := 1.
ctlArray do: [:point |
- point do: [:coord |
+ point do: [:coord |
ctlPoints at: i put: coord.
i := i + 1]].
@@ -3486,7 +3486,7 @@
__intVal(uKnotCount), (double *)uKnotElements,
__intVal(vKnotCount), (double *)vKnotElements,
__intVal(uOffset), __intVal(vOffset),
- (double *)ctlElements,
+ (double *)ctlElements,
__intVal(uOrder), __intVal(vOrder), __intVal(type));
RETURN(true);
#endif
@@ -3550,11 +3550,11 @@
Matrix matrixX, matrixY, matrixZ;
Matrix *mX, *mY, *mZ;
- if (! (mX = __glx_getFloatsFromMatrixInto(arrayOf16XFloats, matrixX)))
+ if (! (mX = __glx_getFloatsFromMatrixInto(arrayOf16XFloats, matrixX)))
RETURN (nil);
- if (! (mY = __glx_getFloatsFromMatrixInto(arrayOf16YFloats, matrixY)))
+ if (! (mY = __glx_getFloatsFromMatrixInto(arrayOf16YFloats, matrixY)))
RETURN (nil);
- if (! (mZ = __glx_getFloatsFromMatrixInto(arrayOf16ZFloats, matrixZ)))
+ if (! (mZ = __glx_getFloatsFromMatrixInto(arrayOf16ZFloats, matrixZ)))
RETURN (nil);
SETWIN(aGLXWindowId)
patch(*mX, *mY, *mZ);
@@ -3574,13 +3574,13 @@
Matrix matrixX, matrixY, matrixZ, matrixW;
Matrix *mX, *mY, *mZ, *mW;
- if (! (mX = __glx_getFloatsFromMatrixInto(arrayOf16XFloats, matrixX)))
+ if (! (mX = __glx_getFloatsFromMatrixInto(arrayOf16XFloats, matrixX)))
RETURN (nil);
- if (! (mY = __glx_getFloatsFromMatrixInto(arrayOf16YFloats, matrixY)))
+ if (! (mY = __glx_getFloatsFromMatrixInto(arrayOf16YFloats, matrixY)))
RETURN (nil);
- if (! (mZ = __glx_getFloatsFromMatrixInto(arrayOf16ZFloats, matrixZ)))
+ if (! (mZ = __glx_getFloatsFromMatrixInto(arrayOf16ZFloats, matrixZ)))
RETURN (nil);
- if (! (mW = __glx_getFloatsFromMatrixInto(arrayOf16WFloats, matrixW)))
+ if (! (mW = __glx_getFloatsFromMatrixInto(arrayOf16WFloats, matrixW)))
RETURN (nil);
SETWIN(aGLXWindowId)
rpatch(*mX, *mY, *mZ, *mW);
@@ -3601,8 +3601,8 @@
%{ /* NOCONTEXT */
#ifdef GLX
SETWIN(aGLXWindowId)
- rectcopy(_screencoordVal(x1), _screencoordVal(y1),
- _screencoordVal(x2), _screencoordVal(y2),
+ rectcopy(_screencoordVal(x1), _screencoordVal(y1),
+ _screencoordVal(x2), _screencoordVal(y2),
_screencoordVal(newx), _screencoordVal(newy));
#endif
%}
@@ -3708,7 +3708,7 @@
) {
SETWIN(aGLXWindowId)
nRead = rectread(__intVal(x1), __intVal(sy1),
- __intVal(x2), __intVal(sy2),
+ __intVal(x2), __intVal(sy2),
buffer);
for (i=0; i<nRead;i++) {
__ArrayInstPtr(dest)->a_element[i] = __MKSMALLINT(buffer[i]);
@@ -3902,7 +3902,7 @@
!GLXWorkstation methodsFor:'polygons'!
glxBackface: b in: aGLXWindowId
- "enable/disable culling of backfacing polygons (suppress its drawing).
+ "enable/disable culling of backfacing polygons (suppress its drawing).
A polygon is backfacing if it's orientation in *screen* coords is clockwise"
%{ /* NOCONTEXT */
@@ -3929,8 +3929,8 @@
!
glxFrontface: b in: aGLXWindowId
- "enable/disable culling of frontfacing polygons (suppress its drawing).
- A polygon is frontfacing if it's orientation in *screen* coords is
+ "enable/disable culling of frontfacing polygons (suppress its drawing).
+ A polygon is frontfacing if it's orientation in *screen* coords is
anti-clockwise"
@@ -4426,7 +4426,7 @@
%}
"
- Display glVersion
+ Display glVersion
"
!
@@ -4453,7 +4453,7 @@
^ hasStereoExtension
"
- Display hasStereoExtension
+ Display hasStereoExtension
"
!
@@ -4487,7 +4487,7 @@
maxZValue
"return the max. Z value (only valid if z-buffer is supported)"
-%{
+%{
#ifndef OPENGL
# ifdef GD_ZMAX
long zMax;
@@ -4528,7 +4528,7 @@
^ false
"
- Display supportsDoubleBuffer
+ Display supportsDoubleBuffer
"
!
@@ -4538,7 +4538,7 @@
^ glOK
"
- Display supportsGLDrawing
+ Display supportsGLDrawing
"
!
@@ -4556,7 +4556,7 @@
^ false
"
- Display supportsLight
+ Display supportsLight
"
!
@@ -4575,7 +4575,7 @@
^ false
"
- Display supportsRGB
+ Display supportsRGB
"
!
@@ -4597,7 +4597,7 @@
^ false
"
- Display supportsTextures
+ Display supportsTextures
"
!
@@ -4619,7 +4619,7 @@
^ false
"
- Display supportsZBuffer
+ Display supportsZBuffer
"
! !
@@ -4822,7 +4822,7 @@
int buffer;
Window win;
- if (ISCONNECTED
+ if (ISCONNECTED
&& __isExternalAddress(aWindowId)) {
win = _WindowVal(aWindowId);
if (aBufferSymbol == @symbol(left)) {
@@ -4850,9 +4850,9 @@
v := GLXView origin:0.0@0.0 corner:1.0@1.0 in:t.
t openAndWait.
- v device stereoExtensionBuffer:#left for:(v id).
+ v device stereoExtensionBuffer:#left for:(v id).
(Delay forSeconds:10) wait.
- v device stereoExtensionBuffer:#right for:(v id).
+ v device stereoExtensionBuffer:#right for:(v id).
"
!
@@ -4870,7 +4870,7 @@
unsigned short us_h, us_o;
Window win;
- if (ISCONNECTED
+ if (ISCONNECTED
&& __bothSmallInteger(h, o)
&& __isExternalAddress(aWindowId)) {
win = _WindowVal(aWindowId);
@@ -4900,9 +4900,9 @@
self primitiveFailed
"
- Display stereoExtensionMode:#top height:492 offset:532 for:(Display rootWindowId).
+ Display stereoExtensionMode:#top height:492 offset:532 for:(Display rootWindowId).
(Delay forSeconds:10) wait.
- Display stereoExtensionMode:#off height:0 offset:0 for:(Display rootWindowId).
+ Display stereoExtensionMode:#off height:0 offset:0 for:(Display rootWindowId).
"
!
@@ -4939,7 +4939,7 @@
v openAndWait.
v device stereoExtensionModeIn:(v id)
- Display stereoExtensionModeIn:Display rootWindowId
+ Display stereoExtensionModeIn:Display rootWindowId
"
!
@@ -5518,7 +5518,7 @@
%{ /* NOCONTEXT */
Screencoord c_xmin, c_ymin;
- Coord c_x1, c_y1, c_x2, c_y2;
+ Coord c_x1, c_y1, c_x2, c_y2;
_SCREENCOORD_ (xmin, c_xmin)
_SCREENCOORD_ (ymin, c_ymin)
@@ -5537,7 +5537,7 @@
%{ /* NOCONTEXT */
Screencoord c_xmin, c_ymin;
- Icoord c_x1, c_y1, c_x2, c_y2;
+ Icoord c_x1, c_y1, c_x2, c_y2;
_SCREENCOORD_ (xmin, c_xmin)
_SCREENCOORD_ (ymin, c_ymin)
@@ -5556,7 +5556,7 @@
%{ /* NOCONTEXT */
Screencoord c_xmin, c_ymin;
- Scoord c_x1, c_y1, c_x2, c_y2;
+ Scoord c_x1, c_y1, c_x2, c_y2;
_SCREENCOORD_ (xmin, c_xmin)
_SCREENCOORD_ (ymin, c_ymin)
@@ -5606,7 +5606,7 @@
%{ /* NOCONTEXT */
SETWIN(aGLXWindowId)
#ifdef FULL_GLX
- blendcolor(_floatVal(red), _floatVal(green), _floatVal(blue), _floatVal(alpha));
+ blendcolor(_floatVal(red), _floatVal(green), _floatVal(blue), _floatVal(alpha));
#endif
%}
!
@@ -5626,7 +5626,7 @@
%{ /* NOCONTEXT */
SETWIN(aGLXWindowId)
#ifdef GLX
- blink(_shortVal(rate), _colorindexVal(i),
+ blink(_shortVal(rate), _colorindexVal(i),
_shortVal(red), _shortVal(green), _shortVal(blue));
#endif
%}
@@ -6603,7 +6603,7 @@
%{ /* NOCONTEXT */
#ifdef GLX
SETWIN(aGLXWindowId)
- lshaderange(_colorindexVal(lowin), _colorindexVal(hiwin),
+ lshaderange(_colorindexVal(lowin), _colorindexVal(hiwin),
_longVal(znear), _longVal(zfar));
RETURN (true);
#endif
@@ -6820,14 +6820,14 @@
!
glxNurbscurveKnotCount: knotCount knotList: knotList
- offset: offset ctlArray: ctlArray
+ offset: offset ctlArray: ctlArray
order: order type: type in: aGLXWindowId
| ctlPoints i |
ctlPoints := DoubleArray new: ctlArray size * (ctlArray first size).
i := 1.
ctlArray do: [:point |
- point do: [:coord |
+ point do: [:coord |
ctlPoints at: i put: coord.
i := i + 1]].
@@ -6847,7 +6847,7 @@
nurbscurve (
_longVal(knotCount), (double *)knotElements,
- _longVal(offset), (double *)ctlElements,
+ _longVal(offset), (double *)ctlElements,
_longVal(order), _longVal(type));
RETURN(true);
#endif
@@ -7099,7 +7099,7 @@
glxQreadIn: aGLXWindowId
| dev data |
-%{
+%{
short c_data;
SETWIN(aGLXWindowId)
@@ -7139,14 +7139,14 @@
%}
!
-glxRGBcursorIndex: index red: red green: green blue: blue
+glxRGBcursorIndex: index red: red green: green blue: blue
redm: redm greenm: greenm bluem: bluem in: aGLXWindowId
%{ /* NOCONTEXT */
#ifdef GLX
SETWIN(aGLXWindowId)
- RGBcursor(_shortVal(index),
- _shortVal(red), _shortVal(green), _shortVal(blue),
+ RGBcursor(_shortVal(index),
+ _shortVal(red), _shortVal(green), _shortVal(blue),
_shortVal(redm), _shortVal(greenm), _shortVal(bluem));
RETURN (true);
#endif
@@ -7329,7 +7329,7 @@
%{ /* NOCONTEXT */
#ifdef GLX
SETWIN(aGLXWindowId)
- scrmask(_screencoordVal(left), _screencoordVal(right),
+ scrmask(_screencoordVal(left), _screencoordVal(right),
_screencoordVal(bottom), _screencoordVal(top));
RETURN (true);
#endif
@@ -7512,7 +7512,7 @@
%{ /* NOCONTEXT */
#ifdef GLX
SETWIN(aGLXWindowId)
- shaderange(_colorindexVal(lowin), _colorindexVal(hiwin),
+ shaderange(_colorindexVal(lowin), _colorindexVal(hiwin),
_screencoordVal(z1), _screencoordVal(z2));
RETURN (true);
#endif
@@ -7534,13 +7534,13 @@
^ false
!
-glxStencilEnable: enable ref: ref func: func mask: mask fail: fail
+glxStencilEnable: enable ref: ref func: func mask: mask fail: fail
pass: pass zpass: zpass in: aGLXWindowId
%{ /* NOCONTEXT */
#ifdef GLX
SETWIN(aGLXWindowId)
- stencil(_longVal(enable), (ulong)__intVal(ref), _longVal(func),
+ stencil(_longVal(enable), (ulong)__intVal(ref), _longVal(func),
(ulong)__intVal(mask), _longVal(fail), _longVal(pass), _longVal(zpass));
RETURN (true);
#endif
@@ -7658,7 +7658,7 @@
%{ /* NOCONTEXT */
#ifdef GLX
SETWIN(aGLXWindowId)
- textport(_screencoordVal(left), _screencoordVal(right),
+ textport(_screencoordVal(left), _screencoordVal(right),
_screencoordVal(bottom), _screencoordVal(top));
RETURN (true);
#endif
@@ -8442,7 +8442,7 @@
SETWIN(aGLXWindowId)
#ifdef OPENGL
#else
- viewport(_screencoordVal(left), _screencoordVal(right),
+ viewport(_screencoordVal(left), _screencoordVal(right),
_screencoordVal(bottom), _screencoordVal(top));
#endif
%}
@@ -8783,5 +8783,5 @@
!GLXWorkstation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/GLXWorkstation.st,v 1.83 2007-01-18 16:01:50 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/GLXWorkstation.st,v 1.84 2007-01-24 13:41:11 cg Exp $'
! !