diff options
author | Travis Bryson <[email protected]> | 2005-06-24 20:28:37 +0000 |
---|---|---|
committer | Travis Bryson <[email protected]> | 2005-06-24 20:28:37 +0000 |
commit | 0969a98f2007d76e38f8819eedfead5b840f6364 (patch) | |
tree | 82aff6a7fb922f45fc7853e5c5442af0d978768f /src/net/java/games/jogl/impl/x11 | |
parent | ed85f53f73d69a44c6b98b3824354be3fbb7bf58 (diff) |
This putback adds array offsets to the public JOGL API. The offsets are
respected and used properly in all of the public and private functions. The
changes are in gluegen, so that the code is generated properly. And also
throughout the parts of the jogl code that are not gluegen-generated.
For the internally generated implementation methods, a "1" is added to
the method names. So as to not overload the public API. This is similar
to what is already done with Buffer APIs, which have a "0" added
internally. I used a "1" instead of a "0" to avoid any collisions of the
signatures, which could happen if a null object was sent down for the
Array (e.g., the wrong method would get called).
This should be a suitable foundation for the implementation to add the
ability to wrap arrays in Buffers, which we plan to add to the implementation
soon.
These changes will cause all existing JOGL programs to break, although
adapting them is pretty easy. We will later be putting back changed examples
and utilities that incorporate these new APIs.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JSR-231@313 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java/games/jogl/impl/x11')
4 files changed, 30 insertions, 30 deletions
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]; |