Skip to main content

[JAVA2D] Resizing a JFrame with OpenGL pipeline

1 reply [Last post]
Anonymous

Hello,

While testing the new OpenGL rendering pipeline of J2SE 5.0, I noticed
what seems to be a bug, but I'd like to check with people here before
filing a report in the database.

I have a simple JFrame with a JPanel inside (see code below). I've
defined a simple paint(Graphics g) method for this JPanel. It displays
fine. When I decrease the window's size, everything is fine. When I
increase it slightly, it is fine too. But if I maximize it or increase
it significantly w.r.t its previous size, the window's content just
vanishes (after freezing for approx. 1 second). I get a blank JPanel.

This happens only if I set -Dsun.java2d.opengl=true.

Am I missing something (e.g. should I set ro do something special when I
want to use this OpenGL pipeline)?

Configuration :
Windows XP sp2
JRE 1.5.0-b64
Graphics Card : NVidia GeForce FX Go5200 64Mb (bios 4.34.20.42C1) on a
Dell Inspiron 8600 (centrino-based laptop)
Display driver : 6.14.10.4586
Mode : 1680x1050 @ 32bits color depth

Thanks,
Emmanuel

--
Emmanuel Pietriga
INRIA Futurs - Projet In Situ tel : +33 1 69 15 34 66
Bat 490, Université Paris-Sud fax : +33 1 69 15 65 86
91405 ORSAY Cedex http://www.lri.fr/~pietriga

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.geom.*;

public class GLResize extends JFrame {

public GLResize(){
Container cpane=this.getContentPane();
final JPanel p1=new JPanel(){
public void paint(Graphics g){
((Graphics2D)g).setBackground(Color.white);
g.clearRect(0,0,this.getWidth(),this.getHeight());
for (int i=0;i<100;i++){
for (int j=0;j<100;j++){
g.setColor(new Color(Color.HSBtoRGB(i*j/10000.0f,1.0f,1.0f)));
g.fillRect(i*10,j*10,10,10);
}
}
}
};
cpane.add(p1);
WindowListener w0=new WindowAdapter(){
public void windowClosing(WindowEvent e){System.exit(0);}
};
this.addWindowListener(w0);
this.setSize(1000,1000);
this.setVisible(true);
}

public static void main(String[] args){
GLResize t=new GLResize();
}

}

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Chris Campbell

Hi Emmanuel,

I believe this is a known issue; see:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5026186

There are a few bugs in Nvidia's and ATI's drivers that affect our OGL
pipeline on Windows that should be resolved over time, as we submit
testcases to those driver teams.

Thanks,
Chris

Emmanuel Pietriga wrote:
> Hello,
>
> While testing the new OpenGL rendering pipeline of J2SE 5.0, I noticed
> what seems to be a bug, but I'd like to check with people here before
> filing a report in the database.
>
> I have a simple JFrame with a JPanel inside (see code below). I've
> defined a simple paint(Graphics g) method for this JPanel. It displays
> fine. When I decrease the window's size, everything is fine. When I
> increase it slightly, it is fine too. But if I maximize it or increase
> it significantly w.r.t its previous size, the window's content just
> vanishes (after freezing for approx. 1 second). I get a blank JPanel.
>
> This happens only if I set -Dsun.java2d.opengl=true.
>
> Am I missing something (e.g. should I set ro do something special when I
> want to use this OpenGL pipeline)?
>
> Configuration :
> Windows XP sp2
> JRE 1.5.0-b64
> Graphics Card : NVidia GeForce FX Go5200 64Mb (bios 4.34.20.42C1) on a
> Dell Inspiron 8600 (centrino-based laptop)
> Display driver : 6.14.10.4586
> Mode : 1680x1050 @ 32bits color depth
>
> Thanks,
> Emmanuel
>
> --
> Emmanuel Pietriga
> INRIA Futurs - Projet In Situ tel : +33 1 69 15 34 66
> Bat 490, Université Paris-Sud fax : +33 1 69 15 65 86
> 91405 ORSAY Cedex http://www.lri.fr/~pietriga
>
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".
>
>
> ------------------------------------------------------------------------
>
> import java.awt.*;
> import java.awt.event.*;
> import javax.swing.*;
> import java.awt.geom.*;
>
> public class GLResize extends JFrame {
>
> public GLResize(){
> Container cpane=this.getContentPane();
> final JPanel p1=new JPanel(){
> public void paint(Graphics g){
> ((Graphics2D)g).setBackground(Color.white);
> g.clearRect(0,0,this.getWidth(),this.getHeight());
> for (int i=0;i<100;i++){
> for (int j=0;j<100;j++){
> g.setColor(new Color(Color.HSBtoRGB(i*j/10000.0f,1.0f,1.0f)));
> g.fillRect(i*10,j*10,10,10);
> }
> }
> }
> };
> cpane.add(p1);
> WindowListener w0=new WindowAdapter(){
> public void windowClosing(WindowEvent e){System.exit(0);}
> };
> this.addWindowListener(w0);
> this.setSize(1000,1000);
> this.setVisible(true);
> }
>
>
> public static void main(String[] args){
> GLResize t=new GLResize();
> }
>
> }
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".