summaryrefslogtreecommitdiffstats
path: root/make
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2006-07-21 22:34:00 +0000
committerKenneth Russel <[email protected]>2006-07-21 22:34:00 +0000
commite552d800ee9df3761108c044342612c8bda1f304 (patch)
tree690a4a58c5beafd4fefdcd434b371bfbc793e165 /make
parent595b8c26d0e4446239542ba076477b557611dfa0 (diff)
Added support for sharing of textures, etc. between GLPbuffers and
GLJPanels when the Java2D/JOGL bridge is active on Mac OS X. This required adding an alternate implementation for pbuffer drawables and contexts on OS X which uses CGL rather than the NextStep OpenGL APIs. Tested with advance Mustang bits on Mac OS X; Water and HWShadowmapsSimple demos (which use pbuffers) are now working within the JRefract harness when the Java2D/JOGL bridge is active. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@855 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'make')
-rw-r--r--make/build.xml2
-rw-r--r--make/cgl-macosx.cfg5
-rw-r--r--make/stub_includes/macosx/OpenGL/OpenGL.h101
-rw-r--r--make/stub_includes/opengl/macosx-window-system.h8
4 files changed, 115 insertions, 1 deletions
diff --git a/make/build.xml b/make/build.xml
index f6e7f9910..726cadf11 100644
--- a/make/build.xml
+++ b/make/build.xml
@@ -584,6 +584,7 @@
<!-- Generate WGL/GLX/CGL implementation class -->
<echo message="Generating WGL/GLX/CGL implementation class" />
+ <dirset id="stub.includes.fileset.platform" dir="." includes="${stub.includes.fileset.platform.params}" />
<gluegen src="${stub.includes.platform}/window-system.c"
config="${window.cfg}"
includeRefid="stub.includes.fileset.platform"
@@ -597,7 +598,6 @@
- handle different drives in an effective manner. -->
<echo message="Generating JAWT interface class" />
<echo message="java.home.dir=${java.home.dir}" />
- <dirset id="stub.includes.fileset.platform" dir="." includes="${stub.includes.fileset.platform.params}" />
<gluegen src="${java.includes.dir.platform}/jawt_md.h"
config="${jawt.cfg}"
literalInclude="${java.includes.dir}"
diff --git a/make/cgl-macosx.cfg b/make/cgl-macosx.cfg
index 97a3bbeff..7c31f7338 100644
--- a/make/cgl-macosx.cfg
+++ b/make/cgl-macosx.cfg
@@ -9,6 +9,11 @@ Include gl-common-macosx.cfg
Opaque long void *
+# Opaque directives for low-level CGL binding (for Java2D/JOGL bridge)
+Opaque long CGLContextObj
+Opaque long CGLPBufferObj
+Opaque long CGLPixelFormatObj
+
CustomCCode #include </usr/include/machine/types.h>
CustomCCode #include "macosx-window-system.h"
diff --git a/make/stub_includes/macosx/OpenGL/OpenGL.h b/make/stub_includes/macosx/OpenGL/OpenGL.h
new file mode 100644
index 000000000..16225b46b
--- /dev/null
+++ b/make/stub_includes/macosx/OpenGL/OpenGL.h
@@ -0,0 +1,101 @@
+/* Typedefs, enums and function prototypes extracted from Apple's
+ OpenGL.h to expose portions of the low-level CGL API to Java */
+
+/* Typedefs to get things working */
+typedef struct _cglObj* CGLContextObj;
+typedef struct _cglObj* CGLPBufferObj;
+typedef struct _cglObj* CGLPixelFormatObj;
+
+/*
+** Attribute names for CGLChoosePixelFormat and CGLDescribePixelFormat.
+*/
+typedef enum _CGLPixelFormatAttribute {
+ kCGLPFAAllRenderers = 1, /* choose from all available renderers */
+ kCGLPFADoubleBuffer = 5, /* choose a double buffered pixel format */
+ kCGLPFAStereo = 6, /* stereo buffering supported */
+ kCGLPFAAuxBuffers = 7, /* number of aux buffers */
+ kCGLPFAColorSize = 8, /* number of color buffer bits */
+ kCGLPFAAlphaSize = 11, /* number of alpha component bits */
+ kCGLPFADepthSize = 12, /* number of depth buffer bits */
+ kCGLPFAStencilSize = 13, /* number of stencil buffer bits */
+ kCGLPFAAccumSize = 14, /* number of accum buffer bits */
+ kCGLPFAMinimumPolicy = 51, /* never choose smaller buffers than requested */
+ kCGLPFAMaximumPolicy = 52, /* choose largest buffers of type requested */
+ kCGLPFAOffScreen = 53, /* choose an off-screen capable renderer */
+ kCGLPFAFullScreen = 54, /* choose a full-screen capable renderer */
+ kCGLPFASampleBuffers = 55, /* number of multi sample buffers */
+ kCGLPFASamples = 56, /* number of samples per multi sample buffer */
+ kCGLPFAAuxDepthStencil = 57, /* each aux buffer has its own depth stencil */
+ kCGLPFAColorFloat = 58, /* color buffers store floating point pixels */
+ kCGLPFAMultisample = 59, /* choose multisampling */
+ kCGLPFASupersample = 60, /* choose supersampling */
+ kCGLPFASampleAlpha = 61, /* request alpha filtering */
+
+ kCGLPFARendererID = 70, /* request renderer by ID */
+ kCGLPFASingleRenderer = 71, /* choose a single renderer for all screens */
+ kCGLPFANoRecovery = 72, /* disable all failure recovery systems */
+ kCGLPFAAccelerated = 73, /* choose a hardware accelerated renderer */
+ kCGLPFAClosestPolicy = 74, /* choose the closest color buffer to request */
+ kCGLPFARobust = 75, /* renderer does not need failure recovery */
+ kCGLPFABackingStore = 76, /* back buffer contents are valid after swap */
+ kCGLPFAMPSafe = 78, /* renderer is multi-processor safe */
+ kCGLPFAWindow = 80, /* can be used to render to an onscreen window */
+ kCGLPFAMultiScreen = 81, /* single window can span multiple screens */
+ kCGLPFACompliant = 83, /* renderer is opengl compliant */
+ kCGLPFADisplayMask = 84, /* mask limiting supported displays */
+ kCGLPFAPBuffer = 90, /* can be used to render to a pbuffer */
+ kCGLPFARemotePBuffer = 91, /* can be used to render offline to a pbuffer */
+ kCGLPFAVirtualScreenCount = 128 /* number of virtual screens in this format */
+} CGLPixelFormatAttribute;
+
+/*
+** Error return values from CGLGetError.
+*/
+typedef enum _CGLError {
+ kCGLNoError = 0, /* no error */
+ kCGLBadAttribute = 10000, /* invalid pixel format attribute */
+ kCGLBadProperty = 10001, /* invalid renderer property */
+ kCGLBadPixelFormat = 10002, /* invalid pixel format */
+ kCGLBadRendererInfo = 10003, /* invalid renderer info */
+ kCGLBadContext = 10004, /* invalid context */
+ kCGLBadDrawable = 10005, /* invalid drawable */
+ kCGLBadDisplay = 10006, /* invalid graphics device */
+ kCGLBadState = 10007, /* invalid context state */
+ kCGLBadValue = 10008, /* invalid numerical value */
+ kCGLBadMatch = 10009, /* invalid share context */
+ kCGLBadEnumeration = 10010, /* invalid enumerant */
+ kCGLBadOffScreen = 10011, /* invalid offscreen drawable */
+ kCGLBadFullScreen = 10012, /* invalid offscreen drawable */
+ kCGLBadWindow = 10013, /* invalid window */
+ kCGLBadAddress = 10014, /* invalid pointer */
+ kCGLBadCodeModule = 10015, /* invalid code module */
+ kCGLBadAlloc = 10016, /* invalid memory allocation */
+ kCGLBadConnection = 10017 /* invalid CoreGraphics connection */
+} CGLError;
+
+/* Pixel format manipulation */
+CGLError CGLChoosePixelFormat(const CGLPixelFormatAttribute *attribs,
+ CGLPixelFormatObj *pix,
+ long *npix);
+CGLError CGLDestroyPixelFormat(CGLPixelFormatObj pix);
+
+/* Context manipulation */
+CGLError CGLCreateContext(CGLPixelFormatObj pix,
+ CGLContextObj share,
+ CGLContextObj* ctx);
+CGLError CGLDestroyContext(CGLContextObj ctx);
+CGLError CGLSetCurrentContext(CGLContextObj ctx);
+
+/* PBuffer manipulation */
+CGLError CGLCreatePBuffer(long width,
+ long height,
+ unsigned long target,
+ unsigned long internalFormat,
+ long max_level,
+ CGLPBufferObj* pbuffer);
+CGLError CGLDestroyPBuffer(CGLPBufferObj pbuffer);
+CGLError CGLSetPBuffer(CGLContextObj ctx,
+ CGLPBufferObj pbuffer,
+ unsigned long face,
+ long level,
+ long screen);
diff --git a/make/stub_includes/opengl/macosx-window-system.h b/make/stub_includes/opengl/macosx-window-system.h
index 959c2352e..1d3df1a08 100644
--- a/make/stub_includes/opengl/macosx-window-system.h
+++ b/make/stub_includes/opengl/macosx-window-system.h
@@ -48,3 +48,11 @@ void setSwapInterval(void* nsContext, int interval);
/* Gamma-related functionality */
Bool setGammaRamp(int tableSize, float* redRamp, float* greenRamp, float* blueRamp);
void resetGammaRamp();
+
+/****************************************************************************************/
+/* Java2D/JOGL bridge support; need to be able to create pbuffers and
+ contexts using the CGL APIs to be able to share textures, etc. with
+ contexts created by Java2D/JOGL bridge, which are CGLContextObjs */
+
+/* Pick up copies of CGL signatures from Mac OS X stub_includes/window-system-build directory */
+#include <OpenGL/OpenGL.h>