javauis/m3g_qt/javasrc/javax/microedition/m3g/Graphics3D.java
changeset 35 85266cc22c7f
child 40 c6043ea9b06a
child 78 71ad690e91f5
equal deleted inserted replaced
26:dc7c549001d5 35:85266cc22c7f
       
     1 /*
       
     2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 package javax.microedition.m3g;
       
    20 
       
    21 import javax.microedition.lcdui.Graphics;
       
    22 import java.util.Hashtable;
       
    23 import java.util.Vector;
       
    24 import org.eclipse.swt.widgets.*;
       
    25 import org.eclipse.swt.graphics.*;
       
    26 import org.eclipse.swt.internal.qt.graphics.*;
       
    27 import org.eclipse.swt.internal.qt.GCData;
       
    28 import com.nokia.mj.impl.rt.support.ShutdownListener;
       
    29 import com.nokia.mj.impl.rt.support.ApplicationUtils;
       
    30 import com.nokia.mj.impl.nokialcdui.LCDUIInvoker;
       
    31 
       
    32 
       
    33 public class Graphics3D
       
    34 {
       
    35     //------------------------------------------------------------------
       
    36     // Static data
       
    37     //------------------------------------------------------------------
       
    38 
       
    39     public static final int ANTIALIAS   = 2;
       
    40     public static final int DITHER      = 4;
       
    41     public static final int TRUE_COLOR  = 8;
       
    42 
       
    43     // M3G 1.1
       
    44     public static final int OVERWRITE   = 16;
       
    45 
       
    46     // Singleton instances
       
    47     static Graphics3D s_instance = null;
       
    48 
       
    49     //------------------------------------------------------------------
       
    50     // Instance data
       
    51     //------------------------------------------------------------------
       
    52 
       
    53     int handle;
       
    54     int iSurfaceHandle;
       
    55 
       
    56     private Camera camera = null;
       
    57     private Vector lights = new Vector();
       
    58 
       
    59     private java.lang.Object currentTarget = null;
       
    60     private int offsetX, offsetY, hints = 0;
       
    61     private boolean depthEnabled = true;
       
    62     private Destroyer destroyer;
       
    63     private Interface iInterface;
       
    64 
       
    65     // this flag is for identification of image target types
       
    66     // - True for mutable off-screen images
       
    67     // - False for canvas/GameCanvas framebuffer
       
    68     private boolean iIsImageTarget;
       
    69 
       
    70     // this flag is for identification if MBX HW accelerator is present
       
    71     // - True - MBX is NOT present
       
    72     // - False - MBX is present
       
    73     private boolean iIsProperRenderer;
       
    74 
       
    75     private boolean iNativeInitialized = false;
       
    76 
       
    77     // Shutdown listener
       
    78     private class Destroyer implements ShutdownListener
       
    79     {
       
    80         Graphics3D target;
       
    81 
       
    82         Destroyer(Graphics3D g3d)
       
    83         {
       
    84             target = g3d;
       
    85             ApplicationUtils appUtils = ApplicationUtils.getInstance();
       
    86             appUtils.addShutdownListener(this);
       
    87         }
       
    88 
       
    89         // This method gets called when application is shuttingdown
       
    90         public void shuttingDown()
       
    91         {
       
    92 
       
    93             // Finalize native peer
       
    94             Platform.finalizeObject(target.handle, target.iInterface);
       
    95 
       
    96             // signal shutdown (set shutdown flag)
       
    97             // and remove references
       
    98             target.iInterface.signalShutdown();
       
    99             target.iInterface = null;
       
   100             target.camera = null;
       
   101             //target.s_instance = null;
       
   102 
       
   103             // All done, Call gc() and finalization to collect
       
   104             // remaining objects, thus zeroying liveObjects count
       
   105             // in interface instance
       
   106 
       
   107         }
       
   108     }
       
   109 
       
   110     //------------------------------------------------------------------
       
   111     // Constructor(s)
       
   112     //------------------------------------------------------------------
       
   113     public static final Graphics3D getInstance()
       
   114     {
       
   115 
       
   116         if (s_instance == null)
       
   117         {
       
   118             s_instance = new Graphics3D();
       
   119         }
       
   120         return s_instance;
       
   121     }
       
   122 
       
   123     private Graphics3D()
       
   124     {
       
   125         iInterface = Interface.getInstance();
       
   126         initNativePeer();
       
   127 
       
   128         // setup listener for singleton teardown
       
   129         destroyer = new Destroyer(this);
       
   130     }
       
   131 
       
   132     //------------------------------------------------------------------
       
   133     // Public methods
       
   134     //------------------------------------------------------------------
       
   135 
       
   136     /**
       
   137      */
       
   138     public void bindTarget(java.lang.Object target)
       
   139     {
       
   140         bindTarget(target, true, 0);
       
   141     }
       
   142 
       
   143     /**
       
   144      *
       
   145      */
       
   146     public void bindTarget(java.lang.Object target, boolean depth, int flags)
       
   147     {
       
   148         integrityCheck();
       
   149         if (currentTarget != null)
       
   150         {
       
   151             throw new IllegalStateException();
       
   152         }
       
   153 
       
   154         if (target == null)
       
   155         {
       
   156             throw new NullPointerException();
       
   157         }
       
   158 
       
   159         final int finalFlags = flags;
       
   160         final boolean finalDepth = depth;
       
   161 
       
   162         if (target instanceof org.eclipse.swt.graphics.GC)
       
   163         {
       
   164             Rectangle clip = ((org.eclipse.swt.graphics.GC)target).getClipping();
       
   165             final int clipW = clip.width;
       
   166             final int clipH = clip.height;
       
   167             final int clipX = clip.x;
       
   168             final int clipY = clip.y;
       
   169 
       
   170             if (clipW > Defs.MAX_VIEWPORT_WIDTH ||
       
   171                     clipH > Defs.MAX_VIEWPORT_HEIGHT)
       
   172             {
       
   173                 throw new IllegalArgumentException();
       
   174             }
       
   175 
       
   176             final Object finalTarget = target;
       
   177             Platform.executeInUIThread(
       
   178                 new M3gRunnable()
       
   179             {
       
   180                 public void doRun()
       
   181                 {
       
   182                     GCData gcData = ((org.eclipse.swt.graphics.GC)finalTarget).getGCData();
       
   183                     iSurfaceHandle = gcData.internalGc.getWindowSurface().getHandle();
       
   184                     iIsImageTarget = _bindGraphics(
       
   185                                          handle,
       
   186                                          iSurfaceHandle,
       
   187                                          clipX, clipY,
       
   188                                          clipW, clipH,
       
   189                                          finalDepth, finalFlags,
       
   190                                          iIsProperRenderer);
       
   191                 }
       
   192             });
       
   193             currentTarget = target;
       
   194         }
       
   195 
       
   196         else if (target instanceof Graphics)
       
   197         {
       
   198 
       
   199             Graphics g = (Graphics) target;
       
   200             //Platform.sync(g);
       
   201 
       
   202             if (g.getClipWidth() > Defs.MAX_VIEWPORT_WIDTH ||
       
   203                     g.getClipHeight() > Defs.MAX_VIEWPORT_HEIGHT)
       
   204             {
       
   205                 throw new IllegalArgumentException();
       
   206             }
       
   207 
       
   208             offsetX = g.getTranslateX();
       
   209             offsetY = g.getTranslateY();
       
   210 
       
   211             final Graphics finalG = g;
       
   212 
       
   213             Platform.executeInUIThread(
       
   214                 new M3gRunnable()
       
   215             {
       
   216                 public void doRun()
       
   217                 {
       
   218                     LCDUIInvoker.startExternalRendering( finalG );
       
   219                     iSurfaceHandle = LCDUIInvoker.getWindowSurface(finalG).getHandle();
       
   220                     iIsImageTarget = _bindGraphics(
       
   221                                          handle,
       
   222                                          iSurfaceHandle,
       
   223                                          finalG.getClipX() + offsetX, finalG.getClipY() + offsetY,
       
   224                                          finalG.getClipWidth(), finalG.getClipHeight(),
       
   225                                          finalDepth, finalFlags,
       
   226                                          iIsProperRenderer);
       
   227                 }
       
   228             });
       
   229             currentTarget = g;
       
   230         }
       
   231         else if (target instanceof Image2D)
       
   232         {
       
   233             Image2D img = (Image2D) target;
       
   234 
       
   235             offsetX = offsetY = 0;
       
   236             final int imageHandle = img.handle;
       
   237 
       
   238             Platform.executeInUIThread(
       
   239                 new M3gRunnable()
       
   240             {
       
   241                 public void doRun()
       
   242                 {
       
   243                     _bindImage(handle, imageHandle, finalDepth, finalFlags);
       
   244                 }
       
   245             });
       
   246             currentTarget = img;
       
   247         }
       
   248         else
       
   249         {
       
   250             throw new IllegalArgumentException();
       
   251         }
       
   252 
       
   253         hints = flags;
       
   254         depthEnabled = depth;
       
   255     }
       
   256 
       
   257     /**
       
   258      *
       
   259      */
       
   260     public void releaseTarget()
       
   261     {
       
   262         integrityCheck();
       
   263         if (currentTarget == null)
       
   264         {
       
   265             return;
       
   266         }
       
   267 
       
   268         if (currentTarget instanceof org.eclipse.swt.graphics.GC)
       
   269         {
       
   270             Platform.executeInUIThread(
       
   271                 new M3gRunnable()
       
   272             {
       
   273                 public void doRun()
       
   274                 {
       
   275                     _releaseGraphics(handle,
       
   276                                      iSurfaceHandle, iIsImageTarget, iIsProperRenderer);
       
   277                 }
       
   278             });
       
   279         }
       
   280         else if (currentTarget instanceof Graphics)
       
   281         {
       
   282                 final Graphics finalG = (Graphics)currentTarget;
       
   283                 Platform.executeInUIThread(
       
   284                     new M3gRunnable()
       
   285                 {
       
   286                     public void doRun()
       
   287                     {
       
   288                         _releaseGraphics(handle,
       
   289                                          iSurfaceHandle, iIsImageTarget, iIsProperRenderer);
       
   290                         LCDUIInvoker.endExternalRendering( finalG );
       
   291                     }
       
   292                 });
       
   293             /*
       
   294             Graphics g = (Graphics) currentTarget;
       
   295 
       
   296             //ToolkitInvoker invoker = ToolkitInvoker.getToolkitInvoker();
       
   297 
       
   298             Platform.getUIThread().syncExec(
       
   299                     new Runnable() {
       
   300                         public void run() {
       
   301                                         _releaseGraphics( handle,
       
   302                                         invoker.graphicsGetHandle(g), iIsImageTarget, iIsProperRenderer );
       
   303                                 }
       
   304                         });
       
   305                         */
       
   306         }
       
   307         else if (currentTarget instanceof Image2D)
       
   308         {
       
   309             Platform.executeInUIThread(
       
   310                 new M3gRunnable()
       
   311             {
       
   312                 public void doRun()
       
   313                 {
       
   314                     _releaseImage(handle);
       
   315                 }
       
   316             });
       
   317         }
       
   318         else
       
   319         {
       
   320             throw new Error();
       
   321         }
       
   322         currentTarget = null;
       
   323         iSurfaceHandle = 0;
       
   324     }
       
   325 
       
   326     /**
       
   327      *
       
   328      */
       
   329     public void setViewport(int x, int y, int width, int height)
       
   330     {
       
   331         integrityCheck();
       
   332         if (width <= 0 || height <= 0
       
   333                 || width  > Defs.MAX_VIEWPORT_DIMENSION
       
   334                 || height > Defs.MAX_VIEWPORT_DIMENSION)
       
   335         {
       
   336             throw new IllegalArgumentException();
       
   337         }
       
   338         _setViewport(handle, x + offsetX, y + offsetY, width, height);
       
   339     }
       
   340 
       
   341     /**
       
   342      *
       
   343      */
       
   344     public void clear(Background background)
       
   345     {
       
   346         integrityCheck();
       
   347         final Background finalBackground = background;
       
   348         Platform.executeInUIThread(
       
   349             new M3gRunnable()
       
   350         {
       
   351             public void doRun()
       
   352             {
       
   353                 _clear(handle, finalBackground != null ? finalBackground.handle : 0);
       
   354             }
       
   355         });
       
   356     }
       
   357 
       
   358     /**
       
   359      *
       
   360      */
       
   361     public void render(World world)
       
   362     {
       
   363         integrityCheck();
       
   364         final World finalWorld = world;
       
   365         Platform.executeInUIThread(
       
   366             new M3gRunnable()
       
   367         {
       
   368             public void doRun()
       
   369             {
       
   370                 _renderWorld(handle, finalWorld.handle);
       
   371             }
       
   372         });
       
   373     }
       
   374 
       
   375     /**
       
   376      *
       
   377      */
       
   378     public void render(VertexBuffer vertices,
       
   379                        IndexBuffer primitives,
       
   380                        Appearance appearance,
       
   381                        Transform transform)
       
   382     {
       
   383         // Call rendering method with default visibility
       
   384         integrityCheck();
       
   385         render(vertices, primitives, appearance, transform, -1);
       
   386     }
       
   387 
       
   388     /**
       
   389      *
       
   390      */
       
   391     public void render(VertexBuffer vertices,
       
   392                        IndexBuffer primitives,
       
   393                        Appearance appearance,
       
   394                        Transform transform,
       
   395                        int scope)
       
   396     {
       
   397 
       
   398         // null pointer exceptions thrown automatically below
       
   399         integrityCheck();
       
   400 
       
   401         final VertexBuffer finalVertices = vertices;
       
   402         final IndexBuffer finalPrimitives = primitives;
       
   403         final Appearance finalAppearance = appearance;
       
   404         final Transform finalTransform = transform;
       
   405         final int finalScope = scope;
       
   406 
       
   407         Platform.executeInUIThread(
       
   408             new M3gRunnable()
       
   409         {
       
   410             public void doRun()
       
   411             {
       
   412                 _render(handle,
       
   413                         finalVertices.handle,
       
   414                         finalPrimitives.handle,
       
   415                         finalAppearance.handle,
       
   416                         finalTransform != null ? finalTransform.matrix : null,
       
   417                         finalScope);
       
   418             }
       
   419         });
       
   420     }
       
   421 
       
   422     /**
       
   423      *
       
   424      */
       
   425     public void render(Node node, Transform transform)
       
   426     {
       
   427         if (!(node instanceof Mesh
       
   428                 || node instanceof Sprite3D
       
   429                 || node instanceof Group)
       
   430                 && node != null)
       
   431         {
       
   432             throw new IllegalArgumentException();
       
   433         }
       
   434         integrityCheck();
       
   435 
       
   436         final Node finalNode = node;
       
   437         final Transform finalTransform = transform;
       
   438 
       
   439         Platform.executeInUIThread(
       
   440             new M3gRunnable()
       
   441         {
       
   442             public void doRun()
       
   443             {
       
   444                 _renderNode(handle,
       
   445                             finalNode.handle,
       
   446                             finalTransform != null ? finalTransform.matrix : null);
       
   447             }
       
   448         });
       
   449     }
       
   450 
       
   451 
       
   452     public void setCamera(Camera camera, Transform transform)
       
   453     {
       
   454         integrityCheck();
       
   455         _setCamera(handle,
       
   456                    camera != null ? camera.handle : 0,
       
   457                    transform != null ? transform.matrix : null);
       
   458 
       
   459         this.camera = camera;
       
   460     }
       
   461 
       
   462     /**
       
   463      */
       
   464     public int addLight(Light light, Transform transform)
       
   465     {
       
   466         integrityCheck();
       
   467         int index = _addLight(handle,
       
   468                               light.handle,
       
   469                               transform != null ? transform.matrix : null);
       
   470         if (lights.size() < index + 1)
       
   471         {
       
   472             lights.setSize(index + 1);
       
   473         }
       
   474         lights.setElementAt(light, index);
       
   475         return index;
       
   476     }
       
   477 
       
   478     /**
       
   479      *
       
   480      */
       
   481     public void setLight(int index, Light light, Transform transform)
       
   482     {
       
   483         integrityCheck();
       
   484         _setLight(handle,
       
   485                   index,
       
   486                   light != null ? light.handle : 0,
       
   487                   transform != null ? transform.matrix : null);
       
   488         lights.setElementAt(light, index);
       
   489     }
       
   490 
       
   491     /**
       
   492      */
       
   493     public void resetLights()
       
   494     {
       
   495         integrityCheck();
       
   496         _resetLights(handle);
       
   497         lights.removeAllElements();
       
   498     }
       
   499 
       
   500     /**
       
   501      *
       
   502      */
       
   503     public static final Hashtable getProperties()
       
   504     {
       
   505         Hashtable props = new Hashtable();
       
   506 
       
   507         props.put("supportAntialiasing",          new java.lang.Boolean(
       
   508                       _isAASupported(Interface.getHandle())));
       
   509         props.put("supportTrueColor",             new java.lang.Boolean(Defs.supportTrueColor));
       
   510         props.put("supportDithering",             new java.lang.Boolean(Defs.supportDithering));
       
   511         props.put("supportMipmapping",            new java.lang.Boolean(Defs.supportMipmapping));
       
   512         props.put("supportPerspectiveCorrection", new java.lang.Boolean(Defs.supportPerspectiveCorrection));
       
   513         props.put("supportLocalCameraLighting",   new java.lang.Boolean(Defs.supportLocalCameraLighting));
       
   514         props.put("maxLights",                    new java.lang.Integer(Defs.MAX_LIGHTS));
       
   515         props.put("maxViewportWidth",             new java.lang.Integer(Defs.MAX_VIEWPORT_WIDTH));
       
   516         props.put("maxViewportHeight",            new java.lang.Integer(Defs.MAX_VIEWPORT_HEIGHT));
       
   517         props.put("maxViewportDimension",         new java.lang.Integer(Defs.MAX_VIEWPORT_DIMENSION));
       
   518         props.put("maxTextureDimension",          new java.lang.Integer(Defs.MAX_TEXTURE_DIMENSION));
       
   519         props.put("maxSpriteCropDimension",       new java.lang.Integer(Defs.MAX_TEXTURE_DIMENSION));
       
   520         props.put("numTextureUnits",              new java.lang.Integer(Defs.NUM_TEXTURE_UNITS));
       
   521         props.put("maxTransformsPerVertex",       new java.lang.Integer(Defs.MAX_TRANSFORMS_PER_VERTEX));
       
   522 
       
   523         // Extra properties
       
   524         props.put("m3gRelease",                   new java.lang.String("04_wk49"));
       
   525 
       
   526         return props;
       
   527     }
       
   528 
       
   529     /**
       
   530      *
       
   531      */
       
   532     public void setDepthRange(float near, float far)
       
   533     {
       
   534         integrityCheck();
       
   535         _setDepthRange(handle, near, far);
       
   536     }
       
   537 
       
   538     // M3G 1.1
       
   539 
       
   540     public Camera getCamera(Transform transform)
       
   541     {
       
   542         integrityCheck();
       
   543         if (transform != null)
       
   544         {
       
   545             _getViewTransform(handle, transform.matrix);
       
   546         }
       
   547 
       
   548         return (Camera) Object3D.getInstance(_getCamera(handle));
       
   549     }
       
   550 
       
   551     public float getDepthRangeFar()
       
   552     {
       
   553         integrityCheck();
       
   554         return _getDepthRangeFar(handle);
       
   555     }
       
   556 
       
   557     public float getDepthRangeNear()
       
   558     {
       
   559         integrityCheck();
       
   560         return _getDepthRangeNear(handle);
       
   561     }
       
   562 
       
   563     public Light getLight(int index, Transform transform)
       
   564     {
       
   565         integrityCheck();
       
   566         if (index < 0 || index >= _getLightCount(handle))
       
   567         {
       
   568             throw new IndexOutOfBoundsException();
       
   569         }
       
   570 
       
   571         return (Light) Object3D.getInstance(_getLightTransform(handle,
       
   572                                             index,
       
   573                                             transform != null ? transform.matrix : null));
       
   574     }
       
   575 
       
   576     public int getLightCount()
       
   577     {
       
   578         integrityCheck();
       
   579         return _getLightCount(handle);
       
   580     }
       
   581 
       
   582     public java.lang.Object getTarget()
       
   583     {
       
   584         return currentTarget;
       
   585     }
       
   586 
       
   587     public int getViewportHeight()
       
   588     {
       
   589         integrityCheck();
       
   590         return _getViewportHeight(handle);
       
   591     }
       
   592 
       
   593     public int getViewportWidth()
       
   594     {
       
   595         integrityCheck();
       
   596         return _getViewportWidth(handle);
       
   597     }
       
   598 
       
   599     public int getViewportX()
       
   600     {
       
   601         integrityCheck();
       
   602         return _getViewportX(handle) - offsetX;
       
   603     }
       
   604 
       
   605     public int getViewportY()
       
   606     {
       
   607         integrityCheck();
       
   608         return _getViewportY(handle) - offsetY;
       
   609     }
       
   610 
       
   611     public int getHints()
       
   612     {
       
   613         return hints;
       
   614     }
       
   615 
       
   616     public boolean isDepthBufferEnabled()
       
   617     {
       
   618         return depthEnabled;
       
   619     }
       
   620 
       
   621     // M3G 1.1 getters END
       
   622 
       
   623     //------------------------------------------------------------------
       
   624     // Private methods
       
   625     //------------------------------------------------------------------
       
   626 
       
   627     private void integrityCheck()
       
   628     {
       
   629         if (iInterface == null)
       
   630         {
       
   631             throw new RuntimeException("Graphics3D closed");
       
   632         }
       
   633         if (!iNativeInitialized)
       
   634         {
       
   635             // If native interface cannot be initialized we cannot recover from it
       
   636             if (!initNativePeer())
       
   637             {
       
   638                 throw new Error("UI thread not available");
       
   639             }
       
   640         }
       
   641     }
       
   642 
       
   643     /**
       
   644      * Initializes native peer
       
   645      * @return true if native interface was succesfully inialized otherwise false
       
   646      */
       
   647     private boolean initNativePeer()
       
   648     {
       
   649         if (iNativeInitialized)
       
   650         {
       
   651             return true;
       
   652         }
       
   653         if (iInterface.isFullyInitialized() && Platform.uiThreadAvailable())
       
   654         {
       
   655             handle = _ctor(iInterface.getHandle());
       
   656             _addRef(handle);
       
   657 
       
   658             Platform.executeInUIThread(
       
   659                 new M3gRunnable()
       
   660             {
       
   661                 public void doRun()
       
   662                 {
       
   663                     iIsProperRenderer = _isProperRenderer();
       
   664                 }
       
   665             });
       
   666             iNativeInitialized = true;
       
   667             return true;
       
   668         }
       
   669         else
       
   670         {
       
   671             return false;
       
   672         }
       
   673     }
       
   674 
       
   675     //------------------------------------------------------------------
       
   676     // Native implementation methods
       
   677     //------------------------------------------------------------------
       
   678     private native static int _ctor(int hInterface);
       
   679     private native static void _addRef(int hObject);
       
   680     private native static int _addLight(int handle,
       
   681                                         int hLight,
       
   682                                         byte[] transform);
       
   683     private native static boolean _bindGraphics(int handle,
       
   684             int surfaceHandle,
       
   685             int clipX, int clipY,
       
   686             int clipW, int clipH,
       
   687             boolean depth,
       
   688             int hintBits,
       
   689             boolean aIsProperRenderer);
       
   690     private native static void _bindImage(int handle, int imgHandle, boolean depth, int hintBits);
       
   691     private native static void _releaseGraphics(int handle,
       
   692             int surfaceHandle,
       
   693             boolean aIsImageTarget,
       
   694             boolean aIsProperRenderer);
       
   695     private native static void _releaseImage(int handle);
       
   696     private native static void _resetLights(int handle);
       
   697     private native static void _clear(int handle, int hBackground);
       
   698     private native static void _render(int handle,
       
   699                                        int hVtxBuffer,
       
   700                                        int hIdxBuffer,
       
   701                                        int hAppearance,
       
   702                                        byte[] transform,
       
   703                                        int scope);
       
   704     private native static void _renderNode(int handle, int hNode, byte[] transform);
       
   705     private native static void _renderWorld(int handle, int hWorld);
       
   706     private native static void _setCamera(int handle,
       
   707                                           int hCamera,
       
   708                                           byte[] transform);
       
   709     private native static void _setViewport(int handle,
       
   710                                             int x, int y,
       
   711                                             int width, int height);
       
   712     private native static void _setLight(int handle,
       
   713                                          int index,
       
   714                                          int hLight,
       
   715                                          byte[] transform);
       
   716     private native static void _setDepthRange(int handle,
       
   717             float near,
       
   718             float far);
       
   719 
       
   720     // M3G 1.1
       
   721     // Maintenance release getters
       
   722 
       
   723     private native static void _getViewTransform(int handle,
       
   724             byte[] transform);
       
   725     private native static int _getCamera(int handle);
       
   726     private native static int _getLightTransform(int handle,
       
   727             int index,
       
   728             byte[] transform);
       
   729     private native static int _getLightCount(int handle);
       
   730     private native static float _getDepthRangeNear(int handle);
       
   731     private native static float _getDepthRangeFar(int handle);
       
   732     private native static int _getViewportX(int handle);
       
   733     private native static int _getViewportY(int handle);
       
   734     private native static int _getViewportWidth(int handle);
       
   735     private native static int _getViewportHeight(int handle);
       
   736 
       
   737     /* Statistics support, MUST be disabled in official releases! */
       
   738     /*
       
   739         public native static int getStatistics(int[] statistics);
       
   740     */
       
   741     private native static boolean _isAASupported(int handle);
       
   742     private native static boolean _isProperRenderer();
       
   743 }