Loading... |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Hi,
I'm having trouble trying to get my size for GLCanvas to be correct. I want to be able to make my canvas be 640x480 but it's coming out 624x444. The example on the wiki has the same issues. I'm pretty sure the borders are causing it, what is the common way around this? http://jogamp.org/wiki/index.php/Using_JOGL_in_AWT_SWT_and_Swing |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
Most of the time people size the outside of their windows, rather than the inside
![]() |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
In reply to this post by Leigh McRae
Why not using an undecorated window?
Julien Gouesse | Personal blog | Website
|
Loading... |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
I have expanded my game engine from BlackBerry and Android to include the PC. The PC support is only for internal development. I hoped that it would would accelerate my dev time by bypassing the less mature tools of the mobile platforms. The reason I need a specific sized canvas is to mimic various screen sizes of the mobile devices.
I don't have any real experience with java on the PC so my question could sound odd. How do you use an undecorated window, just add a empty border? I still want the titlebar so I can drag it around. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
I see what you mean -- your requirement makes perfect sense now
![]() Say you have a perfect client area size you want, pw x ph. I would suggest creating your window with some small initial size (say iw x ih), then checking the client area size during window initialization (say it's cw x ch). At that point you know the window frame on the sides is of total width dw = (iw - cw), and on the top and bottom is of total height dh = (ih - ch). Then merely resize your window to size (pw + dw) x (ph + dh). If you do this before your app draws anything, that should leave you with a client area of exactly pw x ph. |
Loading... |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
This is ridicules. The only way I can get it to work is to add a magic number to the frame size to account for the borders. I don't think the system can handle the canvas having it's size changed in one of it's callbacks. What I'm finding the hardest to understand is whether the GLCanvas is reporting back a size that includes the borders or not. Why can't I just create a GLCanvas, set it's size and then have the Frame pack around it? The initial size on the canvas is correct then the GLDrawableHelper comes around and reshapes it smaller on me.
There is no way I'm the first one to want this behavior. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
In reply to this post by Leigh McRae
setUndecorated(true) ;)
Julien Gouesse | Personal blog | Website
|
Loading... |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
That works but now I can't move the screen around. Thanks anyway.
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
On Tuesday, February 01, 2011 17:36:30 Leigh McRae [via jogamp] wrote:
> > That works but now I can't move the screen around. Thanks anyway. > Uhmm .. NEWT uses 'insets' calculation, ie the 'payload' size shall be what you set the NEWT window to - decorated or not. ~Sven |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
In reply to this post by Leigh McRae
U should try to work with the frame insets AFTER u realized the frame. Maybe this small snipped helps.
|
Loading... |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Thank you for the code but I don't think it works. I can't get it to anyway. Maybe I have to create a Frame with a bogus canvas with the size I want. Then take measurements once it's shown and create the GLCanvas with the offsets. I guess I can look into NEWT also but I was under the impression AWT was more stable. I don't really need performance.
|
Loading... |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
LOL. The values for Insets change when reshape is called for the GLEventListener. Make it stop, please give me a blunt knife so I can end it.
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
In reply to this post by Leigh McRae
JFrame frame = new JFrame("asdf");
frame.getContentPane().setPreferredSize(new Dimension(400, 400)); frame.pack(); frame.setVisible(true); creates a frame with a 400x400pix large content pane. -michael On 02/01/2011 06:08 PM, Leigh McRae [via jogamp] wrote: > > Thank you for the code but I don't think it works. I can't get it to anyway. > Maybe I have to create a Frame with a bogus canvas with the size I want. > Then take measurements once it's shown and create the GLCanvas with the > offsets. I guess I can look into NEWT also but I was under the impression > AWT was more stable. I don't really need performance. > > > _______________________________________________ > If you reply to this email, your message will be added to the discussion below: > http://jogamp.762907.n3.nabble.com/Force-a-GLCanvas-size-tp2393774p2398730.html > To start a new topic under jogamp, email [hidden email] > To unsubscribe from jogamp, visit http://michael-bien.com/ ... [show rest of quote]
|
Loading... |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Michael, that totally works. Thanks a bunch.
|
Free forum by Nabble | Edit this page |