GLCanvas resizing issue on Mac OSX 10.8.2

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

GLCanvas resizing issue on Mac OSX 10.8.2

Eric

I have recently integrated JOGL into our AWT application. So far everything works quite well, but there is one significant problem that just kills usability. Allow me to explain:

  • All my instances of GLCanvas are contained within instances of JPanel using the following approach:

  • jpanel.setLayout( new BorderLayout() );
    jpanel.add( glCanvas, BorderLayout.CENTER );

  • When the panel appears at first, everything displays perfectly fine.


  • When I reduce the size of the containing JPanel (via dragging the divider of a parent JSplitPane or resizing the parent window, doesn't matter), everything is consistent.


  • Here's where the problem begins to happen. When I increase the size of the containing JPanel, the drawn area remains the same as the JPanel's smallest dimension since it's initialization. All the contents that should be drawn over the area of the entire JPanel are instead scaled down to draw into a sub-region that sticks to the bottom-left of the panel (the GL clear color is bright pink/purple).

Here are a few solutions I have tried without much success:

  • I tried resetting the JPanel's and the GLCanvas' minimum and preferred size to (0,0) and panel.getSize() when the resize happens, as per suggestions I found online from people having similar issues. Neither have been successful or have had any effect.
  • Ensured that the glViewport and glOrtho2D were being properly set.
  • Tried using GLJPanel instead of a JPanel, but got the same result.
  • Tried invalidating the involved components.
  • I am currently on JRE 1.6.0_37 (JDK6) (the one bundled with my OS). I tried with the lastest version of JRE 1.7 (JDK7), but the same thing happened and everything felt a bit less stable so I rolled back.
  • Updated to the latest release of JOGL (the one from November). I found the following issue that corresponds closely to my problem. A bug was filed for it and claimed to be fixed, so I wanted to make sure I had the fix.
  • All imaginable combinations of the above and probably a few more things. I've wasted a lot of time on this, basically...

Also important to note: When I look at values through the debugger, everything adds up correctly and the numbers are what they should be from what I can see. That's primarily what makes me believe that the issue is a bit deeper.

I have no other platforms available to me at the moment (e.g. a Windows machine), so I haven't seen if the issue is platform dependent, but I suspect it is.

Any help in getting this resolved would be greatly appreciated.
Thank you for your time.

Reply | Threaded
Open this post in threaded view
|

Re: GLCanvas resizing issue on Mac OSX 10.8.2

gouessej
Administrator
Hi

Mixing AWT and Swing components is not fully working; in some (rare) cases we still don't get the expected behaviour. We can help you to find an acceptable workaround but keep in mind that it's not a bug of GLCanvas.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: GLCanvas resizing issue on Mac OSX 10.8.2

Eric
Thank you for your reply. I understand that this isn't a bug with GLCanvas.

I got a buddy to run the app on a Windows machine and the same thing happens, so I suspect the problem is on my side. I'm probably doing something stupid somewhere. I'll keep pecking at it. Just for kicks, though, would you have some ideas off the top of your head about what the problem might be? Any help would be appreciated. I'd be happy to provide any additional information you might need.
Reply | Threaded
Open this post in threaded view
|

Re: GLCanvas resizing issue on Mac OSX 10.8.2

Eric
Call off the troops, I fixed the problem. It was a viewport/scissors issue. The viewport was getting set to the clipping region, so the units were getting scaled down on expansion of the panel. Sorry for the waste of time.