Quick AWTTest related question

Just been looking a the AWTTest.java that comes bundled with the source as I’m tempted to port over my game editor to it, at the moment its all in standard opengl and I’m running out of keyboard shortcuts :smiley:

I have very little experience using AWT but in the AWTTest demo isn’t the GLcanvas supposed to resize when I drag/maximise the window?

If not how do I get the GLcanvas to stay the same size as the window?

Thanks.

You need to do a couple of things:

  1. Make sure the AWTGLCanvas is in a layout that will actually resize it when the window is resized! BorderLayout will do just fine.
  2. Make sure that the glViewport size tracks the actual size of the canvas every frame. Don’t call glViewport unless it changes, just in case that causes some unoptimised driver to get in a fuddle.

Cas :slight_smile:

Cheers Cas, been a long time since I’ve played with AWT and stuff but BorderLayout rings a few bells.

Thanks.

The inevitable second question :smiley:

I found some old swing code I’d done and added a AWTGLCanvas to it but the canvas appears to be drawing over the contents of my JMenuBar, making it unreadable, anyone know what I’m doing wrong?

Thanks again.

Yes, I had the same thing. It’s to do with Lightweight versus Heavyweight. Menus are lightweight by default, but you can make them heavyweight with:


JPopupMenu.setDefaultLightWeightPopupEnabled(false);

Excellent. Thanks Alan, I should be able to get on with it now.

Cheers.