Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / JOGL Development / Re: nurbs support in jogl on: 2005-03-22 12:25:13
Ken, thanks for the answer
but why do you have to port C glu library to the Java?
why not to use native glu library via JNI?

can you explain pro/contra?

thanks
2  Java Game APIs & Engines / JOGL Development / nurbs support in jogl on: 2005-03-22 02:31:13
Hi
what is the status of the nurbs support in the jogl?
I found GLUnurbs object in API
but I didn't find any other API that uses it
is there separate jar file(s)?

thanks



3  Java Game APIs & Engines / JOGL Development / possible glGetDoublev implementation problem on: 2003-10-26 00:34:20
after some discussion in java-dev Apple's list
I took a look at glGetDoublev implementation:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
JNIEXPORT void JNICALL
Java_net_java_games_jogl_impl_macosx_MacOSXGLImpl_glGetDoublev(JNIEnv *env, jobject _unused, jint pname, jdoubleArray params) {
  GLdouble * _ptr1 = NULL;
  if (params != NULL) {
    _ptr1 = (GLdouble *) (*env)->GetPrimitiveArrayCritical(env, params, NULL);
  }
  glGetDoublev((GLenum) pname, (GLdouble *) _ptr1);
  if (params != NULL) {
    (*env)->ReleasePrimitiveArrayCritical(env, params, _ptr1, JNI_ABORT);
  }
}


I can see at least 2 possible problem there:
1. GetPrimitiveArrayCritical could return NULL, so using that _ptr1 isn't recommended
2. GetPrimitiveArrayCritical could use copy, so JNI_ABORT isn't appropriate in ReleasePrimitiveArrayCritical

and just comment (GLdouble *) casting in glGetDoublev
isn't necessary, because _ptr1 was declared as GLdouble*


so I'd recommend the following code instead

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
JNIEXPORT void JNICALL
Java_net_java_games_jogl_impl_macosx_MacOSXGLImpl_glGetDoublev(JNIEnv *env, jobject _unused, jint pname, jdoubleArray params) {
        GLdouble * _ptr1 = NULL;
      jboolean isCopiedArray = JNI_FALSE;
        if (params == NULL)  return;
          _ptr1 = (GLdouble *) (*env)->GetPrimitiveArrayCritical(env, params,& isCopiedArray);
      if(_ptr1 == NULL) return;
        glGetDoublev((GLenum) pname,  _ptr1);
          (*env)->ReleasePrimitiveArrayCritical(env, params, _ptr1,(isCopiedArray == JNI_TRUE)?0:JNI_ABORT);
}



4  Java Game APIs & Engines / JOGL Development / mac os x jogl implementation workaround on: 2003-10-10 06:01:08
Hi,

jogl mac os x implementation has a serious problem:

it's impossible to share jogl gl canvas with other awt components
JAWT MAC OS X implementation has a bug that is responsible for that problem
Gerard Ziemski informed us (java-dev list) earlier that he fixed that bug and new JAWT version will be available sometime after Panther release

meanwhile I implemented workaround to jogl mac os x  sources

I put 2 modified files here:
http://www.concord.org/~dima/jogl/MacOSXOnscreenGLContext.java

http://www.concord.org/~dima/jogl/MacOSXWindowSystemInterface.m


here is what you have to do:

1. backup your jogl.jar and libjogl.jnilib files

2. backup your MacOSXOnscreenGLContext.java from
<path_to_jogl_sources>/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java
replace old MacOSXOnscreenGLContext.java with new one from http://www.concord.org/~dima/jogl/MacOSXOnscreenGLContext.java

3. backup your MacOSXWindowSystemInterface.m file from
<path_to_jogl_sources>/native/jogl/MacOSXWindowSystemInterface.m
replace old MacOSXWindowSystemInterface.m with new one from http://www.concord.org/~dima/jogl/MacOSXWindowSystemInterface.m


4. remove old jogl.jar from the classpath

5. remove old libjogl.jnilib from the library path

6. remove build folder (<path_to_jogl>/build)

7. go to make folder and call ant macosx

8. wait for the few minutes

9. install jogl.jar and libjogl.jnilib into the appropriate place:
for example:  /Library/Java/Extensions or ~/Library/Java/Extensions

10. that's it

it works for me

if you will have any problem don't hesitate and send me email:
dmarkman@mac.com

additionally you can download binaries from:

http://www.concord.org/~dima/jogl/jogl.jar

http://www.concord.org/~dima/jogl/libjogl.jnilib


Dmitry Markman
5  Java Game APIs & Engines / JOGL Development / Re: JOGL OSX-1.1 Beta Available on: 2003-09-07 14:49:54
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.


2. 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;
}
}
6  Java Game APIs & Engines / JOGL Development / Re: JOGL OSX-1.1 Beta Available on: 2003-09-07 06:28:43
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?

2. 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
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

ctomni231 (32 views)
2014-07-17 21:55:21

Zero Volt (28 views)
2014-07-17 14:47:54

danieldean (24 views)
2014-07-17 14:41:23

MustardPeter (25 views)
2014-07-16 14:30:00

Cero (40 views)
2014-07-15 15:42:17

Riven (42 views)
2014-07-14 09:02:53

OpenGLShaders (29 views)
2014-07-14 07:23:47

Riven (29 views)
2014-07-14 02:51:35

quew8 (26 views)
2014-07-13 04:57:52

SHC (63 views)
2014-07-12 08:50:04
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!