Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I like LWJGL, but Java? Not so much. I recently found out a way to call Java methods from C++. But would this be inefficient? I mean, calling a C/C++ DLL from Java, just to be called back again into C++? I don't know the native method names in LWJGL. I find it better then GLFW, SDL, and all those libraries. But other than my preferences, how slow would it be?

share|improve this question
    
Isn't LWJGL just a Java "port" of the OpenGL API? In that case, why not use the standard C OpenGL API? I have never used LWJGL myself, so I might be completely wrong. –  EClaesson May 16 '13 at 6:42
    
It's a multiplatform port of the native API for Windows, Mac, and Linux that handles the whole window with OpenGL. –  CPP_Person May 16 '13 at 6:54
    
Are there no C++ libraries that do the same LWJGL does? –  Luke B. May 16 '13 at 13:09
    
@user1870398 There are FreeGLUT and SDL. –  N1xx1 May 20 '13 at 21:39
add comment

1 Answer

Yes it would be inefficient. However it's up to you to decide if it is too inefficient. It depends on how often you would be calling LWJGL.

See http://stackoverflow.com/questions/7699020/what-makes-jni-calls-slow and http://192.9.162.55/docs/books/performance/1st_edition/html/JPNativeCode.fm.html. Chapter 9.2 Examining JNI Costs from the second link provides a benchmark result where Native->Java calls were almost 10 times slower than Java->Native calls.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.