LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: Enk on July 31, 2009, 10:19:24

Title: Import static and performance
Post by: Enk on July 31, 2009, 10:19:24
Hi

This may seem like an odd question, but are there any performance issues regarding importing the LWJGL-classes static?

I've seen a lot of tutorials/example-code but haven't seen any using import static.

I've used it in my application and find it much easier to just write glBegin(GL_QUADS) instead of GL11.glBegin(GL11.GL_QUADS). Especially since I'm used to OpenGL in C++.


So are there any extreme negative consequences of this, or are people just unaware of the possibility to import static?
Title: Re: Import static and performance
Post by: spasi on July 31, 2009, 10:32:20
Static import is just syntactic sugar, writing a static-imported glBegin(GL_QUADS) is exactly the same as writing GL11.glBegin(GL11.GL_QUADS).
Title: Re: Import static and performance
Post by: Enk on July 31, 2009, 10:34:04
Ok, strange that more people aren't sugar-hungry then ;)
Title: Re: Import static and performance
Post by: Fool Running on July 31, 2009, 12:59:40
Probably most of the tutorials/examples were written either before java 1.5 (or 5 :P) came out or they were written so that someone with 1.4 could still use it without any trouble.