Dear Java3D developers,
For the ones that can't wait for stereo to work :-)
I have made a patch for Java3D so that stereo mode works for the
SGI/IRIX version of j3d (version 1.1.1 of the Java 3DTM API Edition).
The patch is dynamic in the sense that the OpenGL call 'glDrawBuffer' is
'overloaded' by my implementation.
What to do?
You only have to Make the bootstereo.c. This will create a shared
object: bootstereo.so.
Normally you would call:
'java -Dj3d.stereo=PREFERRED HelloWorld'
to start HelloWorld in stereo
Now you have to call:
'_RLDN32_LIST=`pwd`/bootstereo.so:DEFAULT java -Dj3d.stereo=PREFERRED
HelloWorld'
to start HelloWorld in stereo fixed.
Note that this is only a temporary solution. We'll have to wait for SGI
for a clean fix.
Robbert van Dalen..
(Attached is a compiled bootstereo.so)
These are the files:
FILE bootstereo.c:
__________
/*
* Ugly IRIX OpenGL patch for clearing the z buffer
* when selecting glDrawBuffer(GL_BACK_RIGHT)
* author: Robbert van Dalen
* (Very usefull for patching j3d for IRIX)
*/
#include <stdio.h>
#include <GL/glx.h>
#include <dlfcn.h>
#include <fcntl.h>
void (*_glDrawBeffer) (GLenum);
void glDrawBuffer( GLenum mode ) {
static int firsttime = 0;
if (firsttime == 0) {
_glDrawBeffer = NULL;
void *handle = dlopen("libGL.so", RTLD_NOW);
if (handle == NULL) fprintf(stderr, "error %s, could not
open\n", dlerror());
_glDrawBeffer = (void (*)(GLenum))dlsym(handle,
"glDrawBuffer");
if (_glDrawBeffer == NULL) fprintf(stderr, "error %s,
cannot find\n", dlerror());
firsttime = 1;
if (_glDrawBeffer != NULL) {
fprintf(stderr, "Patched glDrawBuffer.\n");
}
}
if (_glDrawBeffer != NULL) {
if (mode == GL_BACK_RIGHT) {
glClear(GL_DEPTH_BUFFER_BIT);
}
_glDrawBeffer(mode);
return;
}
// Do nothing if glDrawBuffer function is not found
}
_________________________
File: Makefile
CC = CC
CFLAGS = -n32 -mips3 \
-I. \
-I/usr/include/GL
all: bootstereo
bootstereo.o: bootstereo.c
$(CC) $(CFLAGS) -c bootstereo.c
bootstereo: bootstereo.o
ld -n32 -shared -all -o bootstereo.so bootstereo.o
clean:
rm *.o *.so
____________________________________
bootstereo.so