Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
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 4317 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: 56
Projects: 11


Monkey for a head


« Reply #1 - Posted 2003-06-24 18: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

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 http://jogl.dev.java.net/ .
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 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]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

rwatson462 (29 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (40 views)
2014-12-09 22:41:13

BurntPizza (75 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (45 views)
2014-11-29 21:32:03

toopeicgaming1999 (113 views)
2014-11-26 15:22:04

toopeicgaming1999 (100 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!