aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/games/jogl/impl
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/java/games/jogl/impl')
-rwxr-xr-xsrc/net/java/games/jogl/impl/Project.java88
-rwxr-xr-xsrc/net/java/games/jogl/impl/Util.java2
-rw-r--r--src/net/java/games/jogl/impl/mipmap/Mipmap.java121
-rw-r--r--src/net/java/games/jogl/impl/tesselator/GLUtesselatorImpl.java14
-rw-r--r--src/net/java/games/jogl/impl/x11/X11GLContext.java6
-rw-r--r--src/net/java/games/jogl/impl/x11/X11GLContextFactory.java42
-rw-r--r--src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java2
-rw-r--r--src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java10
8 files changed, 131 insertions, 154 deletions
diff --git a/src/net/java/games/jogl/impl/Project.java b/src/net/java/games/jogl/impl/Project.java
index 60e8d5dad..e0bb03190 100755
--- a/src/net/java/games/jogl/impl/Project.java
+++ b/src/net/java/games/jogl/impl/Project.java
@@ -159,14 +159,13 @@ class Project {
* @param in
* @param out
*/
- private void __gluMultMatrixVecd(double[] matrix, double[] in, double[] out) {
+ private void __gluMultMatrixVecd(double[] matrix, int matrix_offset, double[] in, double[] out) {
for (int i = 0; i < 4; i++) {
out[i] =
- in[0] * matrix[0*4+i] +
- in[1] * matrix[1*4+i] +
- in[2] * matrix[2*4+i] +
- in[3] * matrix[3*4+i];
-
+ in[0] * matrix[0*4+i+matrix_offset] +
+ in[1] * matrix[1*4+i+matrix_offset] +
+ in[2] * matrix[2*4+i+matrix_offset] +
+ in[3] * matrix[3*4+i+matrix_offset];
}
}
@@ -245,14 +244,14 @@ class Project {
* @param b
* @param r
*/
- private void __gluMultMatricesd(double[] a, double[] b, double[] r) {
+ private void __gluMultMatricesd(double[] a, int a_offset, double[] b, int b_offset, double[] r) {
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
r[i*4+j] =
- a[i*4+0]*b[0*4+j] +
- a[i*4+1]*b[1*4+j] +
- a[i*4+2]*b[2*4+j] +
- a[i*4+3]*b[3*4+j];
+ a[i*4+0+a_offset]*b[0*4+j+b_offset] +
+ a[i*4+1+a_offset]*b[1*4+j+b_offset] +
+ a[i*4+2+a_offset]*b[2*4+j+b_offset] +
+ a[i*4+3+a_offset]*b[3*4+j+b_offset];
}
}
}
@@ -414,9 +413,13 @@ class Project {
double objy,
double objz,
double[] modelMatrix,
+ int modelMatrix_offset,
double[] projMatrix,
+ int projMatrix_offset,
int[] viewport,
- double[] win_pos) {
+ int viewport_offset,
+ double[] win_pos,
+ int win_pos_offset ) {
double[] in = this.in;
double[] out = this.out;
@@ -426,8 +429,8 @@ class Project {
in[2] = objz;
in[3] = 1.0;
- __gluMultMatrixVecd(modelMatrix, in, out);
- __gluMultMatrixVecd(projMatrix, out, in);
+ __gluMultMatrixVecd(modelMatrix, modelMatrix_offset, in, out);
+ __gluMultMatrixVecd(projMatrix, projMatrix_offset, out, in);
if (in[3] == 0.0)
return false;
@@ -440,9 +443,9 @@ class Project {
in[2] = in[2] * in[3] + 0.5f;
// Map x,y to viewport
- win_pos[0] = in[0] * viewport[2] + viewport[0];
- win_pos[1] = in[1] * viewport[3] + viewport[1];
- win_pos[2] = in[2];
+ win_pos[0+win_pos_offset] = in[0] * viewport[2+viewport_offset] + viewport[0+viewport_offset];
+ win_pos[1+win_pos_offset] = in[1] * viewport[3+viewport_offset] + viewport[1+viewport_offset];
+ win_pos[2+win_pos_offset] = in[2];
return true;
}
@@ -464,13 +467,17 @@ class Project {
double winy,
double winz,
double[] modelMatrix,
+ int modelMatrix_offset,
double[] projMatrix,
+ int projMatrix_offset,
int[] viewport,
- double[] obj_pos) {
+ int viewport_offset,
+ double[] obj_pos,
+ int obj_pos_offset) {
double[] in = this.in;
double[] out = this.out;
- __gluMultMatricesd(modelMatrix, projMatrix, finalMatrix);
+ __gluMultMatricesd(modelMatrix, modelMatrix_offset, projMatrix, projMatrix_offset, finalMatrix);
if (!__gluInvertMatrixd(finalMatrix, finalMatrix))
return false;
@@ -481,24 +488,24 @@ class Project {
in[3] = 1.0;
// Map x and y from window coordinates
- in[0] = (in[0] - viewport[0]) / viewport[2];
- in[1] = (in[1] - viewport[1]) / viewport[3];
+ in[0] = (in[0] - viewport[0+viewport_offset]) / viewport[2+viewport_offset];
+ in[1] = (in[1] - viewport[1+viewport_offset]) / viewport[3+viewport_offset];
// Map to range -1 to 1
in[0] = in[0] * 2 - 1;
in[1] = in[1] * 2 - 1;
in[2] = in[2] * 2 - 1;
- __gluMultMatrixVecd(finalMatrix, in, out);
+ __gluMultMatrixVecd(finalMatrix, 0, in, out);
if (out[3] == 0.0)
return false;
out[3] = 1.0 / out[3];
- obj_pos[0] = out[0] * out[3];
- obj_pos[1] = out[1] * out[3];
- obj_pos[2] = out[2] * out[3];
+ obj_pos[0+obj_pos_offset] = out[0] * out[3];
+ obj_pos[1+obj_pos_offset] = out[1] * out[3];
+ obj_pos[2+obj_pos_offset] = out[2] * out[3];
return true;
}
@@ -524,15 +531,19 @@ class Project {
double winz,
double clipw,
double[] modelMatrix,
+ int modelMatrix_offset,
double[] projMatrix,
+ int projMatrix_offset,
int[] viewport,
+ int viewport_offset,
double near,
double far,
- double[] obj_pos) {
+ double[] obj_pos,
+ int obj_pos_offset ) {
double[] in = this.in;
double[] out = this.out;
- __gluMultMatricesd(modelMatrix, projMatrix, finalMatrix);
+ __gluMultMatricesd(modelMatrix, modelMatrix_offset, projMatrix, projMatrix_offset, finalMatrix);
if (!__gluInvertMatrixd(finalMatrix, finalMatrix))
return false;
@@ -543,8 +554,8 @@ class Project {
in[3] = clipw;
// Map x and y from window coordinates
- in[0] = (in[0] - viewport[0]) / viewport[2];
- in[1] = (in[1] - viewport[1]) / viewport[3];
+ in[0] = (in[0] - viewport[0+viewport_offset]) / viewport[2+viewport_offset];
+ in[1] = (in[1] - viewport[1+viewport_offset]) / viewport[3+viewport_offset];
in[2] = (in[2] - near) / (far - near);
// Map to range -1 to 1
@@ -552,15 +563,15 @@ class Project {
in[1] = in[1] * 2 - 1;
in[2] = in[2] * 2 - 1;
- __gluMultMatrixVecd(finalMatrix, in, out);
+ __gluMultMatrixVecd(finalMatrix, 0, in, out);
if (out[3] == 0.0)
return false;
- obj_pos[0] = out[0];
- obj_pos[1] = out[1];
- obj_pos[2] = out[2];
- obj_pos[3] = out[3];
+ obj_pos[0+obj_pos_offset] = out[0];
+ obj_pos[1+obj_pos_offset] = out[1];
+ obj_pos[2+obj_pos_offset] = out[2];
+ obj_pos[3+obj_pos_offset] = out[3];
return true;
}
@@ -578,15 +589,16 @@ class Project {
double y,
double deltaX,
double deltaY,
- int[] viewport) {
+ int[] viewport,
+ int viewport_offset) {
if (deltaX <= 0 || deltaY <= 0) {
return;
}
/* Translate and scale the picked region to the entire window */
- gl.glTranslated((viewport[2] - 2 * (x - viewport[0])) / deltaX,
- (viewport[3] - 2 * (y - viewport[1])) / deltaY,
+ gl.glTranslated((viewport[2+viewport_offset] - 2 * (x - viewport[0+viewport_offset])) / deltaX,
+ (viewport[3+viewport_offset] - 2 * (y - viewport[1+viewport_offset])) / deltaY,
0);
- gl.glScaled(viewport[2] / deltaX, viewport[3] / deltaY, 1.0);
+ gl.glScaled(viewport[2+viewport_offset] / deltaX, viewport[3+viewport_offset] / deltaY, 1.0);
}
}
diff --git a/src/net/java/games/jogl/impl/Util.java b/src/net/java/games/jogl/impl/Util.java
index 80a5d1232..1b2f9ed9f 100755
--- a/src/net/java/games/jogl/impl/Util.java
+++ b/src/net/java/games/jogl/impl/Util.java
@@ -236,7 +236,7 @@ class Util {
* @return int
*/
protected int glGetIntegerv(GL gl, int what) {
- gl.glGetIntegerv(what, scratch);
+ gl.glGetIntegerv(what, scratch, 0);
return scratch[0];
}
}
diff --git a/src/net/java/games/jogl/impl/mipmap/Mipmap.java b/src/net/java/games/jogl/impl/mipmap/Mipmap.java
index a66edfc44..63cf760e2 100644
--- a/src/net/java/games/jogl/impl/mipmap/Mipmap.java
+++ b/src/net/java/games/jogl/impl/mipmap/Mipmap.java
@@ -257,7 +257,7 @@ public class Mipmap {
if( target == GL.GL_TEXTURE_2D || target == GL.GL_PROXY_TEXTURE_2D ) {
proxyTarget = GL.GL_PROXY_TEXTURE_2D;
gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne,
- heightAtLevelOne, 0, format, type, (double[])null );
+ heightAtLevelOne, 0, format, type, (double[])null, 0);
} else if( (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB) ||
(target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB) ||
(target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB) ||
@@ -266,14 +266,14 @@ public class Mipmap {
(target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) ) {
proxyTarget = GL.GL_PROXY_TEXTURE_CUBE_MAP_ARB;
gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne,
- heightAtLevelOne, 0, format, type, (double[])null );
+ heightAtLevelOne, 0, format, type, (double[])null , 0);
} else {
assert( target == GL.GL_TEXTURE_1D || target == GL.GL_PROXY_TEXTURE_1D );
proxyTarget = GL.GL_PROXY_TEXTURE_1D;
gl.glTexImage1D( proxyTarget, 1, internalFormat, widthAtLevelOne,
- 0, format, type, (double[])null );
+ 0, format, type, (double[])null, 0);
}
- gl.glGetTexLevelParameteriv( proxyTarget, 1, GL.GL_TEXTURE_WIDTH, proxyWidth );
+ gl.glGetTexLevelParameteriv( proxyTarget, 1, GL.GL_TEXTURE_WIDTH, proxyWidth, 0 );
// does it fit?
if( proxyWidth[0] == 0 ) { // nope, so try again with theses sizes
if( widthPowerOf2 == 1 && heightPowerOf2 == 1 ) {
@@ -299,7 +299,7 @@ public class Mipmap {
}
}
int[] maxsize = new int[1];
- gl.glGetIntegerv( GL.GL_MAX_TEXTURE_SIZE, maxsize );
+ gl.glGetIntegerv( GL.GL_MAX_TEXTURE_SIZE, maxsize , 0);
// clamp user's texture sizes to maximum sizes, if necessary
newWidth[0] = nearestPower( width );
if( newWidth[0] > maxsize[0] ) {
@@ -333,9 +333,9 @@ public class Mipmap {
if( target == GL.GL_TEXTURE_3D || target == GL.GL_PROXY_TEXTURE_3D ) {
proxyTarget = GL.GL_PROXY_TEXTURE_3D;
gl.glTexImage3D( proxyTarget, 1, internalFormat, widthAtLevelOne,
- heightAtLevelOne, depthAtLevelOne, 0, format, type, (double[])null );
+ heightAtLevelOne, depthAtLevelOne, 0, format, type, (double[])null, 0 );
}
- gl.glGetTexLevelParameteriv( proxyTarget, 1, GL.GL_TEXTURE_WIDTH, proxyWidth );
+ gl.glGetTexLevelParameteriv( proxyTarget, 1, GL.GL_TEXTURE_WIDTH, proxyWidth, 0 );
// does it fit
if( proxyWidth[0] == 0 ) {
if( widthPowerOf2 == 1 && heightPowerOf2 == 1 && depthPowerOf2 == 1 ) {
@@ -454,67 +454,67 @@ public class Mipmap {
public static void retrieveStoreModes( GL gl, PixelStorageModes psm ) {
int[] a = new int[1];
- gl.glGetIntegerv( GL.GL_UNPACK_ALIGNMENT, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_ALIGNMENT, a, 0);
psm.setUnpackAlignment( a[0] );
- gl.glGetIntegerv( GL.GL_UNPACK_ROW_LENGTH, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_ROW_LENGTH, a, 0);
psm.setUnpackRowLength( a[0] );
- gl.glGetIntegerv( GL.GL_UNPACK_SKIP_ROWS, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_SKIP_ROWS, a, 0);
psm.setUnpackSkipRows( a[0] );
- gl.glGetIntegerv( GL.GL_UNPACK_SKIP_PIXELS, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_SKIP_PIXELS, a, 0);
psm.setUnpackSkipPixels( a[0] );
- gl.glGetIntegerv( GL.GL_UNPACK_LSB_FIRST, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_LSB_FIRST, a, 0);
psm.setUnpackLsbFirst( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL.GL_UNPACK_SWAP_BYTES, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_SWAP_BYTES, a, 0);
psm.setUnpackSwapBytes( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL.GL_PACK_ALIGNMENT, a );
+ gl.glGetIntegerv( GL.GL_PACK_ALIGNMENT, a, 0);
psm.setPackAlignment( a[0] );
- gl.glGetIntegerv( GL.GL_PACK_ROW_LENGTH, a );
+ gl.glGetIntegerv( GL.GL_PACK_ROW_LENGTH, a, 0);
psm.setPackRowLength( a[0] );
- gl.glGetIntegerv( GL.GL_PACK_SKIP_ROWS, a );
+ gl.glGetIntegerv( GL.GL_PACK_SKIP_ROWS, a, 0);
psm.setPackSkipRows( a[0] );
- gl.glGetIntegerv( GL.GL_PACK_SKIP_PIXELS, a );
+ gl.glGetIntegerv( GL.GL_PACK_SKIP_PIXELS, a, 0);
psm.setPackSkipPixels( a[0] );
- gl.glGetIntegerv( GL.GL_PACK_LSB_FIRST, a );
+ gl.glGetIntegerv( GL.GL_PACK_LSB_FIRST, a, 0);
psm.setPackLsbFirst( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL.GL_PACK_SWAP_BYTES, a );
+ gl.glGetIntegerv( GL.GL_PACK_SWAP_BYTES, a, 0);
psm.setPackSwapBytes( ( a[0] == 1 ) );
}
public static void retrieveStoreModes3D( GL gl, PixelStorageModes psm ) {
int[] a = new int[1];
- gl.glGetIntegerv( GL.GL_UNPACK_ALIGNMENT, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_ALIGNMENT, a, 0);
psm.setUnpackAlignment( a[0] );
- gl.glGetIntegerv( GL.GL_UNPACK_ROW_LENGTH, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_ROW_LENGTH, a, 0);
psm.setUnpackRowLength( a[0] );
- gl.glGetIntegerv( GL.GL_UNPACK_SKIP_ROWS, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_SKIP_ROWS, a, 0);
psm.setUnpackSkipRows( a[0] );
- gl.glGetIntegerv( GL.GL_UNPACK_SKIP_PIXELS, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_SKIP_PIXELS, a, 0);
psm.setUnpackSkipPixels( a[0] );
- gl.glGetIntegerv( GL.GL_UNPACK_LSB_FIRST, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_LSB_FIRST, a, 0);
psm.setUnpackLsbFirst( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL.GL_UNPACK_SWAP_BYTES, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_SWAP_BYTES, a, 0);
psm.setUnpackSwapBytes( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL.GL_UNPACK_SKIP_IMAGES, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_SKIP_IMAGES, a, 0);
psm.setUnpackSkipImages( a[0] );
- gl.glGetIntegerv( GL.GL_UNPACK_IMAGE_HEIGHT, a );
+ gl.glGetIntegerv( GL.GL_UNPACK_IMAGE_HEIGHT, a, 0);
psm.setUnpackImageHeight( a[0] );
- gl.glGetIntegerv( GL.GL_PACK_ALIGNMENT, a );
+ gl.glGetIntegerv( GL.GL_PACK_ALIGNMENT, a, 0);
psm.setPackAlignment( a[0] );
- gl.glGetIntegerv( GL.GL_PACK_ROW_LENGTH, a );
+ gl.glGetIntegerv( GL.GL_PACK_ROW_LENGTH, a, 0);
psm.setPackRowLength( a[0] );
- gl.glGetIntegerv( GL.GL_PACK_SKIP_ROWS, a );
+ gl.glGetIntegerv( GL.GL_PACK_SKIP_ROWS, a, 0);
psm.setPackSkipRows( a[0] );
- gl.glGetIntegerv( GL.GL_PACK_SKIP_PIXELS, a );
+ gl.glGetIntegerv( GL.GL_PACK_SKIP_PIXELS, a, 0 );
psm.setPackSkipPixels( a[0] );
- gl.glGetIntegerv( GL.GL_PACK_LSB_FIRST, a );
+ gl.glGetIntegerv( GL.GL_PACK_LSB_FIRST, a, 0 );
psm.setPackLsbFirst( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL.GL_PACK_SWAP_BYTES, a );
+ gl.glGetIntegerv( GL.GL_PACK_SWAP_BYTES, a, 0 );
psm.setPackSwapBytes( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL.GL_PACK_SKIP_IMAGES, a );
+ gl.glGetIntegerv( GL.GL_PACK_SKIP_IMAGES, a, 0 );
psm.setPackSkipImages( a[0] );
- gl.glGetIntegerv( GL.GL_PACK_IMAGE_HEIGHT, a );
+ gl.glGetIntegerv( GL.GL_PACK_IMAGE_HEIGHT, a, 0 );
psm.setPackImageHeight( a[0] );
}
@@ -602,7 +602,8 @@ public class Mipmap {
return( BuildMipmap.gluBuild1DMipmapLevelsCore( gl, target, internalFormat,
width, widthPowerOf2[0], format, type, 0, 0, levels, data ) );
}
-
+
+
public static int gluBuild2DMipmapLevels( GL gl, int target, int internalFormat,
int width, int height, int format, int type, int userLevel,
int baseLevel, int maxLevel, Object data ) {
@@ -632,32 +633,14 @@ public class Mipmap {
ByteBuffer buffer = null;
if( data instanceof ByteBuffer ) {
buffer = (ByteBuffer)data;
- } else if( data instanceof byte[] ) {
- byte[] array = (byte[])data;
- buffer = ByteBuffer.allocateDirect(array.length);
- buffer.put(array);
- } else if( data instanceof short[] ) {
- short[] array = (short[])data;
- buffer = ByteBuffer.allocateDirect( array.length * 2 );
- ShortBuffer sb = buffer.asShortBuffer();
- sb.put( array );
- } else if( data instanceof int[] ) {
- int[] array = (int[])data;
- buffer = ByteBuffer.allocateDirect( array.length * 4 );
- IntBuffer ib = buffer.asIntBuffer();
- ib.put( array );
- } else if( data instanceof float[] ) {
- float[] array = (float[])data;
- buffer = ByteBuffer.allocateDirect( array.length * 4 );
- FloatBuffer fb = buffer.asFloatBuffer();
- fb.put( array );
- }
+ }
return( BuildMipmap.gluBuild2DMipmapLevelsCore( gl, target, internalFormat,
width, height, width, height, format, type, userLevel, baseLevel,
maxLevel, buffer ) );
}
-
+
+
public static int gluBuild2DMipmaps( GL gl, int target, int internalFormat,
int width, int height, int format, int type, Object data ) {
int[] widthPowerOf2 = new int[1];
@@ -686,32 +669,14 @@ public class Mipmap {
ByteBuffer buffer = null;
if( data instanceof ByteBuffer ) {
buffer = (ByteBuffer)data;
- } else if( data instanceof byte[] ) {
- byte[] array = (byte[])data;
- buffer = ByteBuffer.allocateDirect(array.length);
- buffer.put(array);
- } else if( data instanceof short[] ) {
- short[] array = (short[])data;
- buffer = ByteBuffer.allocateDirect( array.length * 2 );
- ShortBuffer sb = buffer.asShortBuffer();
- sb.put( array );
- } else if( data instanceof int[] ) {
- int[] array = (int[])data;
- buffer = ByteBuffer.allocateDirect( array.length * 4 );
- IntBuffer ib = buffer.asIntBuffer();
- ib.put( array );
- } else if( data instanceof float[] ) {
- float[] array = (float[])data;
- buffer = ByteBuffer.allocateDirect( array.length * 4 );
- FloatBuffer fb = buffer.asFloatBuffer();
- fb.put( array );
- }
+ }
return( BuildMipmap.gluBuild2DMipmapLevelsCore( gl, target, internalFormat,
width, height, widthPowerOf2[0], heightPowerOf2[0], format, type, 0,
0, levels, buffer ) );
}
-
+
+
public static int gluBuild3DMipmaps( GL gl, int target, int internalFormat,
int width, int height, int depth, int format, int type, ByteBuffer data ) {
int[] widthPowerOf2 = new int[1];
diff --git a/src/net/java/games/jogl/impl/tesselator/GLUtesselatorImpl.java b/src/net/java/games/jogl/impl/tesselator/GLUtesselatorImpl.java
index 90de5bcc9..34638ba51 100644
--- a/src/net/java/games/jogl/impl/tesselator/GLUtesselatorImpl.java
+++ b/src/net/java/games/jogl/impl/tesselator/GLUtesselatorImpl.java
@@ -231,12 +231,12 @@ public class GLUtesselatorImpl implements GLUtesselator {
}
/* Returns tessellator property */
- public void gluGetTessProperty(int which, double[] value) {
+ public void gluGetTessProperty(int which, double[] value, int value_offset) {
switch (which) {
case GLU.GLU_TESS_TOLERANCE:
/* tolerance should be in range [0..1] */
assert (0.0 <= relTolerance && relTolerance <= 1.0);
- value[0] = relTolerance;
+ value[value_offset] = relTolerance;
break;
case GLU.GLU_TESS_WINDING_RULE:
assert (windingRule == GLU.GLU_TESS_WINDING_ODD ||
@@ -244,14 +244,14 @@ public class GLUtesselatorImpl implements GLUtesselator {
windingRule == GLU.GLU_TESS_WINDING_POSITIVE ||
windingRule == GLU.GLU_TESS_WINDING_NEGATIVE ||
windingRule == GLU.GLU_TESS_WINDING_ABS_GEQ_TWO);
- value[0] = windingRule;
+ value[value_offset] = windingRule;
break;
case GLU.GLU_TESS_BOUNDARY_ONLY:
assert (boundaryOnly == true || boundaryOnly == false);
- value[0] = boundaryOnly ? 1 : 0;
+ value[value_offset] = boundaryOnly ? 1 : 0;
break;
default:
- value[0] = 0.0;
+ value[value_offset] = 0.0;
callErrorOrErrorData(GLU.GLU_INVALID_ENUM);
break;
}
@@ -386,7 +386,7 @@ public class GLUtesselatorImpl implements GLUtesselator {
return true;
}
- public void gluTessVertex(double[] coords, Object vertexData) {
+ public void gluTessVertex(double[] coords, int coords_offset, Object vertexData) {
int i;
boolean tooLarge = false;
double x;
@@ -402,7 +402,7 @@ public class GLUtesselatorImpl implements GLUtesselator {
lastEdge = null;
}
for (i = 0; i < 3; ++i) {
- x = coords[i];
+ x = coords[i+coords_offset];
if (x < -GLU.GLU_TESS_MAX_COORD) {
x = -GLU.GLU_TESS_MAX_COORD;
tooLarge = true;
diff --git a/src/net/java/games/jogl/impl/x11/X11GLContext.java b/src/net/java/games/jogl/impl/x11/X11GLContext.java
index 4709691f8..22d6c5237 100644
--- a/src/net/java/games/jogl/impl/x11/X11GLContext.java
+++ b/src/net/java/games/jogl/impl/x11/X11GLContext.java
@@ -234,7 +234,7 @@ public abstract class X11GLContext extends GLContext {
}
int[] major = new int[1];
int[] minor = new int[1];
- if (!GLX.glXQueryVersion(display, major, minor)) {
+ if (!GLX.glXQueryVersion(display, major, 0, minor, 0)) {
throw new GLException("glXQueryVersion failed");
}
if (DEBUG) {
@@ -333,7 +333,7 @@ public abstract class X11GLContext extends GLContext {
XVisualInfo template = new XVisualInfo();
// FIXME: probably not 64-bit clean
template.visualid((int) visualID);
- XVisualInfo[] infos = GLX.XGetVisualInfo(display, GLX.VisualIDMask, template, count);
+ XVisualInfo[] infos = GLX.XGetVisualInfo(display, GLX.VisualIDMask, template, count, 0);
if (infos == null || infos.length == 0) {
throw new GLException("Error while getting XVisualInfo for visual ID " + visualID);
}
@@ -352,7 +352,7 @@ public abstract class X11GLContext extends GLContext {
int[] count = new int[1];
XVisualInfo template = new XVisualInfo();
template.screen(screen);
- XVisualInfo[] infos = GLX.XGetVisualInfo(display, GLX.VisualScreenMask, template, count);
+ XVisualInfo[] infos = GLX.XGetVisualInfo(display, GLX.VisualScreenMask, template, count, 0);
if (infos == null) {
throw new GLException("Error while enumerating available XVisualInfos");
}
diff --git a/src/net/java/games/jogl/impl/x11/X11GLContextFactory.java b/src/net/java/games/jogl/impl/x11/X11GLContextFactory.java
index 3582d51d9..6d7d6f372 100644
--- a/src/net/java/games/jogl/impl/x11/X11GLContextFactory.java
+++ b/src/net/java/games/jogl/impl/x11/X11GLContextFactory.java
@@ -62,12 +62,12 @@ public class X11GLContextFactory extends GLContextFactory {
int[] attribs = glCapabilities2AttribList(capabilities, isMultisampleAvailable());
long display = getDisplayConnection();
- XVisualInfo recommendedVis = GLX.glXChooseVisual(display, screen, attribs);
+ XVisualInfo recommendedVis = GLX.glXChooseVisual(display, screen, attribs, 0);
int recommendedIndex = -1;
int[] count = new int[1];
XVisualInfo template = new XVisualInfo();
template.screen(screen);
- XVisualInfo[] infos = GLX.XGetVisualInfo(display, GLX.VisualScreenMask, template, count);
+ XVisualInfo[] infos = GLX.XGetVisualInfo(display, GLX.VisualScreenMask, template, count, 0);
if (infos == null) {
throw new GLException("Error while enumerating available XVisualInfos");
}
@@ -125,37 +125,37 @@ public class X11GLContextFactory extends GLContextFactory {
public static GLCapabilities xvi2GLCapabilities(long display, XVisualInfo info) {
int[] tmp = new int[1];
- int val = glXGetConfig(display, info, GLX.GLX_USE_GL, tmp);
+ int val = glXGetConfig(display, info, GLX.GLX_USE_GL, tmp, 0);
if (val == 0) {
// Visual does not support OpenGL
return null;
}
- val = glXGetConfig(display, info, GLX.GLX_RGBA, tmp);
+ val = glXGetConfig(display, info, GLX.GLX_RGBA, tmp, 0);
if (val == 0) {
// Visual does not support RGBA
return null;
}
GLCapabilities res = new GLCapabilities();
- res.setDoubleBuffered(glXGetConfig(display, info, GLX.GLX_DOUBLEBUFFER, tmp) != 0);
- res.setStereo (glXGetConfig(display, info, GLX.GLX_STEREO, tmp) != 0);
+ res.setDoubleBuffered(glXGetConfig(display, info, GLX.GLX_DOUBLEBUFFER, tmp, 0) != 0);
+ res.setStereo (glXGetConfig(display, info, GLX.GLX_STEREO, tmp, 0) != 0);
// Note: use of hardware acceleration is determined by
// glXCreateContext, not by the XVisualInfo. Optimistically claim
// that all GLCapabilities have the capability to be hardware
// accelerated.
res.setHardwareAccelerated(true);
- res.setDepthBits (glXGetConfig(display, info, GLX.GLX_DEPTH_SIZE, tmp));
- res.setStencilBits (glXGetConfig(display, info, GLX.GLX_STENCIL_SIZE, tmp));
- res.setRedBits (glXGetConfig(display, info, GLX.GLX_RED_SIZE, tmp));
- res.setGreenBits (glXGetConfig(display, info, GLX.GLX_GREEN_SIZE, tmp));
- res.setBlueBits (glXGetConfig(display, info, GLX.GLX_BLUE_SIZE, tmp));
- res.setAlphaBits (glXGetConfig(display, info, GLX.GLX_ALPHA_SIZE, tmp));
- res.setAccumRedBits (glXGetConfig(display, info, GLX.GLX_ACCUM_RED_SIZE, tmp));
- res.setAccumGreenBits(glXGetConfig(display, info, GLX.GLX_ACCUM_GREEN_SIZE, tmp));
- res.setAccumBlueBits (glXGetConfig(display, info, GLX.GLX_ACCUM_BLUE_SIZE, tmp));
- res.setAccumAlphaBits(glXGetConfig(display, info, GLX.GLX_ACCUM_ALPHA_SIZE, tmp));
+ res.setDepthBits (glXGetConfig(display, info, GLX.GLX_DEPTH_SIZE, tmp, 0));
+ res.setStencilBits (glXGetConfig(display, info, GLX.GLX_STENCIL_SIZE, tmp, 0));
+ res.setRedBits (glXGetConfig(display, info, GLX.GLX_RED_SIZE, tmp, 0));
+ res.setGreenBits (glXGetConfig(display, info, GLX.GLX_GREEN_SIZE, tmp, 0));
+ res.setBlueBits (glXGetConfig(display, info, GLX.GLX_BLUE_SIZE, tmp, 0));
+ res.setAlphaBits (glXGetConfig(display, info, GLX.GLX_ALPHA_SIZE, tmp, 0));
+ res.setAccumRedBits (glXGetConfig(display, info, GLX.GLX_ACCUM_RED_SIZE, tmp, 0));
+ res.setAccumGreenBits(glXGetConfig(display, info, GLX.GLX_ACCUM_GREEN_SIZE, tmp, 0));
+ res.setAccumBlueBits (glXGetConfig(display, info, GLX.GLX_ACCUM_BLUE_SIZE, tmp, 0));
+ res.setAccumAlphaBits(glXGetConfig(display, info, GLX.GLX_ACCUM_ALPHA_SIZE, tmp, 0));
if (isMultisampleAvailable()) {
- res.setSampleBuffers(glXGetConfig(display, info, GLX.GLX_SAMPLE_BUFFERS_ARB, tmp) != 0);
- res.setNumSamples (glXGetConfig(display, info, GLX.GLX_SAMPLES_ARB, tmp));
+ res.setSampleBuffers(glXGetConfig(display, info, GLX.GLX_SAMPLE_BUFFERS_ARB, tmp, 0) != 0);
+ res.setNumSamples (glXGetConfig(display, info, GLX.GLX_SAMPLES_ARB, tmp, 0));
}
return res;
}
@@ -241,14 +241,14 @@ public class X11GLContextFactory extends GLContextFactory {
}
}
- public static int glXGetConfig(long display, XVisualInfo info, int attrib, int[] tmp) {
+ public static int glXGetConfig(long display, XVisualInfo info, int attrib, int[] tmp, int tmp_offset) {
if (display == 0) {
throw new GLException("No display connection");
}
- int res = GLX.glXGetConfig(display, info, attrib, tmp);
+ int res = GLX.glXGetConfig(display, info, attrib, tmp, tmp_offset);
if (res != 0) {
throw new GLException("glXGetConfig failed: error code " + glXGetConfigErrorCode(res));
}
- return tmp[0];
+ return tmp[tmp_offset];
}
}
diff --git a/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java b/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java
index a22367091..343a69f07 100644
--- a/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java
+++ b/src/net/java/games/jogl/impl/x11/X11OffscreenGLContext.java
@@ -164,7 +164,7 @@ public class X11OffscreenGLContext extends X11GLContext {
if (context == 0) {
throw new GLException("Unable to create OpenGL context");
}
- isDoubleBuffered = (X11GLContextFactory.glXGetConfig(display, vis, GLX.GLX_DOUBLEBUFFER, new int[1]) != 0);
+ isDoubleBuffered = (X11GLContextFactory.glXGetConfig(display, vis, GLX.GLX_DOUBLEBUFFER, new int[1], 0) != 0);
}
protected void destroyImpl() {
diff --git a/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java b/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java
index 5b6df1843..5e59329ca 100644
--- a/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java
+++ b/src/net/java/games/jogl/impl/x11/X11PbufferGLContext.java
@@ -174,7 +174,7 @@ public class X11PbufferGLContext extends X11GLContext {
int screen = 0; // FIXME: provide way to specify this?
int[] nelementsTmp = new int[1];
- GLXFBConfig[] fbConfigs = GLX.glXChooseFBConfig(display, screen, iattributes, nelementsTmp);
+ GLXFBConfig[] fbConfigs = GLX.glXChooseFBConfig(display, screen, iattributes, 0, nelementsTmp, 0);
if (fbConfigs == null || fbConfigs.length == 0 || fbConfigs[0] == null) {
throw new GLException("pbuffer creation error: glXChooseFBConfig() failed");
}
@@ -209,7 +209,7 @@ public class X11PbufferGLContext extends X11GLContext {
iattributes[niattribs++] = 0;
- long tmpBuffer = GLX.glXCreatePbuffer(display, fbConfig, iattributes);
+ long tmpBuffer = GLX.glXCreatePbuffer(display, fbConfig, iattributes, 0);
if (tmpBuffer == 0) {
// FIXME: query X error code for detail error message
throw new GLException("pbuffer creation error: glXCreatePbuffer() failed");
@@ -224,9 +224,9 @@ public class X11PbufferGLContext extends X11GLContext {
// Determine the actual width and height we were able to create.
int[] tmp = new int[1];
- GLX.glXQueryDrawable(display, (int) buffer, GL.GLX_WIDTH, tmp);
+ GLX.glXQueryDrawable(display, (int) buffer, GL.GLX_WIDTH, tmp, 0);
width = tmp[0];
- GLX.glXQueryDrawable(display, (int) buffer, GL.GLX_HEIGHT, tmp);
+ GLX.glXQueryDrawable(display, (int) buffer, GL.GLX_HEIGHT, tmp, 0);
height = tmp[0];
if (DEBUG) {
@@ -334,7 +334,7 @@ public class X11PbufferGLContext extends X11GLContext {
private int queryFBConfig(long display, GLXFBConfig fbConfig, int attrib) {
int[] tmp = new int[1];
- if (GLX.glXGetFBConfigAttrib(display, fbConfig, attrib, tmp) != 0) {
+ if (GLX.glXGetFBConfigAttrib(display, fbConfig, attrib, tmp, 0) != 0) {
throw new GLException("glXGetFBConfigAttrib failed");
}
return tmp[0];