简体   繁体   中英

Is it possible to make 3D objects with Java's Graphics?

I like to make 2D games on java as a hobby. I just made a version of the game falldown which I think would look great with 3D objects, and I was wondering if that's possible using Graphics g. I know games like minecraft are written in Java which are 3D but does it mean completely redoing the code to make it 3D or is it possible to replace the rectangles I used as bars with 3D versions?

Maybe for some shapes you can (depends on your library/framework that you used), but actually you can't convert your whole 2D game to 3D.

There are some libraries/frameworks which allow you to create 3D games:

  1. JavaFX-3d
  2. Libgdx
  3. Lwgjl (Minecraft used it)
  4. JMonkeyEngine

You can make 3D objects using only existing features in the Java library, but it requires a lot of math and setting up. If you don't care as much about the theory behind 3D graphics and you're simply more interested in using 3D graphics then I would suggest looking into a graphics API such as OpenGL (for which there are a lot of Java tutorials) or the Vulkan API if you have enough knowledge/have the appropriate background.

Yes, it is possible, you can use the OpenGL libraries provided by the JVM.

Although, I don't recommend it, just from my experience, but you are free to try it:

http://opengl.j3d.org/tutorials/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM