Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (739)
Games in Android Showcase (224)
games submitted by our members
Games in WIP (820)
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  
  glCanvas.setSize(), and drawable.setSize() dont' work...  (Read 1965 times)
0 Members and 1 Guest are viewing this topic.
Offline skytomorrownow

Junior Devvie





« Posted 2007-12-14 21:25:02 »

hello all. i'm trying to get it so that my GL's canvas to be exactly my requested size. currently, if i call glCanvas.setSize( new Dimension( 1024, 768 ) ), then put it in a Frame, it will shrink down to the minimum size available. if i go back to the basics, and do frame.setSize( new Dimension( 1024, 768 ) ), then everything SEEMS correct. but, in the init() call in the GL, if i ask drawable.getWidth(), or .getHeight(), i get 1024 x 768 - 22 because of the Frame's title bar.

how can get the glCanvas to set to a specific size, then put it in the frame? for example, if i want to set my glcanvas to 1024 x 768, then put it into a frame. then the frame should be 1024 x 768 +22... edit: obviously, i could just ADD 22 to the requested dimension, but that's not going to platform independent i don't think...

sorry if this is such a noob question, and i have tried out a lot of experiments in my code first.

thx.
Offline Ken Russell

JGO Coder




Java games rock!


« Reply #1 - Posted 2007-12-16 17:28:31 »

1  
2  
3  
4  
5  
6  
7  
    Frame frame = new Frame("Gear Demo");
    GLCanvas canvas = new GLCanvas();
    canvas.addGLEventListener(new Gears());
    canvas.setSize(300, 300);
    frame.add(canvas);
    frame.pack();
    frame.show();

Offline skytomorrownow

Junior Devvie





« Reply #2 - Posted 2007-12-16 18:04:46 »

hello. thanks ken.

as i said, i tried this already, and the frame collapses to it's bare minimum size. however, i was doing that with MY opengl renderer and it's canvas. of course, if you say it should work as you list ( which i tried already ), then it does. which is great, because that means that it must be caused by something else. at least i don't have to pound my head on that anymore. wish me luck hunting for this bug. i'll try to make a super simple test case to see if i can make it happen -- then maybe i can see what's causing this. thanks.
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 2007-12-17 01:13:13 »

Are you sure you called pack()? Before I added that the frame was zero-sized in the above example.
Offline skytomorrownow

Junior Devvie





« Reply #4 - Posted 2007-12-17 20:13:49 »

d'oh. and i know better too. thanks ken.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 
Ecumene (56 views)
2017-09-30 02:57:34

theagentd (79 views)
2017-09-26 18:23:31

cybrmynd (187 views)
2017-08-02 12:28:51

cybrmynd (185 views)
2017-08-02 12:19:43

cybrmynd (192 views)
2017-08-02 12:18:09

Sralse (202 views)
2017-07-25 17:13:48

Archive (758 views)
2017-04-27 17:45:51

buddyBro (892 views)
2017-04-05 03:38:00

CopyableCougar4 (1441 views)
2017-03-24 15:39:42

theagentd (1324 views)
2017-03-24 15:32:08
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51
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!