Using JAWT implements Web3D

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:
  1. Design your java code to be Applet style, You can adopt eclipse SWT(standard widget toolkit) to support JAWT canvas easier.
  2. 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();
  3. Load library in the java:
        System.loadLibrary("openglAWT");
  4. Compare your java code
    javac to generate .class files.
    javah to generate the c++ header (*.h)
  5. Open your c++ dll project, include the generated header. Implement the native interfaces to let JNI can call these function correctly. Build it, and generate the dll file.

    ***Until this step. If you just want to develop a standalone environment, you have let JAWT and JNI achieve 3D present. However, we aim to move it on browser, so we still some work need to be completed.

  6. Pack your *.dll, *.class, and assets to *.jar files.
         jar cvf native.jar *.dll
        jar cvf j3d.jar *.class
  7. Because your application is on web, you need to certify them is been trusted. We produce the certification file.
    create a keystore keytool -genkey -keystore myKeystore -alias myselfcreate a self-signed certificate keytool -selfcert -alias myself -keystore myKeystore
  8.  Every *.jar file needs to be signed:
       
    jarsigner.exe -keystore myKeystore -storepass    password jarfile.jar myself 
  9. Define your html file
        param name="jnlp_href" value="ellison3D.jnlp"
  10. Describe JNLP param.
        jar href="./commonjar/j3D.jar" main="true" /
       nativelib href="./commonjar/swt.jar"/
       nativelib href="./commonjar/native.jar"/

  11. Put your JNLP near the html file
     
Result: 
  • Direct3D in browsers(IE, Chrome, Firefox)
  • OpenGL in browsers(IE, Chrome, Firefox)


Reference:  

    Comments

    1. This post provides a concise walkthrough of integrating Java with native OpenGL rendering using JAWT and JNI. The explanation covers creating native interfaces, generating JNI headers, building DLLs, packaging JAR files, signing them with certificates, and configuring JNLP for browser deployment, making it a useful reference for developers working with Java-based graphics applications.

      Developers interested in real-time graphics, computer vision, and rendering techniques can also explore Image Processing Projects For Final Year, where GPU-accelerated image manipulation, visualization, and graphical processing play an important role in practical applications.

      ReplyDelete
    2. Since the article demonstrates Java native integration, OpenGL rendering, and platform-level programming, it also aligns with Javascript Training Courses, which help developers build strong programming fundamentals for creating modern interactive and graphics-enabled applications across different platforms.

      ReplyDelete
    3. Readers can also explore Image Processing Projects For Final Year to discover practical applications of graphics programming, image processing, and computer vision techniques used in real-world software development.

      ReplyDelete

    Post a Comment

    Popular posts from this blog

    glTF loader for Android Vulkan

    Drawing textured cube with Vulkan on Android

    Fast subsurface scattering