Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  Jogl & Swing  (Read 2856 times)
0 Members and 1 Guest are viewing this topic.
Offline paul

JGO n00b
*

Posts: 6


Java rocks!


« on: 2003-06-24 13:02:22 »


Anyone got even a simple jogl program to run with a Swing JFrame ?

I tried changing the Frame constructor in the gears demo to

JFrame frame = new JFrame()
frame.getRootPane.add( canvas )

The Frame appears on the screen but nothing is rendered, it appears that none of the GearRendered methods are called  Cry
Offline Orangy Tang

JGO Kernel
*****

Posts: 2960
Medals: 37


Monkey for a head


« Reply #1 on: 2003-06-24 14:07:14 »

Try:
1  
2  
JFrame frame = new JFrame();
frame.getContentPane().add( canvas );

I have it working ok, but be careful with rearranging components - the access violation I described in another thread also crops up if i try and resize the frame after it is initially visible when i'm using a border layout. Hopefully these teething problems will be ironed out soon.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline paul

JGO n00b
*

Posts: 6


Java rocks!


« Reply #2 on: 2003-06-27 14:22:19 »


OK, I've found the cause of the problem I was seeing.....

When using a awt.Frame as the container the jogl GLEventListener init  is called when the frame is shown.

When using a JFrame as the container the GLEventListener is not called when the frame is shown. Adding an Animator to the canvas forces the initialisation and everything renders correctly.

I'll check the docs carefully and figure out if this is a bug or a feature  Wink
Games published by our own members! Go get 'em!
Offline Ken Russell

JGO Kernel
*****

Posts: 3446
Medals: 3


Java games rock!


« Reply #3 on: 2003-06-28 20:05:50 »

Sounds like a bug. Please boil it down to a small test case and file an issue on http://jogl.dev.java.net/ .
Offline vydias

Jr. Member
**

Posts: 52


Welcome to my world!


« Reply #4 on: 2003-07-01 01:39:03 »

btw where are the docs for JOGL? I'm playing around with it and have added it to a JFrame with some mix results.

1) I notice some skips in the rendering where my 2d frame buffer shows for a split second every now and then. (the rendering loop for the 2d buffer is turned off when I switch over to the glCanvas).

2) I'm also having trouble closing down the glCanvas. I'm calling dispose on it and trying to switch back to my 2d rendering pipe with not much luck.  It appears the canvas is being disposed but setting focus back to my JFrame and starting the 2d rendering loop back up isn't doing the trick.

Also should I remove my mouse listeners and keyboards listeners from my original Jframe? and reset them after I dipose of the glcanvas. It works without doing this so I'm wondering if it is a good idea or not.
Offline Ken Russell

JGO Kernel
*****

Posts: 3446
Medals: 3


Java games rock!


« Reply #5 on: 2003-07-03 00:57:02 »

The documentation is currently minimal. There is an overview guide in the source tree at doc/userguide/index.html. The javadoc, however, should be pretty complete at least for the core JOGL package.

The issues around disposing of a GLCanvas haven't been 100% thought through yet. I believe Pepijn Van Eeckhoudt (pepijnve on java.net) is looking into bringing GL4Java's disposal handling into JOGL.

Without more knowledge of how your application is set up I can't guess why you might be seeing flickering of your 2D display over your 3D one.
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.117 seconds with 21 queries.