Making a lwjgl program into an Applet - no instructions on wiki?

Started by kevingc, February 08, 2008, 00:00:03

Previous topic - Next topic

kevingc

Hi everyone,

I'm new to the openjgl scene (coming over from JOGL), and I'm having problems porting an application to an applet. Are there special types and methods I should be using when trying to get an lwjgl app (for example, gears) running as an Applet?

PS. I know that the Applet demo has an applet version of Gears inside it, but I'm asking for a "for dummies" version of how to turn the regular Gears sample (from the lwjgl website) into an applet. I know there's something more to it than just extending from Applet, because that didn't work...


kevingc

So, basically, you're saying that I need to extend AWTGLCanvas?

I'm a little confused. The wiki instructions say that I need to extend Applet, but the example you linked to only extends AWTGLCanvas. Am I missing something?

kappa

you extend Applet and place an AWTGLCanvas on it to use LWJGL.

kevingc

Ok, thanks, I think I get it.

1. Extend Applet in a dummy class.
2. Write the rendering in a class that extends AWTGLCanvas.
3. Add the AWTGLCanvas-derived class to the layout of the applet.

Update:

I tried extending the Gears sample with AWTGLCanvas. That seemed to work and was trivial to do.

However, I don't think I'm adding it to the applet correctly. First, I call this.add on the altered Gears sample. Then I call Gears.main(null). This creates an applet window and a second window. The gears are only rendered in the second window. If I do not call Gears.main, then nothing happens.