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  
  GLCanvas inside Panel??  (Read 1664 times)
0 Members and 2 Guests are viewing this topic.
Offline chadseld

JGO n00b
*

Posts: 6


Java games rock!


« on: 2003-07-07 16:44:02 »

Is it possible to make a GLCanvas live inside an awt Panel or swing JPanel? I am porting gl4java code which has a GLCanvas inside a JPanel. When I try to do the same with jogl, the GLCanvas takes up the entire Frame. I have found no way to limit the size of a GLCanvas to less than the entire Frame.

I am running jogl in Mac OS X Panther seed.

thanks,
Chad S
Archimedes
Guest
« Reply #1 on: 2003-07-08 05:47:17 »

Quote
Is it possible to make a GLCanvas live inside an awt Panel or swing JPanel? I am porting gl4java code which has a GLCanvas inside a JPanel. When I try to do the same with jogl, the GLCanvas takes up the entire Frame. I have found no way to limit the size of a GLCanvas to less than the entire Frame.


Well, I've not tried yet to put a GLCanvas inside a Panel, however if you "just" wish to limit the size of your GLCanvas to less than the entire Frame, then I've already used this and it works fine.

Let's assume that the current "this" class is a (AWT) Frame. (Also I'll mix AWT and SWING with the usual restrictions like overlapping of such components will provide problems etc.)

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
// Constuctor of this Frame class
GLCanvas can = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities());

JPanel   pan = new JPanel();
JLabel   lab = new JLabel("bla");
pan.setPreferredSize(new Dimension(64, 400));  // height doesn't matter.

add(can, BorderLayout.CENTER);
add(pan, BorderLayout.EAST);
add(lab, BorderLayout.SOUTH);

show();


Maybe this helps?

If it doesn't work there's some strange difference between my used Jogl for Win32 (downloaded from the file sharing area in the Jogl project, with 2nd July) and your Jogl for Macos...
Offline chadseld

JGO n00b
*

Posts: 6


Java games rock!


« Reply #2 on: 2003-07-08 08:35:11 »

It must be a bug in the Mac OS X version then. I am glad to hear that the GLCanvas is supposed to honor the frame layout, so I have something to look forward to as jogl matures  Grin I'll fool around with the jogl source code and see if anything jumps out at me.
Games published by our own members! Go get 'em!
Offline gregorypierce

JGO Strike Force
***

Posts: 905


I come upon thee like the blue screen of death....


« Reply #3 on: 2003-07-08 22:06:30 »

Please post a bug about this on the java.net site.

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
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.078 seconds with 22 queries.