aboutsummaryrefslogtreecommitdiffstats
path: root/src/native
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2004-04-21 10:02:51 +0000
committerKenneth Russel <[email protected]>2004-04-21 10:02:51 +0000
commitc8440fcccaa8b306c8b52acf384fa14daec95f5c (patch)
tree494753a9aaeec60c9994b1390b3cc643514750f8 /src/native
parent0f2fa98495ce75434fc011e7ba2976c78edd38d0 (diff)
Updated context creation code to unpack GLCapabilities object in Java
rather than in C using JNI. Added full-scene antialiasing (FSAA) support. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@113 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/native')
-rw-r--r--src/native/jogl/MacOSXWindowSystemInterface.m68
1 files changed, 21 insertions, 47 deletions
diff --git a/src/native/jogl/MacOSXWindowSystemInterface.m b/src/native/jogl/MacOSXWindowSystemInterface.m
index 3d2269a31..7d2f317c9 100644
--- a/src/native/jogl/MacOSXWindowSystemInterface.m
+++ b/src/native/jogl/MacOSXWindowSystemInterface.m
@@ -16,45 +16,23 @@ typedef int Bool;
NSAutoreleasePool* gAutoreleasePool = NULL;
-void* createContext( JNIEnv* env, jobject glCapabilities, void* shareContext, void* view)
+void* createContext(void* shareContext, void* view,
+ int redBits,
+ int greenBits,
+ int blueBits,
+ int alphaBits,
+ int depthBits,
+ int stencilBits,
+ int accumRedBits,
+ int accumGreenBits,
+ int accumBlueBits,
+ int accumAlphaBits,
+ int sampleBuffers,
+ int numSamples)
{
- // fprintf( stderr, "Creating context \n");
-
- jclass clazz = (*env)->GetObjectClass( env, glCapabilities );
-
-
- jfieldID redSizeField = (*env)->GetFieldID( env, clazz, "redBits" , "I" );
- jfieldID greenSizeField = (*env)->GetFieldID( env, clazz, "greenBits" , "I" );
- jfieldID blueSizeField = (*env)->GetFieldID( env, clazz, "blueBits" , "I" );
-
- jfieldID alphaSizeField = (*env)->GetFieldID( env, clazz, "alphaBits", "I" );
- jfieldID depthSizeField = (*env)->GetFieldID( env, clazz, "depthBits", "I" );
- jfieldID stencilSizeField = (*env)->GetFieldID( env, clazz, "stencilBits", "I" );
- jfieldID accumRedSizeField = (*env)->GetFieldID( env, clazz, "accumRedBits", "I" );
- jfieldID accumGreenSizeField = (*env)->GetFieldID( env, clazz, "accumGreenBits", "I" );
- jfieldID accumBlueSizeField = (*env)->GetFieldID( env, clazz, "accumBlueBits", "I" );
- jfieldID accumAlphaSizeField = (*env)->GetFieldID( env, clazz, "accumAlphaBits", "I" );
-
- jint redSize = (*env)->GetIntField( env, glCapabilities, redSizeField );
- jint greenSize = (*env)->GetIntField( env, glCapabilities, greenSizeField );
- jint blueSize = (*env)->GetIntField( env, glCapabilities, blueSizeField );
- jint colorSize = redSize + greenSize + blueSize;
-
- jint accumRedSize = (*env)->GetIntField( env, glCapabilities, accumRedSizeField );
- jint accumGreenSize = (*env)->GetIntField( env, glCapabilities, accumGreenSizeField );
- jint accumBlueSize = (*env)->GetIntField( env, glCapabilities, accumBlueSizeField );
- jint accumAlphaSize = (*env)->GetIntField( env, glCapabilities, accumAlphaSizeField );
- jint accumSize = accumRedSize + accumGreenSize + accumBlueSize + accumAlphaSize;
-
-
- jint alphaSize = (*env)->GetIntField( env, glCapabilities, alphaSizeField );
- jint depthSize = (*env)->GetIntField( env, glCapabilities, depthSizeField );
- jint stencilSize = (*env)->GetIntField( env, glCapabilities, stencilSizeField );
-
- // fprintf(stderr, "Color %d, alpha %d, depth %d, stencil %d, accum %d", colorSize, alphaSize, depthSize, stencilSize, accumSize );
-
-
-//fprintf(stderr, "createContext shareContext=%p view=%p\n", shareContext, view);
+ int colorSize = redBits + greenBits + blueBits;
+ int accumSize = accumRedBits + accumGreenBits + accumBlueBits;
+
NSOpenGLContext *nsChareCtx = (NSOpenGLContext*)shareContext;
NSView *nsView = (NSView*)view;
@@ -80,22 +58,18 @@ void* createContext( JNIEnv* env, jobject glCapabilities, void* shareContext, vo
gAutoreleasePool = [[NSAutoreleasePool alloc] init];
}
- // FIXME: hardcoded pixel format. Instead pass these attributes down
- // as arguments. There is really no way to enumerate the possible
- // pixel formats for a given window on Mac OS X, so we will assume
- // that we can match the requested capabilities and leave the
- // selection up to the built-in pixel format selection algorithm.
-
NSOpenGLPixelFormatAttribute attribs[] =
{
NSOpenGLPFANoRecovery, YES,
NSOpenGLPFAAccelerated, YES,
NSOpenGLPFADoubleBuffer, YES,
NSOpenGLPFAColorSize, colorSize,
- NSOpenGLPFAAlphaSize, alphaSize,
- NSOpenGLPFADepthSize, depthSize,
- NSOpenGLPFAStencilSize, stencilSize,
+ NSOpenGLPFAAlphaSize, alphaBits,
+ NSOpenGLPFADepthSize, depthBits,
+ NSOpenGLPFAStencilSize, stencilBits,
NSOpenGLPFAAccumSize, accumSize,
+ NSOpenGLPFASampleBuffers, sampleBuffers,
+ NSOpenGLPFASamples, numSamples,
0
};