Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (789)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (864)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Jogl & Swing  (Read 6182 times)
0 Members and 1 Guest are viewing this topic.
Offline paul

Junior Newbie

Java rocks!

« Posted 2003-06-24 17: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

Medals: 57
Projects: 11

Monkey for a head

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

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.

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

Junior Newbie

Java rocks!

« Reply #2 - Posted 2003-06-27 18: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! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Ken Russell

JGO Coder

Java games rock!

« Reply #3 - Posted 2003-06-29 00:05:50 »

Sounds like a bug. Please boil it down to a small test case and file an issue on .
Offline vydias

Senior Newbie

Welcome to my world!

« Reply #4 - Posted 2003-07-01 05: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 Coder

Java games rock!

« Reply #5 - Posted 2003-07-03 04: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 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]
  ignore  |  Print  

hadezbladez (2595 views)
2018-11-16 13:46:03

hadezbladez (928 views)
2018-11-16 13:41:33

hadezbladez (2549 views)
2018-11-16 13:35:35

hadezbladez (499 views)
2018-11-16 13:32:03

EgonOlsen (3675 views)
2018-06-10 19:43:48

EgonOlsen (4028 views)
2018-06-10 19:43:44

EgonOlsen (2439 views)
2018-06-10 19:43:20

DesertCoockie (3246 views)
2018-05-13 18:23:11

nelsongames (3292 views)
2018-04-24 18:15:36

nelsongames (4262 views)
2018-04-24 18:14:32
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45 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‑
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!