Java FX is about to support 3D !!

Source: Internet
Author: User

 Although I am working on Android Development, I am still learning unity3d in my spare time. We also created an online tank combat game. At night, I only learned about iOS development on Mac Mini, so I didn't write a blog much.

Javafx was very interested in it before, but later I found that javafx is only suitable for developing small games. For larger games, it is not efficient enough. So I haven't studied javafx for a while.

But there is also good news about javafx. in JDK 8, javafx is about to support 3D. Including 3D mesh, camera, and lighting.

JDK 8: http://jdk8.java.net/download.html

Below is a small example:

Import javafx. application. application; import javafx. scene. *; import javafx. scene. paint. color; import javafx. scene. paint. phongmaterial; import javafx. scene. shape. *; import javafx. stage. stage; public class shapes3dviewer extends application {@ override public void start (stage) {phongmaterial material = new phongmaterial (); material. setdiffusecolor (color. lightgray); material. setspecularcolor (color. RGB (30, 30, 30); shape3d [] meshview = new shape3d [] {new box (200,200,200), new sphere (100), new cylinder (100,200 ),}; for (INT I = 0; I! = 3; ++ I) {meshview [I]. setmaterial (material); meshview [I]. settranslatex (I + 1) * 220); meshview [I]. settranslate( 500); meshview [I]. settranslatez (20); meshview [I]. setdrawmode (drawmode. fill); meshview [I]. setcullface (cullface. back) ;}; pointlight = new pointlight (color. antiquewhite); pointlight. settranslators (800); pointlight. settranslatey (-100); pointlight. settranslatez (-1000); group root = new group (meshview); root. getchildren (). add (pointlight); scene = new scene (root, 800,800, true); scene. setfill (color. RGB (10, 10, 40); scene. setcamera (New perspectivecamera (false); stage. setscene (scene); stage. show () ;}public static void main (string [] ARGs) {launch (ARGs );}}


 However, currently, only Windows platforms are supported. OpenGL versions that can be used on other platforms are under development.

If you are interested, download JDK 8 and try it.



Add the javafx 3D content planned to be added to JDK 8:

Https://wikis.oracle.com/display/OpenJDK/3D+Features


You can see the camera, 3D geometric elements, lights, materials, 3D pickup, 3D model loading, and other content.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.