Wednesday Sep 28, 2011

JavaOne talk: 2-D UI and 3-D Graphics on the Same Screen for CDC

It is JavaOne time again. Jerry Evans and I are doing the talk on 2D and 3D graphics for CDC. We will show how traditional 2D AWT graphics can be combined with 3D content written in Open GL ES (JSR 239). There will be a few step-by-step examples running on Oracle Java Embedded Client 1.1. The talk is on Wednesday Oct 5th at 10 AM in the San Francisco Parc 55 Hotel.

Also stop by the show floor to see more demos of Embedded Java, Java FX 2.0, Java TV and more.

For details see http://www.oracle.com/javaone/index.html

Tuesday Jun 01, 2010

3D Scene Support in JavaFX TV

Did you know JavaFX TV supports 3D?

JavaFX TV is built on the new Prism toolkit that is built for 3D accelerated graphics hardware. There is new API in JavaFX 1.3 that takes advantage of the 3D features. Transforms like Translate and Rotate now have the third coordinate: "z". They can be used to transform the scene graph nodes in three dimensions. Additionally there is a Scene camera API which can be used to set perspective or parallel camera for the scene.

Here is a sample application demonstrating the 3D scene features. In this sample a single text node is rotated around the "y" axis and is shown using the perspective camera. A simple timeline is used to animate the rotation.

To rotate the node in 3D I use the old familiar Rotate transform, but specify "Y_AXIS" for rotation:

    transforms: Rotate {
        axis: Rotate.Y_AXIS
        angle: bind angle
        pivotX: width/2
    }

Perspective camera for the scene is defined like this:

     camera: PerspectiveCamera{fieldOfView: 60}

Note that you can add effects to the node, just like you would with a 2D node. In this example I used a reflection effect.

Download the sample source code: Main.fx. The app can be run in JavaFX TV emulator or on JavaFX desktop using Prism toolkit (javafx -Xtoolkit prism).

JavaFX does not yet support 3D nodes so you are limited to 3D transformations of 2D nodes. You may also have to write your own z-ordering logic to make the nodes display correctly.

About

user12608660

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today