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  
  1.1b11 + multiple calls to init during resize  (Read 920 times)
0 Members and 2 Guests are viewing this topic.
Offline girvine

Jr. Member
**

Posts: 65


Java games rock!


« on: 2005-05-22 17:42:15 »

Is it normal to receive many calls to init(GLDrawawable) during resizing a drawable?

I've placed a GLJPanel inside a JInternalFrame and when I resize it, not only does init() get called many times on my GLEventListener during the resize but the performance degrades significantly.
Offline Ken Russell

JGO Kernel
*****

Posts: 3446
Medals: 3


Java games rock!


« Reply #1 on: 2005-05-22 18:58:18 »

This is a bug in JDK 1.4.2 fixed in 1.5.0. As far as I have found there is no good workaround we can put in JOGL.
Offline girvine

Jr. Member
**

Posts: 65


Java games rock!


« Reply #2 on: 2005-05-22 19:51:27 »

That's interesting.  I'm using JDK 5.0.2.
Games published by our own members! Go get 'em!
Offline Ken Russell

JGO Kernel
*****

Posts: 3446
Medals: 3


Java games rock!


« Reply #3 on: 2005-05-22 20:36:56 »

Sorry, I was in a rush when I wrote my original reply. I realized about ten minutes later I was wrong.

There is a bug in 1.4.2 where focus changes in JInternalFrames cause addNotify / removeNotify to be called on the contained components. This isn't what you're seeing.

The GLJPanel has a backing pbuffer which is originally 256x256 and is resized in the X and Y axes by powers of two when the GLJPanel becomes larger than the pbuffer. Is this the effect you're seeing, or are you seeing continuous calls to init() while you resize it? You should be able to reduce this effect by making the GLJPanel about as large as you expect it to become. You could also work around it by making it a large size for one frame and then immediately resizing it to a smaller size. Do these suggestions help?
Offline EdwinOlson

JGO n00b
*

Posts: 25


Java games rock!


« Reply #4 on: 2005-05-24 10:59:04 »

The multiple calls to init was quite surprising to me. I assumed init() would only be called once, and used that section of code to establish my camera location. On subsequent init()s, the camera would jump back to the starting point, totally baffling the programmer! Smiley

Can I suggest that the behavior be documented more prominently?
Offline Ken Russell

JGO Kernel
*****

Posts: 3446
Medals: 3


Java games rock!


« Reply #5 on: 2005-05-24 16:02:01 »

Thanks for the suggestion. I've added more documentation to GLEventListener.init() and the class documentation for GLJPanel. Let me know if you think more information is needed.
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.07 seconds with 20 queries.