How languages use 3D engines, programmed in other languages..?

Hi,

What I'm trying do, is implement a Native 3D Engine that I'm developing (in C++) into Java .. like Java bindings for OpenGL does, for example.

I weren't sure whether any of you lot have programmed 3D games/programs in one language, which uses the 3D engine of another language? If so, could you explain the concept of how the engine would render the frames to the component (on a GUI) of another language?

I figured that encoding the frame into an array, and sending the array to the (e.g.) Java program (which would then decode and render to the screen) would be too consuming (of time and resources); can you think up a better way? Or know how the 'pro's achieve it?

Thanks.
LVL 25
InteractiveMindAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

InteractiveMindAuthor Commented:
Yeah, I'm actually reading a book on JNI at the moment; but I haven't come across anything about how I could achieve this efficiently.. so far, the book has only covered transferring standard things, like strings, ints, arrays, etc.. But, this doesn't seem to make rendering a 3D scene (in as close to real-time as possible) very obvious... :o\

Ta.
guitaristxCommented:
Let's assume that the native 3d engine is in C/C++ in a DLL, and that your 3d app is in java.  You'd need to write a "binding" for your native 3d engine for Java, that is, write a DLL that exposes the proper functions so that Java can "talk" to it.  You already know what your native engine looks like in C/C++, you've just got to design and implement what you want it to look like in Java.  More than likely, the rendering itself will be done using the native code, so you won't have to worry about sending buffers back & forth.
InteractiveMindAuthor Commented:
Cheers.

> "the rendering itself will be done using the native code"
How would the Java application display the result of each frame? With JOGL, you add a component called GLCanvas to your Container; the GLCanvas (effectively) is rendered on by the C/C++ code... (so it appears)...

How does that work?

Thank you
guitaristxCommented:
> How does that work?
Like this:
http://www.codeproject.com/java/opengl.asp

If you're on a *nix platform, it should be similar.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Game Programming

From novice to tech pro — start learning today.