简体   繁体   中英

Java jogl applet paint not working?

My jogl applet screen is blank. I have this for my paint code:

 public void paint(Graphics g){
        canvas.update(g);
    }

if I add g.fillRect(0,0,50,50); to it it'll draw the filled rect, but still not the jogl stuff.

I'm not exactly clear what the rest of your program looks like. However you should be aware that JOGL components don't draw like other components; in other words if this code is on an instance of GLAutoDrawable (ie GLJPanel or GLCanvas) then it won't do anything useful.

What you need to do is create a GLEventListener and attach it to the GLAutoDrawable. Then you need to implement display (GLDrawable drawable) with code that draws your 3D scene.

This tutorial is useful in getting you started.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM