Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   Display a C++ window in a java GUI (http://www.velocityreviews.com/forums/t283267-display-a-c-window-in-a-java-gui.html)

bart59 05-24-2004 12:28 PM

Display a C++ window in a java GUI
 
Hi,

I've got a java program and a c++ one.

The Java program`s output is a GUI, using swing and awt componants.

THe Cpp program is a 3D engine: OSG, Open Scene Graph., displaying a
3D model in the screne, with interaction : so that the user can move
on the scene, thanks to the mouse or keyboard.

Actually the Java is used as a command panel fot the 3Dengine.

I would like to know if i can have the Cpp ouput window (the 3D ouput
form the OSG cpp)
in a Java componant > frame or anything : so that I would be able to
keep all my software in only one main GUI.

I heard about python to solve my problem if JNI can't, but is it
possible to do this in Python ?
What can give me Python that Java canīt ?
Could nt be more difficult to use a third language ?

Thanks for you help !

Bart

perry 05-24-2004 02:18 PM

Re: Display a C++ window in a java GUI
 
myself i wouldn't really think of Python for anything but parsing
strings and databases for which it was designed. always use the right
tool for the right job. as for a C++ GUI window inside Java, JNI should
be able to help you out there. if not you can give JMF a whirl, it was
designed to interface with all sorts of image rendering devices both in
and out.... should be a no brianer provided you find an appropaite JMF
example to go by....

- perry

bart59 wrote:
> Hi,
>
> I've got a java program and a c++ one.
>
> The Java program`s output is a GUI, using swing and awt componants.
>
> THe Cpp program is a 3D engine: OSG, Open Scene Graph., displaying a
> 3D model in the screne, with interaction : so that the user can move
> on the scene, thanks to the mouse or keyboard.
>
> Actually the Java is used as a command panel fot the 3Dengine.
>
> I would like to know if i can have the Cpp ouput window (the 3D ouput
> form the OSG cpp)
> in a Java componant > frame or anything : so that I would be able to
> keep all my software in only one main GUI.
>
> I heard about python to solve my problem if JNI can't, but is it
> possible to do this in Python ?
> What can give me Python that Java canīt ?
> Could nt be more difficult to use a third language ?
>
> Thanks for you help !
>
> Bart



Thomas Weidenfeller 05-24-2004 02:53 PM

Re: Display a C++ window in a java GUI
 
bart59 wrote:
> I would like to know if i can have the Cpp ouput window (the 3D ouput
> form the OSG cpp)
> in a Java componant > frame or anything : so that I would be able to
> keep all my software in only one main GUI.


Well, if your C++ part renders the data on an own window or region of
the native operating system, then I would not do it. Little to nothing
is known about how to integrate a native window into a Java frame.
There is no public API available in Java to "merge" an entirely native
component with a Java container. So you would have to do some extensive
source code study. You need to get the complete source code from Sun,
especially the native C part, which is not packed with the Java SDK
(AFAIK available with a special license from Sun). Examining the
implementation of the native peer of java.awt.Canvas for your platform
would be a good start.

If your C++ code just provides the data, then you could use JNI to
render the data on a Java component like Canvas. An example is given in
http://java.sun.com/j2se/1.4.2/docs/...Interface.html
including some C and Java code.

Another alternative would be to consider re-writing the C++ part in
Java, and taking advantage of the existing 3D systems for Java.
Check comp.lang.java.3d


/Thomas

Alf P. Steinbach 05-24-2004 04:42 PM

Re: Display a C++ window in a java GUI
 
* Thomas Weidenfeller <nobody@ericsson.invalid> schriebt:
> bart59 wrote:
> > I would like to know if i can have the Cpp ouput window (the 3D ouput
> > form the OSG cpp)
> > in a Java componant > frame or anything : so that I would be able to
> > keep all my software in only one main GUI.

>
> Well, if your C++ part renders the data on an own window or region of
> the native operating system, then I would not do it. Little to nothing
> is known about how to integrate a native window into a Java frame.
> There is no public API available in Java to "merge" an entirely native
> component with a Java container.


<ot>
The above is incorrect.
</ot>

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

bart59 05-25-2004 07:09 AM

Re: Display a C++ window in a java GUI
 
But JAWT should be able to render such a C++ window no ?

I thought the main problem would come from the mouse interaction on
the java canvas containing the C++ renderer...

Sun give some exemples displaying an OpenGl engine in C++ in a Java
window.

Prateek R Karandikar 05-26-2004 06:18 PM

Re: Display a C++ window in a java GUI
 
There exists no such thing as a C++ window.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
To iterate is human, to recurse divine.
-L. Peter Deutsch
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


All times are GMT. The time now is 08:52 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.