Newbie / documentation questions

I still don’t have a clue what I’m doing in JOGL :), and have all sorts of questions. IMHO, all of these ought to be covered in the documentation, but don’t appear to be (I’m using the User Guide and the current docs downloadable from the java.net site).

[] How many times does GLEventListener.init() get called, and under what circumstances? Traditionally in many API’s init is a “one-time-only” method. In others, it’s called every time something “gets focus” or similar.
[
] (this is answered partially by the above, but:) …what processing ought we to do (or NOT do) in init()? The docs say “GL initialization stuff like lights”, but that’s rather vague.
[] How “fast” is Animator? Does it just render as-fast-as-possible until the stop() method is called (and hence take 100% CPU unless vertical synch is on)?
[
] Are you supposed to just set up an Animator and then ignore it, and do all your game-ticks etc independently. Your rendering code has to keep track of how long it’s been since Animator last called the display() method?
[*] Is it insane of me to create an object to manage a set of GLEventListener’s, treating them as “scenes”: maintaining a reference to which one of them is currently registered on the GLDrawable, and “swapping” them in and out dependent on what “mode” my app is in? (e.g. I code a GLEventListener for doing menus, a separate one for painting the game, etc). I can’t seem to find any info on how I ought to be using the GLEventListener’s…

I’ll probably find a few more flummoxing questions, but for now those are the only bits I can’t find answers to :).

  1. I’ve only ever seen it called once in the lifetime of my app, just after creation of the OpenGL canvas.
  2. About the only thing I do in there is log the GL vendor, renderer and version to a file, then set a couple of states I only ever set once (cull face & direction, colour material). Probably a good idea to check extensions there if you’re using any. Other than that I like to set states every frame since weird errors are less likely to creep in that way.
  3. Its as fast as possible as far as I know.
  4. I end up using the Animator callbacks for the game loop, with time calculations and logic updates just before rendering.
  5. Dunno, I only ever need one event listener and delagate the rendering to different renderer classes depending on my games internal state. GLEventListener just seems like Jogl’s way of avoiding letting the developer control glSwapBuffers.