Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (481)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (548)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Converting C++ directx code to Java, easy?  (Read 3823 times)
0 Members and 1 Guest are viewing this topic.
Offline zappsweden

Junior Member




Java games rock!


« Posted 2007-07-25 20:08:22 »

I have a pretty ok codebase in Java now but would like to speed up my drawing. I am currently using pure swing so I am totally platform independant. I have contact with a company that hold a good graphics engine written in C++ using DirectX.

Also, by the way I have 7 years experience in Java but only 1 year experience in C/C++

So, my question is what would generally be easiest?

1) Convert the C++ code to Java
or
2) Use my existing Java code and build my own graphical Java code for openGL or DirectX
or
3) Convert my whole codebase to C++ so I can use their Graphics

Please motivate your answer, this is a big decision for me to take  Smiley
Offline princec

JGO Kernel


Medals: 362
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #1 - Posted 2007-07-25 20:58:30 »

Stick with Java. Use Slick. Easy conversion from Java2D. Very fast. Works on Mac and Linux.

<edit>BTW, this thread needs moving to an appropriate forum topic Wink

Cas Smiley

Offline broumbroum

Junior Member





« Reply #2 - Posted 2007-07-26 11:28:54 »

just about slick, how much datas does it supports for resources? Does an amount of 50MB of graphics data resources support a slick implementation to Game-Animations? Huh

::::... :..... :::::: ;;;:::™ b23:production 2006 GNU/GPL @ http://b23prodtm.webhop.info
on sf.net: /projects/sf3jswing
Java (1.6u10 plz) Web Start pool
dev' VODcast[/ur
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline cylab

JGO Ninja


Medals: 43



« Reply #3 - Posted 2007-07-26 12:45:04 »

So, my question is what would generally be easiest?

1) Convert the C++ code to Java
2) Use my existing Java code and build my own graphical Java code for openGL or DirectX
3) Convert my whole codebase to C++ so I can use their Graphics

Depends on what your codebase does and how many lines of code are in the different parts. I would stick to java and try to separate the rendering code form the rest of the application by refactoring. Try to do it with minimal effort, just to get a feeling of the connection points of your rendering code and your app logic. Do not try to make a general rendering abstraction.

After that you can investigate the needed functionality of your rendering code and decide what would be easiest for you to do. A fourth option might be to convert your rendering code to C/C++ and just create a native binding using JNI or by compiling your code with GCJ and use CNI. But I guess the easiest would be to convert your rendering code to either Slick, LWJGL or JOGL and discard the C++ engine completely.

Mathias - I Know What [you] Did Last Summer!
Offline zappsweden

Junior Member




Java games rock!


« Reply #4 - Posted 2007-07-31 22:16:23 »

Downloaded these 2 packages
lwjgl-source-1.1.zip
slick.zip

and extracted them in the correct path and tried using Slick.

There are still source files missing when I try to import
for example

import org.lwjgl.opengl.GL11;

By the way I am using Java 1.4 still (because my JDE does not support newer Java) now if that would have anything todo with it.
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 76
Projects: 15


★★★★★


« Reply #5 - Posted 2007-07-31 22:57:07 »

you shouldn't need to download the lwjgl source jar, the full slick download comes with all the dependancies its needs (unless you are using an OS other than windows in which case you'll have to grab the natives for that version of lwjgl), you just need to add the lwjgl.jar to your external jar path.
Offline zappsweden

Junior Member




Java games rock!


« Reply #6 - Posted 2007-08-01 07:28:39 »

you shouldn't need to download the lwjgl source jar, the full slick download comes with all the dependancies its needs (unless you are using an OS other than windows in which case you'll have to grab the natives for that version of lwjgl), you just need to add the lwjgl.jar to your external jar path.

You are correct, the JWGL is inside the Slick. But regardless, both the jar files and the.Java files misses classes like GL11 for example. I placed all jars in the same place where I placed Jogg and Jorbis jars that I used from before but I cannot import certain classes because they do not exist.

Also, downloaded GL11.java from the Internet but when I compile I get


"GL11.java": illegal character: \64 at line 717, column 22"
"GL11.java": <identifier> expected at line 717, column 50"
...
...
...

errors everywhere



example of methods that give error.
void glAccum(@GLenum int op, float value);
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 76
Projects: 15


★★★★★


« Reply #7 - Posted 2007-08-01 11:25:53 »

don't think you need GL11.java to use slick, GL11.class should be in the lwjgl.jar at org.lwjgl.opengl.GL11.class
Offline zappsweden

Junior Member




Java games rock!


« Reply #8 - Posted 2007-08-08 10:15:23 »

Doing openGL means switching to at leist a AWT Canvas. So wondering, has anyone tried mixing openGL with Swing? I have a JFrame which contains 3 swing JPanel and where my map and drawing is done in the center one. So one northPanel, southPanel, centerPanel

Is it possible to have the openGL canvas in center while still using Swing components in the north and south without them interfering with each others because that would be GOLD and means the switch from Swing to openGL would be much easier.
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #9 - Posted 2007-08-08 10:23:57 »

Doing openGL means switching to at leist a AWT Canvas. So wondering, has anyone tried mixing openGL with Swing? I have a JFrame which contains 3 swing JPanel and where my map and drawing is done in the center one. So one northPanel, southPanel, centerPanel

Is it possible to have the openGL canvas in center while still using Swing components in the north and south without them interfering with each others because that would be GOLD and means the switch from Swing to openGL would be much easier.
I have used LWJGL sucessfully in a Swing app at some point, although I can't remember the exact details. Putting a lwjgl canvas in the middle of a border layout worked just fine. Grin


[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline zappsweden

Junior Member




Java games rock!


« Reply #10 - Posted 2007-08-08 10:33:34 »

Wow, that was a quick reply!
So you were able to mix them, that is great!
That is also what I intend to do on my project if I switch to openGL since the Swing UI is fast enough so I want to keep the advantages of the already built Swing components to not have to reinvent the wheel  Smiley
Offline cylab

JGO Ninja


Medals: 43



« Reply #11 - Posted 2007-08-08 12:35:01 »

you will have to call JPopupMenu.setDefaultLightWeightPopupEnabled(false); at some time, so your popup-menues appear in front of the canvas.

Mathias - I Know What [you] Did Last Summer!
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

atombrot (26 views)
2014-08-19 09:29:53

Tekkerue (24 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (14 views)
2014-08-16 06:20:21

Tekkerue (22 views)
2014-08-16 06:12:11

Rayexar (60 views)
2014-08-11 02:49:23

BurntPizza (39 views)
2014-08-09 21:09:32

BurntPizza (30 views)
2014-08-08 02:01:56

Norakomi (37 views)
2014-08-06 19:49:38

BurntPizza (67 views)
2014-08-03 02:57:17
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!