LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: JavaToTaval on July 09, 2009, 01:09:23

Title: Does lwjgl use JNI?
Post by: JavaToTaval on July 09, 2009, 01:09:23
Hi, I'm quite new to lwjgl.
I have a question that whether the lwjgl uses JNI to access OpenGL, OpenAL... etc...

Or does it use some other technic to call OpenGL methods

I heard JNI is very slow, so wondering. :o

Title: Re: Does lwjgl use JNI?
Post by: Matzon on July 09, 2009, 09:06:10
there are no other ways than JNI - but we use direct buffers - (java 1.4+) which is the fastest way from Java to Native.
Title: Re: Does lwjgl use JNI?
Post by: princec on July 09, 2009, 11:48:14
Probably worth understanding too that most of normal Java interfaces with the OS via JNI as well. It's clearly not at all slow.

Cas :)
Title: Re: Does lwjgl use JNI?
Post by: JavaToTaval on July 11, 2009, 00:41:47
I got it, so lwjgl uses JNI via direct buffering speed.

but, wait a minute? direct buffering... ??

Could you explain to me a little bit more on this?
I can't get a clear picture of using JNI via direct buffering.

(This is what I am guessing right now:
     Build buffer -> Fill buffer -> call Native Function via JNI -> Fill buff w/ next data -> call Native Function via JNI ->.....

hope I'm wrong :P
)