LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: mac on August 02, 2003, 21:09:23

Title: static Init
Post by: mac on August 02, 2003, 21:09:23
Hi,

yep, while study the Hehe Examples ported to lwjgl i allways
saw a static init on top of every class
like this :


 // GL variables...
public static final GL gl = new GL("lwjgl Test",0,0,800,600,16,0,0,0);


 // GL context creation...
static
{
try
{
gl.create(); // Create The Opengl Context
}
catch(Exception e)
{
System.exit(1);
}
}


is there some deeper reason for doing it like this ?
For me unaceptable design.

What will happen is case the Contex could not be Initalized (Excpetions,  ypes ) ?
Or for worst case the binaries, couldnt  loaded ?

Sorry 4 asking so supid questions, but for integration i must have some more Info on that, because i plan to deploy it via Webstart.

thx a lot

PS: all in all the Design looks very well and clear ...like that  :D  

- Jens
Title: static Init
Post by: Matzon on August 02, 2003, 23:22:48
No reason whatsoever - just the way the original did it...

You might just as well do it in somewhere else - no requirements!