Posts

Showing posts from August, 2011

Using JAWT implements Web3D

Image
JAWT ( Java Abstract Window Toolkit )
    Java use it to define the different OS's create window layer, we get this window's handle by JAWT. In this approach we can draw 3D objects presented on the window's handle, which is by GPU acceleration.


JNI ( Java Native Interface )
   Java can upload native program's library ( etc: *.dll ). Call the native function defined in this linked library.



STEPS:
Design your java code to be Applet style, You can adopt eclipse SWT(standard widget toolkit) to support JAWT canvas easier.Define the native interface in your *.java file. Like this:
  // native entry point for Painting
    public native void paintOpenGL();

    // native entry point for enabling OpenGL calls.
    public native void initializeOpenGL();

    // native entry point for disabling OpenGL calls.
    public native void cleanupOpenGL();
Load library in the java:
System.loadLibrary("openglAWT");Compare your java code
javac to generate .class files.
javah to generate …

World to View matrix from Z up right-hand to Y up left-hand

position.x = (-1) * rightVector.dotProduct( orgin );
position.y = (-1) * lookVector.dotProduct( orgin );
position.z = (-1) * upVector.dotProduct( orgin );

_viewMtx.identity();

var data:Vector. = _rotateMtx.rawData;

// inverse mtx, and then Z up Y-Z plane to Y up Z-Y plane.
_viewMtx.copyRawDataFrom(
                Vector.(
                    [    data[0], data[8],  data[4], 0.0,
                        data[1], data[9],  data[5], 0.0,
                        data[2], data[10],  data[6], 0.0,
                        position.x, position.z,  position.y, 1.0 ] )
            );

Using JNI embed OGRE3D in webpage

Virtualization

Flash "Molehill" vs Shockwave 3D