[java] Anyone using JNI with DirectX/OpenGL?

Started by
30 comments, last by Kaijin 22 years, 2 months ago
quote:Original post by WayfarerX
Ahhh...ok, I see
Well, there is stuff DX gives you besides the graphics (sound, joystick input, etc). I haven''t gotten to play with the Volitile Images too much yet, but I bet you''re still going to get better performance out of your JNI/DX version (if it''s done well that is ) just because you''ll be able to tailor it to your specific needs.

If you wanted to be really crafty you could put a layer between the client code and the engine and have the layer load a pure Java 1.4 version of your engine if the Direct X version is not available.

1.4 is cool, but it''s still in beta, and if it''s anything like 1.3 then it''s going to be awhile before all the bugs get worked out.


Ok, cool. As long as I''m not wasting my time .

I just kept getting this feeling that I''d finish my engine then people would be like "why did you bother when you could''ve just done it in Java 1.4 and then it would be portable."


- Kaijin
Advertisement
quote:Original post by WayfarerX

Before java.nio the answer would be yes if you wanted to transfer a large amount of data across as it had to be copied. Otherwise very little or no extra overhead at all (from what I''ve seen).


Ok, that''s good. I haven''t got large amounts of data going between the two layers so I should be fine. I made sure to avoid that.

quote:Original post by WayfarerX
Yes sir! Zero-copy data transfer between the JVM and your native code.


That''s so cool, that''s going to be really useful. I might have to check out Java 1.4. Shame it''s still in BETA though.

Any other new features that will useful to games programmers?

- Kaijin
Well I really like the support for Asynchronus IO, but I''m a network nerd so I might be somewhat alone there.
And don''t forget asserts! And mouse wheel support!

I am really looking forward to when 1.4 is stable and widely available. Ahhh, but aren''t we always looking forward to something (fondly remembers waiting for Java 2).

"So crucify the ego, before it''s far too late. To leave behind this place so negative and blind and cynical, and you will come to find that we are all one mind. Capable of all that''s imagined and all conceivable."
- Tool
------------------------------
"There is no reason good should not triumph at least as often as evil. The triumph of anything is a matter of organization. If there are such things as angels, I hope that they're organized along the lines of the mafia." -Kurt Vonnegut
Actually, I remember reading an article somewhere saying that they may be introducing generic programming to Java. I really hopy they do, I''d love to see an end to the annoying casting associated with using the current Java container classes.

I can''t remember if it was just a proposal or if they are definately adding it, but there''s such demand for it that I''m sure they''ll have to implement it eventually. The sooner the better.

- Kaijin
quote:Original post by Kaijin
Actually, I remember reading an article somewhere saying that they may be introducing generic programming to Java. I really hopy they do, I''d love to see an end to the annoying casting associated with using the current Java container classes.


That and const top my personal Java wish list. I just recently really got into template programming in C++ and so far I really, really like it.

"So crucify the ego, before it''s far too late. To leave behind this place so negative and blind and cynical, and you will come to find that we are all one mind. Capable of all that''s imagined and all conceivable."
- Tool
------------------------------
"There is no reason good should not triumph at least as often as evil. The triumph of anything is a matter of organization. If there are such things as angels, I hope that they're organized along the lines of the mafia." -Kurt Vonnegut
I''ve seen that mentioned before. What is the diffence between const and final?

- Kaijin
Good news, they are adding support for generic programming. The bad news is that it won''t be until Java 1.5 which won''t be available until 2003 at the earliest .

But there is experimental support for it in Java 1.4. You just need to download the generic compiler.

Here''s an article I found of the subject.

- Kaijin
quote:Original post by Kaijin
I've seen that mentioned before. What is the diffence between const and final?


[sarcasm]
const works
[/sarcasm]

No, final works mostly like const for the basic data types (char, int, yatta yatta), but if you make a refrence final it only protects the refrence, not the object it points to or its data members. So in C:
void doSomething (const MyClass& obj);  

doSomething guarentees that obj and all of it's members will remain unchanged by the function. In Java:
void doSomething (final MyClass obj);  

only keeps you from re-assigning the REFRENCE obj to anything else, but you can go ahead and do whatever you want with obj's members. Works the same with final static and instance members.

A real const implementation would keep stuff like the Collection's framework immutable kludge from having to be used.

quote:
Good news, they are adding support for generic programming.


sweeeeeeeeeeeet!



"So crucify the ego, before it's far too late. To leave behind this place so negative and blind and cynical, and you will come to find that we are all one mind. Capable of all that's imagined and all conceivable."
- Tool
------------------------------


Edited by - wayfarerx on January 2, 2002 9:05:44 PM
"There is no reason good should not triumph at least as often as evil. The triumph of anything is a matter of organization. If there are such things as angels, I hope that they're organized along the lines of the mafia." -Kurt Vonnegut
Thanks for clearing that up I always wondered what the difference was. You''re right, that would be a really useful feature to have.

For anyone that''s interested you can download the experimental version of the generic compiler here. You''ll need to be a member of the Java Developer Connection to downlaod it (It''s free to sign up)

- Kaijin
Personally I think the current proposal for Java generics is too limited to justify the bloat that it adds to the language. It doesn''t let you define primitive types as template parameters so the only benefit you get with it over Java''s current unified object hierarchies is some compile-time type checking. You should theoreticly be able to gain some performance by eliminating runtime casts, but current JVMs have gotten good enough at that to make casts a non-issue for performance. If I remember correctly, the only performance goal in the proposal is to ensure that it doesn''t run more than 10% slower than non-generic programming. This is not C++ templates.

Henry

This topic is closed to new replies.

Advertisement