Loading... |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
This post was updated on Feb 10, 2014; 11:43pm.
The program runs normally but GLHandler will not init and its display method will never get invoked unless I tab to desktop then back. Complete source: http://pastebin.com/SaYYAuxP
I'm pretty sure something broke somewhere, but what? |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
The GLCanvas components will only initialize after they have become visible. your application needs to follow the swing coding guidelines: 1. all swing components has to be manipulated from the "event dispatch thread" http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html rewrite your main to use the SwingUtils like this in order to satisfy this Swing/AWT "event patch thread" rule: public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { JFrame frame = new test(); } } } 2. after you have added canvas using add(canvas); you need to re-validate the JFrame in order for it to relayout its components and make the newly added canvas visible. you can re-validate the JFrame by calling its pack() or validate() method. http://docs.oracle.com/javase/6/docs/api/java/awt/Container.html#validate%28%29 This should make the component visible and initialize the JogAmp GLCanvas. If you want to make your application more portable then i recommend you to stop using all swing & awt components and simply use a JogAmp NEWT GLWindow. Cheers Xerxes |
Loading... |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
I've tested both invokeAndWait and invokeLater and they didnt seem to have any effects (from an user POV). I'm keep it in mind but for now I'll stick to my "dont add stuff that does nothing" guideline. Just what I need! validate() works but pack() doesnt. Probably has something to do with my "screw Java guidelines, I" approach. Case closed. I've considered but I have a fairly big code base and I'm not really comfortable with opengl/jogl yet so I'll hybridize for now. Sorry for my stubbornness for I'll continue troubling the forum with my problems. Off-topic: How do I quote username like you did? |
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
|
Please follow at least Swing guidelines in order to avoid causing much more troubles in the future. Don't wait to do that, otherwise you might have some problems whose root cause will be difficult to identify in a few months when you forget our advice. For example, the OpenGL context won't be created on some hardware and JOGL will crash if you call setVisible(true) on the wrong thread.
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 |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Thank you for the advice. See, if I havent waited, no one would drop by and explain why (or in a way my little mind can comprehend). |
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
|
You're welcome. This problem occurs with Intel GPUs under Windows but any other less tolerant drivers of any other vendor might behave like this one day.
Julien Gouesse | Personal blog | Website
|
Free forum by Nabble | Edit this page |