JOGL OSX-1.1 Beta Available

Note that this is NOT an official release, but seeing as the Sun folks are still trying to get OSX into the official build engine I am providing a link to the current OSX beta version until it ends up on the site.

Disclaimer: This is not from Sun, it comes from me. I have not had any trouble with it but it may format your drive, fry your mother board, enslave the human race, or do other funky unwelcome things. Use at your own risk. I can only confirm that this release works on 10.3 using the latest seeds available from Apple. If you find a bug or it crashes a lot - NOTIFY APPLE using bug reporter.

http://www.gregorypierce.com/jogl/jogl_osx_1.1_beta.zip

Note to the Sun folks that this built without modification to the build.xml file so please update the cruise control profile to generate the OSX nightly build.

Awesome!
We just got a G5 on order and will be doing plenty of JOGL/JOAL testing soon.
Great job gregorypierce!

Greg,

You forgot to put a link to the MacOSX 10.3 developer previex CD ISO that should come with JoGL ;D

Ah you’re right - you can get to it here :wink:

https://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/201/wo/k1Ld980mjYFi34vLd0A2Lq6XqXN/0.0

Is it any serious ?
Your link reports your session is expired and ADC requires an apple Developer ID to login, so it won’t be useful to people on the forums.
While I’ve been registered for monthes to the ADC, I never saw any link to a MacOSX 10.3 developer preview CD.
So, if you’re any serious, where in the ADC website does your link point ? Darwin codebase ?

No it was a joke. To get the seed you must be a registered ADC member and be ponying up cash for the select membership.

Hi, Gregory

  1. what is relation between your OSX-1.1 beta
    and binaries I downloaded from https://jogl.dev.java.net/files/documents/27/948/jogl-macosx.tar.gz

is it the same?

  1. is it possible to share jogl GLCanvas with others
    AWT components on the same frame?
    I have a bad feelings that currently it’s impossible
    (I looked at the sources and jogl uses NSView * from
    JAWT structure, but as far as I know (at least in recent 10.3 build) that NSView is all content view, not view related to java canvas

thanks

Dmitry Markman

Here is a possible way to match java canvas and cocoa nsview
I use that technique in gl4java’s MAC OS X
(JDK 1.4.1) implementation.

  1. we need to find location of the canvas relative to the top frame
    maybe there is a shorter way I’d be very graceful if somebody can show me that shorter way.

Component component = c;//canvas
Point globalLocation = component.getLocation();
while(!(component instanceof Frame) && component != null){
component = component.getParent();
if(component != null && !(component instanceof Frame)){
globalLocation.x+=component.getLocation().x;
globalLocation.y+=component.getLocation().y;
}
}
if(component instanceof Frame){
Frame frame = (Frame)component;
Insets insets = frame.getInsets();
if(insets != null){
globalLocation.y -= (insets.top + insets.bottom);
globalLocation.x -= (insets.left + insets.right);
}
}

so after that manipulation we have relative coordinate of our canvas to the top frame.

  1. now we have to find NSView with the same location and size in the contentView view hierarchy
    (contentView could be obtained from JAWT via cocoaViewRef)

NSView *findAppropriateView(NSView *contentView,NSRect needRect)
{
NSView *finalView = NULL;
NSRect contentViewBound = [contentView bounds];
int titleHeight = contentViewBound.origin.y;
NSRect viewRect = NSOffsetRect (needRect , 0 , titleHeight);
finalView = findSubView(contentView,contentView,viewRect);
return finalView;
}

NSView *findSubView(NSView *contentView,NSView *view,NSRect viewRect){
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSView *retView = nil;
NSArray *subviews = [view subviews];
int i=0;
if(subviews != NULL){
int count = [subviews count];
for(i = 0; i < count; i++){
id object = [subviews objectAtIndex:i];
if ( [object isKindOfClass:[NSView class]] ){
NSView *subView = (NSView *)object;
if([[subView subviews] count] == 0){
NSRect subViewRect = [contentView convertRect : [subView frame] fromView : [subView superview]];
if(NSEqualRects(subViewRect,viewRect)){
retView = subView;
}
}else{
retView=findSubView(contentView,subView,viewRect);
}
if(retView != nil) break;
}
}
}
[pool release];
return retView;
}

NSRect GetViewRect(JNIEnv *env,jobject component,int xoffset,int yoffset)
{
NSRect viewRect;
Rect compBound;
GetComponentBounds(env, component,&compBound);
OffsetRect(&compBound, xoffset - compBound.left, yoffset - compBound.top);
viewRect = NSMakeRect(compBound.left,compBound.top,compBound.right - compBound.left,compBound.bottom - compBound.top);
return viewRect;
}

void GetComponentBounds(JNIEnv *env, jobject component,Rect *rect){
if(env == NULL || component == NULL) return;
rect->left = rect->top = rect->right = rect->bottom = 0;
jclass clazz = (*env)->GetObjectClass(env,component);
if(clazz == NULL) return;
jmethodID mID = (*env)->GetMethodID(env,clazz,“getBounds”,JRISigMethod(JRISigNoArgs) JRISigClass(“java/awt/Rectangle”));
if(mID == 0) return;
jobject rectangle = (*env)->CallObjectMethod(env,component,mID);
if(rectangle != NULL){
int width = 0,height = 0;
jclass rclazz = (*env)->GetObjectClass(env,rectangle);
if(rclazz == NULL) return;
jfieldID fieldID = (*env)->GetFieldID(env,rclazz,“x”,JRISigInt);
if(fieldID != NULL){
rect->left = (short)(*env)->GetIntField(env,rectangle,fieldID);
}
fieldID = (*env)->GetFieldID(env,rclazz,“y”,JRISigInt);
if(fieldID != NULL){
rect->top = (short)(*env)->GetIntField(env,rectangle,fieldID);
}
fieldID = (*env)->GetFieldID(env,rclazz,“width”,JRISigInt);
if(fieldID != NULL){
width = (short)(*env)->GetIntField(env,rectangle,fieldID);
}
fieldID = (*env)->GetFieldID(env,rclazz,“height”,JRISigInt);
if(fieldID != NULL){
height = (short)(*env)->GetIntField(env,rectangle,fieldID);
}
rect->right = rect->left + width;
rect->bottom = rect->top + height;
}
}