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  
  repainting speed  (Read 721 times)
0 Members and 1 Guest are viewing this topic.
Offline sss

JGO n00b
*

Posts: 12


Java games rock!


« on: 2003-09-09 14:25:53 »

The jogl user's guide suggests using GLDrawable.display() to cause a repaint.  I find that calling the repaint method on my GLCanvas, e.g. glCanvas.repaint(), actually runs must faster.

Why is this?
Offline gregorypierce

JGO Strike Force
***

Posts: 905


I come upon thee like the blue screen of death....


« Reply #1 on: 2003-09-09 15:05:08 »

There is no apparent reason why this would be the case. GLDrawable is an interface which is implemented by GLCanvas. I see every reason for the inverse to be true. Calling display causes

1  
2  
3  
  public void display() {
    displayImpl();
  }


to be called which is basically passing the painting off to the native rendering implementation.

However calling repaint would be calling paint which would be calling

1  
2  
3  
4  
5  
6  
7  
  /** Overridden from Canvas; calls {@link #display}. Should not be
      invoked by applications directly. */

  public void paint(Graphics g) {
    if (!context.getNoAutoRedrawMode()) {
      display();
    }
  }


So unless yoru context isn't redrawing itself automatically which could lead to some weirdness when windows overlap and such, at worst they should be the same speed with a call to display being faster (and correct).

All of the code for this is is in GLCanvas.java if you want to check things out yourself.

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
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.129 seconds with 21 queries.