Display inside AWT Canvas - Old Content showing???

Started by nicomoskito, February 06, 2015, 19:46:52

Previous topic - Next topic

nicomoskito

Hi all,

I've been doing some animations with LWJGL and since I need some interface to interact with it i created a JFrame with a canvas, and the canvas is basically containing the Display where all the animations are shown.

All is good, the animations show correctly and I can interact with the buttons to change things while it's animating (point of view, wireframe etc) but when I first load the frame, the canvas (or the Display, im not too sure which one) is displaying the previous run content (EVEN AFTER QUITTING THE PROGRAM). Does that make any sense? Here's the important parts of the code:

frame = new MyFrame();
setUpDisplay(frame);

then in setUpDisplay:{
       try {   
            Display.setParent(frame.canvas);
       catch..
       }

       Display.setTitle("MODEL TEST");
       Display.create();
}

frame.canvas.setIgnoreRepaint(true);



(canvas is a simple AWT canvas in frame)
when the program is finished, I call Display.destroy() and System.exit().  I've tried removing everything from the frame, deleting stuff from the canvas before destroying the display etc. But when I reopen the program, the first thing that appears on the display is the previous (last) frame shown on the same display....

I'm really confused so if anyone has any idea what's going on it would be really appreciated!

Nick

SHC

Try adding a call to glClear after creating the display. I'm not sure, but it should solve this issue.

nicomoskito

Hi,

I tried that but strangely it had no effect either :/