Source Code Cross Referenced for NativePipeline.java in  » 6.0-JDK-Modules » java-3d » javax » media » j3d » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » java 3d » javax.media.j3d 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * $RCSfile: NativePipeline.java,v $
0003:         *
0004:         * Copyright 2006-2008 Sun Microsystems, Inc.  All Rights Reserved.
0005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0006:         *
0007:         * This code is free software; you can redistribute it and/or modify it
0008:         * under the terms of the GNU General Public License version 2 only, as
0009:         * published by the Free Software Foundation.  Sun designates this
0010:         * particular file as subject to the "Classpath" exception as provided
0011:         * by Sun in the LICENSE file that accompanied this code.
0012:         *
0013:         * This code is distributed in the hope that it will be useful, but WITHOUT
0014:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0015:         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
0016:         * version 2 for more details (a copy is included in the LICENSE file that
0017:         * accompanied this code).
0018:         *
0019:         * You should have received a copy of the GNU General Public License version
0020:         * 2 along with this work; if not, write to the Free Software Foundation,
0021:         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0022:         *
0023:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
0024:         * CA 95054 USA or visit www.sun.com if you need additional information or
0025:         * have any questions.
0026:         *
0027:         * $Revision: 1.13 $
0028:         * $Date: 2008/02/28 20:17:26 $
0029:         * $State: Exp $
0030:         */
0031:
0032:        package javax.media.j3d;
0033:
0034:        import java.awt.GraphicsConfiguration;
0035:        import java.awt.GraphicsDevice;
0036:        import java.io.File;
0037:        import java.lang.reflect.InvocationTargetException;
0038:        import java.lang.reflect.Method;
0039:        import java.security.AccessController;
0040:        import java.util.ArrayList;
0041:
0042:        /**
0043:         * Concrete implementation of Pipeline class for native OGL and D3D rendering
0044:         * pipeline.
0045:         */
0046:        class NativePipeline extends Pipeline {
0047:
0048:            // System properties containing the native library search PATH
0049:            // The order listed is the order in which they will be searched
0050:            private static final String[] systemPathProps = {
0051:                    "sun.boot.library.path", "java.library.path" };
0052:
0053:            // Prefix for native libraries
0054:            private static final String libPrefix = "j3dcore";
0055:
0056:            // Boolean indicating whether we are using D3D or OGL
0057:            private boolean isD3D;
0058:
0059:            // Renderer name, either "ogl" or "d3d"
0060:            private String rendererName;
0061:
0062:            // Flags indicating whether the Cg or GLSL libraries are available.
0063:            private boolean cgLibraryAvailable = false;
0064:            private boolean glslLibraryAvailable = false;
0065:
0066:            // Flag indicating that the ogl-chk library has been loaded
0067:            private static boolean oglChkLibraryLoaded = false;
0068:
0069:            // Method to return the vendor string for the native OpenGL pipeline.
0070:            // If the native library cannot be loaded, or if GL_VERSION < 1.2
0071:            // then null is returned.
0072:            static String getSupportedOglVendor() {
0073:                if (!oglChkLibraryLoaded) {
0074:                    try {
0075:                        loadLibrary("j3dcore-ogl-chk", true);
0076:                    } catch (Exception ex) {
0077:                        MasterControl.getCoreLogger().severe(ex.toString());
0078:                        return null;
0079:                    } catch (Error ex) {
0080:                        MasterControl.getCoreLogger().severe(ex.toString());
0081:                        return null;
0082:                    }
0083:                    oglChkLibraryLoaded = true;
0084:                }
0085:                return getSupportedOglVendorNative();
0086:            }
0087:
0088:            // Native method to return the vendor string
0089:            private static native String getSupportedOglVendorNative();
0090:
0091:            /**
0092:             * Constructor for singleton NativePipeline instance
0093:             */
0094:            protected NativePipeline() {
0095:            }
0096:
0097:            /**
0098:             * Initialize the pipeline
0099:             */
0100:            void initialize(Pipeline.Type pipelineType) {
0101:                super .initialize(pipelineType);
0102:
0103:                // This works around a native load library bug
0104:                try {
0105:                    java.awt.Toolkit toolkit = java.awt.Toolkit
0106:                            .getDefaultToolkit();
0107:                    toolkit = null; // just making sure GC collects this
0108:                } catch (java.awt.AWTError e) {
0109:                }
0110:
0111:                switch (pipelineType) {
0112:                case NATIVE_OGL:
0113:                    isD3D = false;
0114:                    rendererName = "ogl";
0115:                    break;
0116:                case NATIVE_D3D:
0117:                    isD3D = true;
0118:                    rendererName = "d3d";
0119:                    break;
0120:                default:
0121:                    assert false; // Should never get here
0122:                }
0123:
0124:                // Create the singleton, OS-dependent NativeConfigTemplate3D and
0125:                // NativeScreenInfo objects.
0126:                NativeConfigTemplate3D.createNativeConfigTemplate3D();
0127:                NativeScreenInfo.createNativeScreenInfo();
0128:            }
0129:
0130:            /**
0131:             * Load all of the required libraries
0132:             */
0133:            void loadLibraries(int globalShadingLanguage) {
0134:                // Load the native JAWT library as a workaround for a problem whereby
0135:                // the native libraries can't find it in some cases.
0136:                // Issue 257: ignore UnsatisfiedLinkError exception as a result of
0137:                // trying to load the library more than once. Try to continue in
0138:                // all cases if the load library fails, since it is just a workaround
0139:                // for a native bug.
0140:                try {
0141:                    loadLibrary("jawt", false);
0142:                } catch (UnsatisfiedLinkError ex) {
0143:                    if (ex.getMessage().indexOf("already loaded") == -1) {
0144:                        // If it failed for a reason other than already being
0145:                        // loaded, log the error. In either case, we will continue
0146:                        MasterControl.getCoreLogger().severe(ex.toString());
0147:                    }
0148:                } catch (Error ex) {
0149:                    MasterControl.getCoreLogger().severe(ex.toString());
0150:                } catch (Exception ex) {
0151:                    MasterControl.getCoreLogger().severe(ex.toString());
0152:                }
0153:
0154:                // Load the native rendering library
0155:                String libraryName = libPrefix + "-" + rendererName;
0156:                loadLibrary(libraryName, true);
0157:
0158:                // Check whether the Cg library is available
0159:                if (globalShadingLanguage == Shader.SHADING_LANGUAGE_CG) {
0160:                    String cgLibraryName = libPrefix + "-" + rendererName
0161:                            + "-cg";
0162:                    String[] libpath = setupLibPath(cgLibraryName);
0163:                    cgLibraryAvailable = loadNativeCgLibrary(libpath);
0164:                }
0165:
0166:                // Check whether the GLSL library is available
0167:                if (globalShadingLanguage == Shader.SHADING_LANGUAGE_GLSL) {
0168:                    if (getPipelineType() == Pipeline.Type.NATIVE_OGL) {
0169:                        // No need to verify that GLSL is available, since GLSL is part
0170:                        // of OpenGL as an extension (or part of core in 2.0)
0171:                        glslLibraryAvailable = true;
0172:                    }
0173:                }
0174:            }
0175:
0176:            /**
0177:             * Returns true if the Cg library is loaded and available. Note that this
0178:             * does not necessarily mean that Cg is supported by the graphics card.
0179:             */
0180:            boolean isCgLibraryAvailable() {
0181:                return cgLibraryAvailable;
0182:            }
0183:
0184:            /**
0185:             * Returns true if the GLSL library is loaded and available. Note that this
0186:             * does not necessarily mean that GLSL is supported by the graphics card.
0187:             */
0188:            boolean isGLSLLibraryAvailable() {
0189:                return glslLibraryAvailable;
0190:            }
0191:
0192:            /**
0193:             * Load the specified native library. If we are running in "appletLauncher"
0194:             * mode, we will use JNLPAppletLauncher to load the native library.
0195:             * Otherwise, we will use System.loadLibrary().
0196:             */
0197:            private static void loadLibrary(final String libName,
0198:                    boolean allowAppletLauncher) {
0199:                // Issue 257: Call JNLPAppletLauncher to load native libraries if needed
0200:                final boolean useAppletLauncher = allowAppletLauncher
0201:                        && MasterControl.isAppletLauncher();
0202:                AccessController
0203:                        .doPrivileged(new java.security.PrivilegedAction() {
0204:                            public Object run() {
0205:                                boolean loaded = false;
0206:                                if (useAppletLauncher) {
0207:                                    try {
0208:                                        Class jnlpAppletLauncherClass = Class
0209:                                                .forName("org.jdesktop.applet.util.JNLPAppletLauncher");
0210:                                        Method loadLibraryMethod = jnlpAppletLauncherClass
0211:                                                .getDeclaredMethod(
0212:                                                        "loadLibrary",
0213:                                                        String.class);
0214:                                        loadLibraryMethod.invoke(null, libName);
0215:                                        loaded = true;
0216:                                    } catch (ClassNotFoundException ex) {
0217:                                        System.err
0218:                                                .println("Java 3D: loadLibrary("
0219:                                                        + libName + ")");
0220:                                        System.err.println(ex);
0221:                                        System.err
0222:                                                .println("Attempting to use System.loadLibrary instead");
0223:                                    } catch (Exception ex) {
0224:                                        Throwable t = ex;
0225:                                        if (t instanceof  InvocationTargetException) {
0226:                                            t = ((InvocationTargetException) t)
0227:                                                    .getTargetException();
0228:                                        }
0229:                                        if (t instanceof  Error) {
0230:                                            throw (Error) t;
0231:                                        }
0232:                                        if (t instanceof  RuntimeException) {
0233:                                            throw (RuntimeException) t;
0234:                                        }
0235:                                        // Throw UnsatisfiedLinkError for best compatibility with System.loadLibrary()
0236:                                        throw (UnsatisfiedLinkError) new UnsatisfiedLinkError()
0237:                                                .initCause(ex);
0238:                                    }
0239:                                }
0240:
0241:                                if (!loaded) {
0242:                                    System.loadLibrary(libName);
0243:                                }
0244:                                return null;
0245:                            }
0246:                        });
0247:            }
0248:
0249:            /**
0250:             * Parse the specified System properties containing a PATH and return an
0251:             * array of Strings, where each element is an absolute filename consisting of
0252:             * the individual component of the path concatenated with the (relative)
0253:             * library file name. Only those absolute filenames that exist are included.
0254:             * If no absolute filename is found, we will try the relative library name.
0255:             */
0256:            private String[] setupLibPath(String libName) {
0257:                final String libraryName = libName;
0258:                return (String[]) AccessController
0259:                        .doPrivileged(new java.security.PrivilegedAction() {
0260:                            public Object run() {
0261:                                ArrayList pathList = new ArrayList();
0262:
0263:                                String filename = System
0264:                                        .mapLibraryName(libraryName);
0265:                                for (int n = 0; n < systemPathProps.length; n++) {
0266:                                    String pathString = System
0267:                                            .getProperty(systemPathProps[n]);
0268:                                    boolean done = false;
0269:                                    int posStart = 0;
0270:                                    while (!done) {
0271:                                        int posEnd = pathString.indexOf(
0272:                                                File.pathSeparator, posStart);
0273:                                        if (posEnd == -1) {
0274:                                            posEnd = pathString.length();
0275:                                            done = true;
0276:                                        }
0277:                                        String pathDir = pathString.substring(
0278:                                                posStart, posEnd);
0279:                                        File pathFile = new File(pathDir,
0280:                                                filename);
0281:                                        if (pathFile.exists()) {
0282:                                            pathList.add(pathFile
0283:                                                    .getAbsolutePath());
0284:                                        }
0285:
0286:                                        posStart = posEnd + 1;
0287:                                    }
0288:                                }
0289:
0290:                                // If no absolute path names exist, add in the relative library name
0291:                                if (pathList.size() == 0) {
0292:                                    pathList.add(filename);
0293:                                }
0294:
0295:                                return (String[]) pathList
0296:                                        .toArray(new String[0]);
0297:                            }
0298:                        });
0299:            }
0300:
0301:            // Method to verify whether the native Cg library is available
0302:            private native boolean loadNativeCgLibrary(String[] libpath);
0303:
0304:            //
0305:            // Methods to box/unbox various native objects
0306:            //
0307:
0308:            private long unbox(Context ctx) {
0309:                if (ctx == null) {
0310:                    return 0;
0311:                } else {
0312:                    return ((NativeContext) ctx).getNativeCtx();
0313:                }
0314:            }
0315:
0316:            private Context boxContext(long nativeCtx) {
0317:                if (nativeCtx == 0) {
0318:                    return null;
0319:                } else {
0320:                    return new NativeContext(nativeCtx);
0321:                }
0322:            }
0323:
0324:            private long unbox(Drawable drawable) {
0325:                if (drawable == null) {
0326:                    return 0;
0327:                } else {
0328:                    return ((NativeDrawable) drawable).getNativeDrawable();
0329:                }
0330:            }
0331:
0332:            private Drawable boxDrawable(long nativeDrawable) {
0333:                if (nativeDrawable == 0) {
0334:                    return null;
0335:                } else {
0336:                    return new NativeDrawable(nativeDrawable);
0337:                }
0338:            }
0339:
0340:            private long unbox(ShaderProgramId shaderProgramId) {
0341:                if (shaderProgramId == null) {
0342:                    return 0;
0343:                } else {
0344:                    return ((NativeShaderObject) shaderProgramId).getNativeId();
0345:                }
0346:            }
0347:
0348:            private ShaderProgramId boxShaderProgramId(long nativeId) {
0349:                if (nativeId == 0) {
0350:                    return null;
0351:                } else {
0352:                    return new NativeShaderObject(nativeId);
0353:                }
0354:            }
0355:
0356:            private long unbox(ShaderId shaderId) {
0357:                if (shaderId == null) {
0358:                    return 0;
0359:                } else {
0360:                    return ((NativeShaderObject) shaderId).getNativeId();
0361:                }
0362:            }
0363:
0364:            private ShaderId boxShaderId(long nativeId) {
0365:                if (nativeId == 0) {
0366:                    return null;
0367:                } else {
0368:                    return new NativeShaderObject(nativeId);
0369:                }
0370:            }
0371:
0372:            private long unbox(ShaderAttrLoc attrLoc) {
0373:                if (attrLoc == null) {
0374:                    return -1;
0375:                } else {
0376:                    return ((NativeShaderObject) attrLoc).getNativeId();
0377:                }
0378:            }
0379:
0380:            private ShaderAttrLoc boxShaderAttrLoc(long nativeId) {
0381:                if (nativeId == -1) {
0382:                    return null;
0383:                } else {
0384:                    return new NativeShaderObject(nativeId);
0385:                }
0386:            }
0387:
0388:            // ---------------------------------------------------------------------
0389:
0390:            //
0391:            // GeometryArrayRetained methods
0392:            //
0393:
0394:            // Used by D3D to free vertex buffer
0395:            native void freeD3DArray(GeometryArrayRetained geo, boolean deleteVB);
0396:
0397:            // used for GeometryArrays by Copy or interleaved
0398:            native void execute(long ctx, GeometryArrayRetained geo,
0399:                    int geo_type, boolean isNonUniformScale, boolean useAlpha,
0400:                    boolean ignoreVertexColors, int startVIndex, int vcount,
0401:                    int vformat, int texCoordSetCount, int[] texCoordSetMap,
0402:                    int texCoordSetMapLen, int[] texCoordSetOffset,
0403:                    int numActiveTexUnitState, int vertexAttrCount,
0404:                    int[] vertexAttrSizes, float[] varray, float[] cdata,
0405:                    int cdirty);
0406:
0407:            void execute(Context ctx, GeometryArrayRetained geo, int geo_type,
0408:                    boolean isNonUniformScale, boolean useAlpha,
0409:                    boolean ignoreVertexColors, int startVIndex, int vcount,
0410:                    int vformat, int texCoordSetCount, int[] texCoordSetMap,
0411:                    int texCoordSetMapLen, int[] texCoordSetOffset,
0412:                    int numActiveTexUnitState, int vertexAttrCount,
0413:                    int[] vertexAttrSizes, float[] varray, float[] cdata,
0414:                    int cdirty) {
0415:                execute(unbox(ctx), geo, geo_type, isNonUniformScale, useAlpha,
0416:                        ignoreVertexColors, startVIndex, vcount, vformat,
0417:                        texCoordSetCount, texCoordSetMap, texCoordSetMapLen,
0418:                        texCoordSetOffset, numActiveTexUnitState,
0419:                        vertexAttrCount, vertexAttrSizes, varray, cdata, cdirty);
0420:            }
0421:
0422:            // used by GeometryArray by Reference with java arrays
0423:            native void executeVA(long ctx, GeometryArrayRetained geo,
0424:                    int geo_type, boolean isNonUniformScale,
0425:                    boolean ignoreVertexColors, int vcount, int vformat,
0426:                    int vdefined, int coordIndex, float[] vfcoords,
0427:                    double[] vdcoords, int colorIndex, float[] cfdata,
0428:                    byte[] cbdata, int normalIndex, float[] ndata,
0429:                    int vertexAttrCount, int[] vertexAttrSizes,
0430:                    int[] vertexAttrIndex, float[][] vertexAttrData,
0431:                    int texcoordmaplength, int[] texcoordoffset,
0432:                    int numActiveTexUnitState, int[] texIndex, int texstride,
0433:                    Object[] texCoords, int cdirty);
0434:
0435:            void executeVA(Context ctx, GeometryArrayRetained geo,
0436:                    int geo_type, boolean isNonUniformScale,
0437:                    boolean ignoreVertexColors, int vcount, int vformat,
0438:                    int vdefined, int coordIndex, float[] vfcoords,
0439:                    double[] vdcoords, int colorIndex, float[] cfdata,
0440:                    byte[] cbdata, int normalIndex, float[] ndata,
0441:                    int vertexAttrCount, int[] vertexAttrSizes,
0442:                    int[] vertexAttrIndex, float[][] vertexAttrData,
0443:                    int texcoordmaplength, int[] texcoordoffset,
0444:                    int numActiveTexUnitState, int[] texIndex, int texstride,
0445:                    Object[] texCoords, int cdirty) {
0446:                executeVA(unbox(ctx), geo, geo_type, isNonUniformScale,
0447:                        ignoreVertexColors, vcount, vformat, vdefined,
0448:                        coordIndex, vfcoords, vdcoords, colorIndex, cfdata,
0449:                        cbdata, normalIndex, ndata, vertexAttrCount,
0450:                        vertexAttrSizes, vertexAttrIndex, vertexAttrData,
0451:                        texcoordmaplength, texcoordoffset,
0452:                        numActiveTexUnitState, texIndex, texstride, texCoords,
0453:                        cdirty);
0454:            }
0455:
0456:            // used by GeometryArray by Reference with NIO buffer
0457:            native void executeVABuffer(long ctx, GeometryArrayRetained geo,
0458:                    int geo_type, boolean isNonUniformScale,
0459:                    boolean ignoreVertexColors, int vcount, int vformat,
0460:                    int vdefined, int coordIndex, Object vcoords,
0461:                    int colorIndex, Object cdataBuffer, float[] cfdata,
0462:                    byte[] cbdata, int normalIndex, Object ndata,
0463:                    int vertexAttrCount, int[] vertexAttrSizes,
0464:                    int[] vertexAttrIndex, Object[] vertexAttrData,
0465:                    int texcoordmaplength, int[] texcoordoffset,
0466:                    int numActiveTexUnitState, int[] texIndex, int texstride,
0467:                    Object[] texCoords, int cdirty);
0468:
0469:            void executeVABuffer(Context ctx, GeometryArrayRetained geo,
0470:                    int geo_type, boolean isNonUniformScale,
0471:                    boolean ignoreVertexColors, int vcount, int vformat,
0472:                    int vdefined, int coordIndex, Object vcoords,
0473:                    int colorIndex, Object cdataBuffer, float[] cfdata,
0474:                    byte[] cbdata, int normalIndex, Object ndata,
0475:                    int vertexAttrCount, int[] vertexAttrSizes,
0476:                    int[] vertexAttrIndex, Object[] vertexAttrData,
0477:                    int texcoordmaplength, int[] texcoordoffset,
0478:                    int numActiveTexUnitState, int[] texIndex, int texstride,
0479:                    Object[] texCoords, int cdirty) {
0480:                executeVABuffer(unbox(ctx), geo, geo_type, isNonUniformScale,
0481:                        ignoreVertexColors, vcount, vformat, vdefined,
0482:                        coordIndex, vcoords, colorIndex, cdataBuffer, cfdata,
0483:                        cbdata, normalIndex, ndata, vertexAttrCount,
0484:                        vertexAttrSizes, vertexAttrIndex, vertexAttrData,
0485:                        texcoordmaplength, texcoordoffset,
0486:                        numActiveTexUnitState, texIndex, texstride, texCoords,
0487:                        cdirty);
0488:            }
0489:
0490:            // used by GeometryArray by Reference in interleaved format with NIO buffer
0491:            native void executeInterleavedBuffer(long ctx,
0492:                    GeometryArrayRetained geo, int geo_type,
0493:                    boolean isNonUniformScale, boolean useAlpha,
0494:                    boolean ignoreVertexColors, int startVIndex, int vcount,
0495:                    int vformat, int texCoordSetCount, int[] texCoordSetMap,
0496:                    int texCoordSetMapLen, int[] texCoordSetOffset,
0497:                    int numActiveTexUnitState, Object varray, float[] cdata,
0498:                    int cdirty);
0499:
0500:            void executeInterleavedBuffer(Context ctx,
0501:                    GeometryArrayRetained geo, int geo_type,
0502:                    boolean isNonUniformScale, boolean useAlpha,
0503:                    boolean ignoreVertexColors, int startVIndex, int vcount,
0504:                    int vformat, int texCoordSetCount, int[] texCoordSetMap,
0505:                    int texCoordSetMapLen, int[] texCoordSetOffset,
0506:                    int numActiveTexUnitState, Object varray, float[] cdata,
0507:                    int cdirty) {
0508:                executeInterleavedBuffer(unbox(ctx), geo, geo_type,
0509:                        isNonUniformScale, useAlpha, ignoreVertexColors,
0510:                        startVIndex, vcount, vformat, texCoordSetCount,
0511:                        texCoordSetMap, texCoordSetMapLen, texCoordSetOffset,
0512:                        numActiveTexUnitState, varray, cdata, cdirty);
0513:            }
0514:
0515:            native void setVertexFormat(long ctx, GeometryArrayRetained geo,
0516:                    int vformat, boolean useAlpha, boolean ignoreVertexColors);
0517:
0518:            void setVertexFormat(Context ctx, GeometryArrayRetained geo,
0519:                    int vformat, boolean useAlpha, boolean ignoreVertexColors) {
0520:                setVertexFormat(unbox(ctx), geo, vformat, useAlpha,
0521:                        ignoreVertexColors);
0522:            }
0523:
0524:            native void disableGlobalAlpha(long ctx, GeometryArrayRetained geo,
0525:                    int vformat, boolean useAlpha, boolean ignoreVertexColors);
0526:
0527:            void disableGlobalAlpha(Context ctx, GeometryArrayRetained geo,
0528:                    int vformat, boolean useAlpha, boolean ignoreVertexColors) {
0529:                disableGlobalAlpha(unbox(ctx), geo, vformat, useAlpha,
0530:                        ignoreVertexColors);
0531:            }
0532:
0533:            // used for GeometryArrays
0534:            native void buildGA(long ctx, GeometryArrayRetained geo,
0535:                    int geo_type, boolean isNonUniformScale,
0536:                    boolean updateAlpha, float alpha,
0537:                    boolean ignoreVertexColors, int startVIndex, int vcount,
0538:                    int vformat, int texCoordSetCount, int[] texCoordSetMap,
0539:                    int texCoordSetMapLen, int[] texCoordSetMapOffset,
0540:                    int vertexAttrCount, int[] vertexAttrSizes, double[] xform,
0541:                    double[] nxform, float[] varray);
0542:
0543:            void buildGA(Context ctx, GeometryArrayRetained geo, int geo_type,
0544:                    boolean isNonUniformScale, boolean updateAlpha,
0545:                    float alpha, boolean ignoreVertexColors, int startVIndex,
0546:                    int vcount, int vformat, int texCoordSetCount,
0547:                    int[] texCoordSetMap, int texCoordSetMapLen,
0548:                    int[] texCoordSetMapOffset, int vertexAttrCount,
0549:                    int[] vertexAttrSizes, double[] xform, double[] nxform,
0550:                    float[] varray) {
0551:                buildGA(unbox(ctx), geo, geo_type, isNonUniformScale,
0552:                        updateAlpha, alpha, ignoreVertexColors, startVIndex,
0553:                        vcount, vformat, texCoordSetCount, texCoordSetMap,
0554:                        texCoordSetMapLen, texCoordSetMapOffset,
0555:                        vertexAttrCount, vertexAttrSizes, xform, nxform, varray);
0556:            }
0557:
0558:            // used to Build Dlist GeometryArray by Reference with java arrays
0559:            native void buildGAForByRef(long ctx, GeometryArrayRetained geo,
0560:                    int geo_type, boolean isNonUniformScale,
0561:                    boolean updateAlpha, float alpha,
0562:                    boolean ignoreVertexColors, int vcount, int vformat,
0563:                    int vdefined, int coordIndex, float[] vfcoords,
0564:                    double[] vdcoords, int colorIndex, float[] cfdata,
0565:                    byte[] cbdata, int normalIndex, float[] ndata,
0566:                    int vertexAttrCount, int[] vertexAttrSizes,
0567:                    int[] vertexAttrIndex, float[][] vertexAttrData,
0568:                    int texcoordmaplength, int[] texcoordoffset,
0569:                    int[] texIndex, int texstride, Object[] texCoords,
0570:                    double[] xform, double[] nxform);
0571:
0572:            void buildGAForByRef(Context ctx, GeometryArrayRetained geo,
0573:                    int geo_type, boolean isNonUniformScale,
0574:                    boolean updateAlpha, float alpha,
0575:                    boolean ignoreVertexColors, int vcount, int vformat,
0576:                    int vdefined, int coordIndex, float[] vfcoords,
0577:                    double[] vdcoords, int colorIndex, float[] cfdata,
0578:                    byte[] cbdata, int normalIndex, float[] ndata,
0579:                    int vertexAttrCount, int[] vertexAttrSizes,
0580:                    int[] vertexAttrIndex, float[][] vertexAttrData,
0581:                    int texcoordmaplength, int[] texcoordoffset,
0582:                    int[] texIndex, int texstride, Object[] texCoords,
0583:                    double[] xform, double[] nxform) {
0584:                buildGAForByRef(unbox(ctx), geo, geo_type, isNonUniformScale,
0585:                        updateAlpha, alpha, ignoreVertexColors, vcount,
0586:                        vformat, vdefined, coordIndex, vfcoords, vdcoords,
0587:                        colorIndex, cfdata, cbdata, normalIndex, ndata,
0588:                        vertexAttrCount, vertexAttrSizes, vertexAttrIndex,
0589:                        vertexAttrData, texcoordmaplength, texcoordoffset,
0590:                        texIndex, texstride, texCoords, xform, nxform);
0591:            }
0592:
0593:            // ---------------------------------------------------------------------
0594:
0595:            //
0596:            // IndexedGeometryArrayRetained methods
0597:            //
0598:
0599:            // by-copy or interleaved, by reference, Java arrays
0600:            native void executeIndexedGeometry(long ctx,
0601:                    GeometryArrayRetained geo, int geo_type,
0602:                    boolean isNonUniformScale, boolean useAlpha,
0603:                    boolean ignoreVertexColors, int initialIndexIndex,
0604:                    int indexCount, int vertexCount, int vformat,
0605:                    int vertexAttrCount, int[] vertexAttrSizes,
0606:                    int texCoordSetCount, int[] texCoordSetMap,
0607:                    int texCoordSetMapLen, int[] texCoordSetOffset,
0608:                    int numActiveTexUnitState, float[] varray, float[] cdata,
0609:                    int cdirty, int[] indexCoord);
0610:
0611:            void executeIndexedGeometry(Context ctx, GeometryArrayRetained geo,
0612:                    int geo_type, boolean isNonUniformScale, boolean useAlpha,
0613:                    boolean ignoreVertexColors, int initialIndexIndex,
0614:                    int indexCount, int vertexCount, int vformat,
0615:                    int vertexAttrCount, int[] vertexAttrSizes,
0616:                    int texCoordSetCount, int[] texCoordSetMap,
0617:                    int texCoordSetMapLen, int[] texCoordSetOffset,
0618:                    int numActiveTexUnitState, float[] varray, float[] cdata,
0619:                    int cdirty, int[] indexCoord) {
0620:                executeIndexedGeometry(unbox(ctx), geo, geo_type,
0621:                        isNonUniformScale, useAlpha, ignoreVertexColors,
0622:                        initialIndexIndex, indexCount, vertexCount, vformat,
0623:                        vertexAttrCount, vertexAttrSizes, texCoordSetCount,
0624:                        texCoordSetMap, texCoordSetMapLen, texCoordSetOffset,
0625:                        numActiveTexUnitState, varray, cdata, cdirty,
0626:                        indexCoord);
0627:            }
0628:
0629:            // interleaved, by reference, nio buffer
0630:            native void executeIndexedGeometryBuffer(long ctx,
0631:                    GeometryArrayRetained geo, int geo_type,
0632:                    boolean isNonUniformScale, boolean useAlpha,
0633:                    boolean ignoreVertexColors, int initialIndexIndex,
0634:                    int indexCount, int vertexCount, int vformat,
0635:                    int texCoordSetCount, int[] texCoordSetMap,
0636:                    int texCoordSetMapLen, int[] texCoordSetOffset,
0637:                    int numActiveTexUnitState, Object varray, float[] cdata,
0638:                    int cdirty, int[] indexCoord);
0639:
0640:            void executeIndexedGeometryBuffer(Context ctx,
0641:                    GeometryArrayRetained geo, int geo_type,
0642:                    boolean isNonUniformScale, boolean useAlpha,
0643:                    boolean ignoreVertexColors, int initialIndexIndex,
0644:                    int indexCount, int vertexCount, int vformat,
0645:                    int texCoordSetCount, int[] texCoordSetMap,
0646:                    int texCoordSetMapLen, int[] texCoordSetOffset,
0647:                    int numActiveTexUnitState, Object varray, float[] cdata,
0648:                    int cdirty, int[] indexCoord) {
0649:                executeIndexedGeometryBuffer(unbox(ctx), geo, geo_type,
0650:                        isNonUniformScale, useAlpha, ignoreVertexColors,
0651:                        initialIndexIndex, indexCount, vertexCount, vformat,
0652:                        texCoordSetCount, texCoordSetMap, texCoordSetMapLen,
0653:                        texCoordSetOffset, numActiveTexUnitState, varray,
0654:                        cdata, cdirty, indexCoord);
0655:            }
0656:
0657:            // non interleaved, by reference, Java arrays
0658:            native void executeIndexedGeometryVA(long ctx,
0659:                    GeometryArrayRetained geo, int geo_type,
0660:                    boolean isNonUniformScale, boolean ignoreVertexColors,
0661:                    int initialIndexIndex, int validIndexCount,
0662:                    int vertexCount, int vformat, int vdefined,
0663:                    float[] vfcoords, double[] vdcoords, float[] cfdata,
0664:                    byte[] cbdata, float[] ndata, int vertexAttrCount,
0665:                    int[] vertexAttrSizes, float[][] vertexAttrData,
0666:                    int texcoordmaplength, int[] texcoordoffset,
0667:                    int numActiveTexUnitState, int texstride,
0668:                    Object[] texCoords, int cdirty, int[] indexCoord);
0669:
0670:            void executeIndexedGeometryVA(Context ctx,
0671:                    GeometryArrayRetained geo, int geo_type,
0672:                    boolean isNonUniformScale, boolean ignoreVertexColors,
0673:                    int initialIndexIndex, int validIndexCount,
0674:                    int vertexCount, int vformat, int vdefined,
0675:                    float[] vfcoords, double[] vdcoords, float[] cfdata,
0676:                    byte[] cbdata, float[] ndata, int vertexAttrCount,
0677:                    int[] vertexAttrSizes, float[][] vertexAttrData,
0678:                    int texcoordmaplength, int[] texcoordoffset,
0679:                    int numActiveTexUnitState, int texstride,
0680:                    Object[] texCoords, int cdirty, int[] indexCoord) {
0681:                executeIndexedGeometryVA(unbox(ctx), geo, geo_type,
0682:                        isNonUniformScale, ignoreVertexColors,
0683:                        initialIndexIndex, validIndexCount, vertexCount,
0684:                        vformat, vdefined, vfcoords, vdcoords, cfdata, cbdata,
0685:                        ndata, vertexAttrCount, vertexAttrSizes,
0686:                        vertexAttrData, texcoordmaplength, texcoordoffset,
0687:                        numActiveTexUnitState, texstride, texCoords, cdirty,
0688:                        indexCoord);
0689:            }
0690:
0691:            // non interleaved, by reference, nio buffer
0692:            native void executeIndexedGeometryVABuffer(long ctx,
0693:                    GeometryArrayRetained geo, int geo_type,
0694:                    boolean isNonUniformScale, boolean ignoreVertexColors,
0695:                    int initialIndexIndex, int validIndexCount,
0696:                    int vertexCount, int vformat, int vdefined, Object vcoords,
0697:                    Object cdataBuffer, float[] cfdata, byte[] cbdata,
0698:                    Object normal, int vertexAttrCount, int[] vertexAttrSizes,
0699:                    Object[] vertexAttrData, int texcoordmaplength,
0700:                    int[] texcoordoffset, int numActiveTexUnitState,
0701:                    int texstride, Object[] texCoords, int cdirty,
0702:                    int[] indexCoord);
0703:
0704:            void executeIndexedGeometryVABuffer(Context ctx,
0705:                    GeometryArrayRetained geo, int geo_type,
0706:                    boolean isNonUniformScale, boolean ignoreVertexColors,
0707:                    int initialIndexIndex, int validIndexCount,
0708:                    int vertexCount, int vformat, int vdefined, Object vcoords,
0709:                    Object cdataBuffer, float[] cfdata, byte[] cbdata,
0710:                    Object normal, int vertexAttrCount, int[] vertexAttrSizes,
0711:                    Object[] vertexAttrData, int texcoordmaplength,
0712:                    int[] texcoordoffset, int numActiveTexUnitState,
0713:                    int texstride, Object[] texCoords, int cdirty,
0714:                    int[] indexCoord) {
0715:                executeIndexedGeometryVABuffer(unbox(ctx), geo, geo_type,
0716:                        isNonUniformScale, ignoreVertexColors,
0717:                        initialIndexIndex, validIndexCount, vertexCount,
0718:                        vformat, vdefined, vcoords, cdataBuffer, cfdata,
0719:                        cbdata, normal, vertexAttrCount, vertexAttrSizes,
0720:                        vertexAttrData, texcoordmaplength, texcoordoffset,
0721:                        numActiveTexUnitState, texstride, texCoords, cdirty,
0722:                        indexCoord);
0723:            }
0724:
0725:            // by-copy geometry
0726:            native void buildIndexedGeometry(long ctx,
0727:                    GeometryArrayRetained geo, int geo_type,
0728:                    boolean isNonUniformScale, boolean updateAlpha,
0729:                    float alpha, boolean ignoreVertexColors,
0730:                    int initialIndexIndex, int validIndexCount,
0731:                    int vertexCount, int vformat, int vertexAttrCount,
0732:                    int[] vertexAttrSizes, int texCoordSetCount,
0733:                    int[] texCoordSetMap, int texCoordSetMapLen,
0734:                    int[] texCoordSetMapOffset, double[] xform,
0735:                    double[] nxform, float[] varray, int[] indexCoord);
0736:
0737:            void buildIndexedGeometry(Context ctx, GeometryArrayRetained geo,
0738:                    int geo_type, boolean isNonUniformScale,
0739:                    boolean updateAlpha, float alpha,
0740:                    boolean ignoreVertexColors, int initialIndexIndex,
0741:                    int validIndexCount, int vertexCount, int vformat,
0742:                    int vertexAttrCount, int[] vertexAttrSizes,
0743:                    int texCoordSetCount, int[] texCoordSetMap,
0744:                    int texCoordSetMapLen, int[] texCoordSetMapOffset,
0745:                    double[] xform, double[] nxform, float[] varray,
0746:                    int[] indexCoord) {
0747:                buildIndexedGeometry(unbox(ctx), geo, geo_type,
0748:                        isNonUniformScale, updateAlpha, alpha,
0749:                        ignoreVertexColors, initialIndexIndex, validIndexCount,
0750:                        vertexCount, vformat, vertexAttrCount, vertexAttrSizes,
0751:                        texCoordSetCount, texCoordSetMap, texCoordSetMapLen,
0752:                        texCoordSetMapOffset, xform, nxform, varray, indexCoord);
0753:            }
0754:
0755:            // ---------------------------------------------------------------------
0756:
0757:            //
0758:            // GraphicsContext3D methods
0759:            //
0760:
0761:            native void readRaster(long ctx, int type, int xSrcOffset,
0762:                    int ySrcOffset, int width, int height, int hCanvas,
0763:                    int imageDataType, int imageFormat, Object imageBuffer,
0764:                    int depthFormat, Object depthBuffer);
0765:
0766:            void readRaster(Context ctx, int type, int xSrcOffset,
0767:                    int ySrcOffset, int width, int height, int hCanvas,
0768:                    int imageDataType, int imageFormat, Object imageBuffer,
0769:                    int depthFormat, Object depthBuffer) {
0770:                readRaster(unbox(ctx), type, xSrcOffset, ySrcOffset, width,
0771:                        height, hCanvas, imageDataType, imageFormat,
0772:                        imageBuffer, depthFormat, depthBuffer);
0773:            }
0774:
0775:            // ---------------------------------------------------------------------
0776:
0777:            //
0778:            // CgShaderProgramRetained methods
0779:            //
0780:
0781:            // ShaderAttributeValue methods
0782:
0783:            native ShaderError setCgUniform1i(long ctx, long shaderProgramId,
0784:                    long uniformLocation, int value);
0785:
0786:            ShaderError setCgUniform1i(Context ctx,
0787:                    ShaderProgramId shaderProgramId,
0788:                    ShaderAttrLoc uniformLocation, int value) {
0789:                return setCgUniform1i(unbox(ctx), unbox(shaderProgramId),
0790:                        unbox(uniformLocation), value);
0791:            }
0792:
0793:            native ShaderError setCgUniform1f(long ctx, long shaderProgramId,
0794:                    long uniformLocation, float value);
0795:
0796:            ShaderError setCgUniform1f(Context ctx,
0797:                    ShaderProgramId shaderProgramId,
0798:                    ShaderAttrLoc uniformLocation, float value) {
0799:                return setCgUniform1f(unbox(ctx), unbox(shaderProgramId),
0800:                        unbox(uniformLocation), value);
0801:            }
0802:
0803:            native ShaderError setCgUniform2i(long ctx, long shaderProgramId,
0804:                    long uniformLocation, int[] value);
0805:
0806:            ShaderError setCgUniform2i(Context ctx,
0807:                    ShaderProgramId shaderProgramId,
0808:                    ShaderAttrLoc uniformLocation, int[] value) {
0809:                return setCgUniform2i(unbox(ctx), unbox(shaderProgramId),
0810:                        unbox(uniformLocation), value);
0811:            }
0812:
0813:            native ShaderError setCgUniform2f(long ctx, long shaderProgramId,
0814:                    long uniformLocation, float[] value);
0815:
0816:            ShaderError setCgUniform2f(Context ctx,
0817:                    ShaderProgramId shaderProgramId,
0818:                    ShaderAttrLoc uniformLocation, float[] value) {
0819:                return setCgUniform2f(unbox(ctx), unbox(shaderProgramId),
0820:                        unbox(uniformLocation), value);
0821:            }
0822:
0823:            native ShaderError setCgUniform3i(long ctx, long shaderProgramId,
0824:                    long uniformLocation, int[] value);
0825:
0826:            ShaderError setCgUniform3i(Context ctx,
0827:                    ShaderProgramId shaderProgramId,
0828:                    ShaderAttrLoc uniformLocation, int[] value) {
0829:                return setCgUniform3i(unbox(ctx), unbox(shaderProgramId),
0830:                        unbox(uniformLocation), value);
0831:            }
0832:
0833:            native ShaderError setCgUniform3f(long ctx, long shaderProgramId,
0834:                    long uniformLocation, float[] value);
0835:
0836:            ShaderError setCgUniform3f(Context ctx,
0837:                    ShaderProgramId shaderProgramId,
0838:                    ShaderAttrLoc uniformLocation, float[] value) {
0839:                return setCgUniform3f(unbox(ctx), unbox(shaderProgramId),
0840:                        unbox(uniformLocation), value);
0841:            }
0842:
0843:            native ShaderError setCgUniform4i(long ctx, long shaderProgramId,
0844:                    long uniformLocation, int[] value);
0845:
0846:            ShaderError setCgUniform4i(Context ctx,
0847:                    ShaderProgramId shaderProgramId,
0848:                    ShaderAttrLoc uniformLocation, int[] value) {
0849:                return setCgUniform4i(unbox(ctx), unbox(shaderProgramId),
0850:                        unbox(uniformLocation), value);
0851:            }
0852:
0853:            native ShaderError setCgUniform4f(long ctx, long shaderProgramId,
0854:                    long uniformLocation, float[] value);
0855:
0856:            ShaderError setCgUniform4f(Context ctx,
0857:                    ShaderProgramId shaderProgramId,
0858:                    ShaderAttrLoc uniformLocation, float[] value) {
0859:                return setCgUniform4f(unbox(ctx), unbox(shaderProgramId),
0860:                        unbox(uniformLocation), value);
0861:            }
0862:
0863:            native ShaderError setCgUniformMatrix3f(long ctx,
0864:                    long shaderProgramId, long uniformLocation, float[] value);
0865:
0866:            ShaderError setCgUniformMatrix3f(Context ctx,
0867:                    ShaderProgramId shaderProgramId,
0868:                    ShaderAttrLoc uniformLocation, float[] value) {
0869:                return setCgUniformMatrix3f(unbox(ctx), unbox(shaderProgramId),
0870:                        unbox(uniformLocation), value);
0871:            }
0872:
0873:            native ShaderError setCgUniformMatrix4f(long ctx,
0874:                    long shaderProgramId, long uniformLocation, float[] value);
0875:
0876:            ShaderError setCgUniformMatrix4f(Context ctx,
0877:                    ShaderProgramId shaderProgramId,
0878:                    ShaderAttrLoc uniformLocation, float[] value) {
0879:                return setCgUniformMatrix4f(unbox(ctx), unbox(shaderProgramId),
0880:                        unbox(uniformLocation), value);
0881:            }
0882:
0883:            // ShaderAttributeArray methods
0884:
0885:            native ShaderError setCgUniform1iArray(long ctx,
0886:                    long shaderProgramId, long uniformLocation,
0887:                    int numElements, int[] value);
0888:
0889:            ShaderError setCgUniform1iArray(Context ctx,
0890:                    ShaderProgramId shaderProgramId,
0891:                    ShaderAttrLoc uniformLocation, int numElements, int[] value) {
0892:                return setCgUniform1iArray(unbox(ctx), unbox(shaderProgramId),
0893:                        unbox(uniformLocation), numElements, value);
0894:            }
0895:
0896:            native ShaderError setCgUniform1fArray(long ctx,
0897:                    long shaderProgramId, long uniformLocation,
0898:                    int numElements, float[] value);
0899:
0900:            ShaderError setCgUniform1fArray(Context ctx,
0901:                    ShaderProgramId shaderProgramId,
0902:                    ShaderAttrLoc uniformLocation, int numElements,
0903:                    float[] value) {
0904:                return setCgUniform1fArray(unbox(ctx), unbox(shaderProgramId),
0905:                        unbox(uniformLocation), numElements, value);
0906:            }
0907:
0908:            native ShaderError setCgUniform2iArray(long ctx,
0909:                    long shaderProgramId, long uniformLocation,
0910:                    int numElements, int[] value);
0911:
0912:            ShaderError setCgUniform2iArray(Context ctx,
0913:                    ShaderProgramId shaderProgramId,
0914:                    ShaderAttrLoc uniformLocation, int numElements, int[] value) {
0915:                return setCgUniform2iArray(unbox(ctx), unbox(shaderProgramId),
0916:                        unbox(uniformLocation), numElements, value);
0917:            }
0918:
0919:            native ShaderError setCgUniform2fArray(long ctx,
0920:                    long shaderProgramId, long uniformLocation,
0921:                    int numElements, float[] value);
0922:
0923:            ShaderError setCgUniform2fArray(Context ctx,
0924:                    ShaderProgramId shaderProgramId,
0925:                    ShaderAttrLoc uniformLocation, int numElements,
0926:                    float[] value) {
0927:                return setCgUniform2fArray(unbox(ctx), unbox(shaderProgramId),
0928:                        unbox(uniformLocation), numElements, value);
0929:            }
0930:
0931:            native ShaderError setCgUniform3iArray(long ctx,
0932:                    long shaderProgramId, long uniformLocation,
0933:                    int numElements, int[] value);
0934:
0935:            ShaderError setCgUniform3iArray(Context ctx,
0936:                    ShaderProgramId shaderProgramId,
0937:                    ShaderAttrLoc uniformLocation, int numElements, int[] value) {
0938:                return setCgUniform3iArray(unbox(ctx), unbox(shaderProgramId),
0939:                        unbox(uniformLocation), numElements, value);
0940:            }
0941:
0942:            native ShaderError setCgUniform3fArray(long ctx,
0943:                    long shaderProgramId, long uniformLocation,
0944:                    int numElements, float[] value);
0945:
0946:            ShaderError setCgUniform3fArray(Context ctx,
0947:                    ShaderProgramId shaderProgramId,
0948:                    ShaderAttrLoc uniformLocation, int numElements,
0949:                    float[] value) {
0950:                return setCgUniform3fArray(unbox(ctx), unbox(shaderProgramId),
0951:                        unbox(uniformLocation), numElements, value);
0952:            }
0953:
0954:            native ShaderError setCgUniform4iArray(long ctx,
0955:                    long shaderProgramId, long uniformLocation,
0956:                    int numElements, int[] value);
0957:
0958:            ShaderError setCgUniform4iArray(Context ctx,
0959:                    ShaderProgramId shaderProgramId,
0960:                    ShaderAttrLoc uniformLocation, int numElements, int[] value) {
0961:                return setCgUniform4iArray(unbox(ctx), unbox(shaderProgramId),
0962:                        unbox(uniformLocation), numElements, value);
0963:            }
0964:
0965:            native ShaderError setCgUniform4fArray(long ctx,
0966:                    long shaderProgramId, long uniformLocation,
0967:                    int numElements, float[] value);
0968:
0969:            ShaderError setCgUniform4fArray(Context ctx,
0970:                    ShaderProgramId shaderProgramId,
0971:                    ShaderAttrLoc uniformLocation, int numElements,
0972:                    float[] value) {
0973:                return setCgUniform4fArray(unbox(ctx), unbox(shaderProgramId),
0974:                        unbox(uniformLocation), numElements, value);
0975:            }
0976:
0977:            native ShaderError setCgUniformMatrix3fArray(long ctx,
0978:                    long shaderProgramId, long uniformLocation,
0979:                    int numElements, float[] value);
0980:
0981:            ShaderError setCgUniformMatrix3fArray(Context ctx,
0982:                    ShaderProgramId shaderProgramId,
0983:                    ShaderAttrLoc uniformLocation, int numElements,
0984:                    float[] value) {
0985:                return setCgUniformMatrix3fArray(unbox(ctx),
0986:                        unbox(shaderProgramId), unbox(uniformLocation),
0987:                        numElements, value);
0988:            }
0989:
0990:            native ShaderError setCgUniformMatrix4fArray(long ctx,
0991:                    long shaderProgramId, long uniformLocation,
0992:                    int numElements, float[] value);
0993:
0994:            ShaderError setCgUniformMatrix4fArray(Context ctx,
0995:                    ShaderProgramId shaderProgramId,
0996:                    ShaderAttrLoc uniformLocation, int numElements,
0997:                    float[] value) {
0998:                return setCgUniformMatrix4fArray(unbox(ctx),
0999:                        unbox(shaderProgramId), unbox(uniformLocation),
1000:                        numElements, value);
1001:            }
1002:
1003:            // Native interfaces for shader compilation, etc.
1004:            native ShaderError createCgShader(long ctx, int shaderType,
1005:                    long[] shaderId);
1006:
1007:            ShaderError createCgShader(Context ctx, int shaderType,
1008:                    ShaderId[] shaderId) {
1009:                long[] nativeId = new long[1];
1010:                ShaderError err = createCgShader(unbox(ctx), shaderType,
1011:                        nativeId);
1012:                shaderId[0] = boxShaderId(nativeId[0]);
1013:                return err;
1014:            }
1015:
1016:            native ShaderError destroyCgShader(long ctx, long shaderId);
1017:
1018:            ShaderError destroyCgShader(Context ctx, ShaderId shaderId) {
1019:                return destroyCgShader(unbox(ctx), unbox(shaderId));
1020:            }
1021:
1022:            native ShaderError compileCgShader(long ctx, long shaderId,
1023:                    String program);
1024:
1025:            ShaderError compileCgShader(Context ctx, ShaderId shaderId,
1026:                    String program) {
1027:                return compileCgShader(unbox(ctx), unbox(shaderId), program);
1028:            }
1029:
1030:            native ShaderError createCgShaderProgram(long ctx,
1031:                    long[] shaderProgramId);
1032:
1033:            ShaderError createCgShaderProgram(Context ctx,
1034:                    ShaderProgramId[] shaderProgramId) {
1035:                long[] nativeId = new long[1];
1036:                ShaderError err = createCgShaderProgram(unbox(ctx), nativeId);
1037:                shaderProgramId[0] = boxShaderProgramId(nativeId[0]);
1038:                return err;
1039:            }
1040:
1041:            native ShaderError destroyCgShaderProgram(long ctx,
1042:                    long shaderProgramId);
1043:
1044:            ShaderError destroyCgShaderProgram(Context ctx,
1045:                    ShaderProgramId shaderProgramId) {
1046:                return destroyCgShaderProgram(unbox(ctx),
1047:                        unbox(shaderProgramId));
1048:            }
1049:
1050:            native ShaderError linkCgShaderProgram(long ctx,
1051:                    long shaderProgramId, long[] shaderIds);
1052:
1053:            ShaderError linkCgShaderProgram(Context ctx,
1054:                    ShaderProgramId shaderProgramId, ShaderId[] shaderIds) {
1055:
1056:                assert shaderIds != null;
1057:                long[] nativeIds = new long[shaderIds.length];
1058:                for (int i = 0; i < shaderIds.length; i++) {
1059:                    nativeIds[i] = unbox(shaderIds[i]);
1060:                }
1061:                return linkCgShaderProgram(unbox(ctx), unbox(shaderProgramId),
1062:                        nativeIds);
1063:            }
1064:
1065:            native void lookupCgVertexAttrNames(long ctx, long shaderProgramId,
1066:                    int numAttrNames, String[] attrNames, boolean[] errArr);
1067:
1068:            void lookupCgVertexAttrNames(Context ctx,
1069:                    ShaderProgramId shaderProgramId, int numAttrNames,
1070:                    String[] attrNames, boolean[] errArr) {
1071:                lookupCgVertexAttrNames(unbox(ctx), unbox(shaderProgramId),
1072:                        numAttrNames, attrNames, errArr);
1073:            }
1074:
1075:            native void lookupCgShaderAttrNames(long ctx, long shaderProgramId,
1076:                    int numAttrNames, String[] attrNames, long[] locArr,
1077:                    int[] typeArr, int[] sizeArr, boolean[] isArrayArr);
1078:
1079:            void lookupCgShaderAttrNames(Context ctx,
1080:                    ShaderProgramId shaderProgramId, int numAttrNames,
1081:                    String[] attrNames, ShaderAttrLoc[] locArr, int[] typeArr,
1082:                    int[] sizeArr, boolean[] isArrayArr) {
1083:
1084:                assert numAttrNames == locArr.length;
1085:                long[] nativeLocArr = new long[numAttrNames];
1086:                for (int i = 0; i < numAttrNames; i++) {
1087:                    // Initialize to invalid native location
1088:                    nativeLocArr[i] = -1;
1089:                }
1090:                lookupCgShaderAttrNames(unbox(ctx), unbox(shaderProgramId),
1091:                        numAttrNames, attrNames, nativeLocArr, typeArr,
1092:                        sizeArr, isArrayArr);
1093:                for (int i = 0; i < numAttrNames; i++) {
1094:                    locArr[i] = boxShaderAttrLoc(nativeLocArr[i]);
1095:                }
1096:            }
1097:
1098:            native ShaderError useCgShaderProgram(long ctx, long shaderProgramId);
1099:
1100:            ShaderError useCgShaderProgram(Context ctx,
1101:                    ShaderProgramId shaderProgramId) {
1102:                return useCgShaderProgram(unbox(ctx), unbox(shaderProgramId));
1103:            }
1104:
1105:            // ---------------------------------------------------------------------
1106:
1107:            //
1108:            // GLSLShaderProgramRetained methods
1109:            //
1110:
1111:            // ShaderAttributeValue methods
1112:
1113:            native ShaderError setGLSLUniform1i(long ctx, long shaderProgramId,
1114:                    long uniformLocation, int value);
1115:
1116:            ShaderError setGLSLUniform1i(Context ctx,
1117:                    ShaderProgramId shaderProgramId,
1118:                    ShaderAttrLoc uniformLocation, int value) {
1119:                return setGLSLUniform1i(unbox(ctx), unbox(shaderProgramId),
1120:                        unbox(uniformLocation), value);
1121:            }
1122:
1123:            native ShaderError setGLSLUniform1f(long ctx, long shaderProgramId,
1124:                    long uniformLocation, float value);
1125:
1126:            ShaderError setGLSLUniform1f(Context ctx,
1127:                    ShaderProgramId shaderProgramId,
1128:                    ShaderAttrLoc uniformLocation, float value) {
1129:                return setGLSLUniform1f(unbox(ctx), unbox(shaderProgramId),
1130:                        unbox(uniformLocation), value);
1131:            }
1132:
1133:            native ShaderError setGLSLUniform2i(long ctx, long shaderProgramId,
1134:                    long uniformLocation, int[] value);
1135:
1136:            ShaderError setGLSLUniform2i(Context ctx,
1137:                    ShaderProgramId shaderProgramId,
1138:                    ShaderAttrLoc uniformLocation, int[] value) {
1139:                return setGLSLUniform2i(unbox(ctx), unbox(shaderProgramId),
1140:                        unbox(uniformLocation), value);
1141:            }
1142:
1143:            native ShaderError setGLSLUniform2f(long ctx, long shaderProgramId,
1144:                    long uniformLocation, float[] value);
1145:
1146:            ShaderError setGLSLUniform2f(Context ctx,
1147:                    ShaderProgramId shaderProgramId,
1148:                    ShaderAttrLoc uniformLocation, float[] value) {
1149:                return setGLSLUniform2f(unbox(ctx), unbox(shaderProgramId),
1150:                        unbox(uniformLocation), value);
1151:            }
1152:
1153:            native ShaderError setGLSLUniform3i(long ctx, long shaderProgramId,
1154:                    long uniformLocation, int[] value);
1155:
1156:            ShaderError setGLSLUniform3i(Context ctx,
1157:                    ShaderProgramId shaderProgramId,
1158:                    ShaderAttrLoc uniformLocation, int[] value) {
1159:                return setGLSLUniform3i(unbox(ctx), unbox(shaderProgramId),
1160:                        unbox(uniformLocation), value);
1161:            }
1162:
1163:            native ShaderError setGLSLUniform3f(long ctx, long shaderProgramId,
1164:                    long uniformLocation, float[] value);
1165:
1166:            ShaderError setGLSLUniform3f(Context ctx,
1167:                    ShaderProgramId shaderProgramId,
1168:                    ShaderAttrLoc uniformLocation, float[] value) {
1169:                return setGLSLUniform3f(unbox(ctx), unbox(shaderProgramId),
1170:                        unbox(uniformLocation), value);
1171:            }
1172:
1173:            native ShaderError setGLSLUniform4i(long ctx, long shaderProgramId,
1174:                    long uniformLocation, int[] value);
1175:
1176:            ShaderError setGLSLUniform4i(Context ctx,
1177:                    ShaderProgramId shaderProgramId,
1178:                    ShaderAttrLoc uniformLocation, int[] value) {
1179:                return setGLSLUniform4i(unbox(ctx), unbox(shaderProgramId),
1180:                        unbox(uniformLocation), value);
1181:            }
1182:
1183:            native ShaderError setGLSLUniform4f(long ctx, long shaderProgramId,
1184:                    long uniformLocation, float[] value);
1185:
1186:            ShaderError setGLSLUniform4f(Context ctx,
1187:                    ShaderProgramId shaderProgramId,
1188:                    ShaderAttrLoc uniformLocation, float[] value) {
1189:                return setGLSLUniform4f(unbox(ctx), unbox(shaderProgramId),
1190:                        unbox(uniformLocation), value);
1191:            }
1192:
1193:            native ShaderError setGLSLUniformMatrix3f(long ctx,
1194:                    long shaderProgramId, long uniformLocation, float[] value);
1195:
1196:            ShaderError setGLSLUniformMatrix3f(Context ctx,
1197:                    ShaderProgramId shaderProgramId,
1198:                    ShaderAttrLoc uniformLocation, float[] value) {
1199:                return setGLSLUniformMatrix3f(unbox(ctx),
1200:                        unbox(shaderProgramId), unbox(uniformLocation), value);
1201:            }
1202:
1203:            native ShaderError setGLSLUniformMatrix4f(long ctx,
1204:                    long shaderProgramId, long uniformLocation, float[] value);
1205:
1206:            ShaderError setGLSLUniformMatrix4f(Context ctx,
1207:                    ShaderProgramId shaderProgramId,
1208:                    ShaderAttrLoc uniformLocation, float[] value) {
1209:                return setGLSLUniformMatrix4f(unbox(ctx),
1210:                        unbox(shaderProgramId), unbox(uniformLocation), value);
1211:            }
1212:
1213:            // ShaderAttributeArray methods
1214:
1215:            native ShaderError setGLSLUniform1iArray(long ctx,
1216:                    long shaderProgramId, long uniformLocation,
1217:                    int numElements, int[] value);
1218:
1219:            ShaderError setGLSLUniform1iArray(Context ctx,
1220:                    ShaderProgramId shaderProgramId,
1221:                    ShaderAttrLoc uniformLocation, int numElements, int[] value) {
1222:                return setGLSLUniform1iArray(unbox(ctx),
1223:                        unbox(shaderProgramId), unbox(uniformLocation),
1224:                        numElements, value);
1225:            }
1226:
1227:            native ShaderError setGLSLUniform1fArray(long ctx,
1228:                    long shaderProgramId, long uniformLocation,
1229:                    int numElements, float[] value);
1230:
1231:            ShaderError setGLSLUniform1fArray(Context ctx,
1232:                    ShaderProgramId shaderProgramId,
1233:                    ShaderAttrLoc uniformLocation, int numElements,
1234:                    float[] value) {
1235:                return setGLSLUniform1fArray(unbox(ctx),
1236:                        unbox(shaderProgramId), unbox(uniformLocation),
1237:                        numElements, value);
1238:            }
1239:
1240:            native ShaderError setGLSLUniform2iArray(long ctx,
1241:                    long shaderProgramId, long uniformLocation,
1242:                    int numElements, int[] value);
1243:
1244:            ShaderError setGLSLUniform2iArray(Context ctx,
1245:                    ShaderProgramId shaderProgramId,
1246:                    ShaderAttrLoc uniformLocation, int numElements, int[] value) {
1247:                return setGLSLUniform2iArray(unbox(ctx),
1248:                        unbox(shaderProgramId), unbox(uniformLocation),
1249:                        numElements, value);
1250:            }
1251:
1252:            native ShaderError setGLSLUniform2fArray(long ctx,
1253:                    long shaderProgramId, long uniformLocation,
1254:                    int numElements, float[] value);
1255:
1256:            ShaderError setGLSLUniform2fArray(Context ctx,
1257:                    ShaderProgramId shaderProgramId,
1258:                    ShaderAttrLoc uniformLocation, int numElements,
1259:                    float[] value) {
1260:                return setGLSLUniform2fArray(unbox(ctx),
1261:                        unbox(shaderProgramId), unbox(uniformLocation),
1262:                        numElements, value);
1263:            }
1264:
1265:            native ShaderError setGLSLUniform3iArray(long ctx,
1266:                    long shaderProgramId, long uniformLocation,
1267:                    int numElements, int[] value);
1268:
1269:            ShaderError setGLSLUniform3iArray(Context ctx,
1270:                    ShaderProgramId shaderProgramId,
1271:                    ShaderAttrLoc uniformLocation, int numElements, int[] value) {
1272:                return setGLSLUniform3iArray(unbox(ctx),
1273:                        unbox(shaderProgramId), unbox(uniformLocation),
1274:                        numElements, value);
1275:            }
1276:
1277:            native ShaderError setGLSLUniform3fArray(long ctx,
1278:                    long shaderProgramId, long uniformLocation,
1279:                    int numElements, float[] value);
1280:
1281:            ShaderError setGLSLUniform3fArray(Context ctx,
1282:                    ShaderProgramId shaderProgramId,
1283:                    ShaderAttrLoc uniformLocation, int numElements,
1284:                    float[] value) {
1285:                return setGLSLUniform3fArray(unbox(ctx),
1286:                        unbox(shaderProgramId), unbox(uniformLocation),
1287:                        numElements, value);
1288:            }
1289:
1290:            native ShaderError setGLSLUniform4iArray(long ctx,
1291:                    long shaderProgramId, long uniformLocation,
1292:                    int numElements, int[] value);
1293:
1294:            ShaderError setGLSLUniform4iArray(Context ctx,
1295:                    ShaderProgramId shaderProgramId,
1296:                    ShaderAttrLoc uniformLocation, int numElements, int[] value) {
1297:                return setGLSLUniform4iArray(unbox(ctx),
1298:                        unbox(shaderProgramId), unbox(uniformLocation),
1299:                        numElements, value);
1300:            }
1301:
1302:            native ShaderError setGLSLUniform4fArray(long ctx,
1303:                    long shaderProgramId, long uniformLocation,
1304:                    int numElements, float[] value);
1305:
1306:            ShaderError setGLSLUniform4fArray(Context ctx,
1307:                    ShaderProgramId shaderProgramId,
1308:                    ShaderAttrLoc uniformLocation, int numElements,
1309:                    float[] value) {
1310:                return setGLSLUniform4fArray(unbox(ctx),
1311:                        unbox(shaderProgramId), unbox(uniformLocation),
1312:                        numElements, value);
1313:            }
1314:
1315:            native ShaderError setGLSLUniformMatrix3fArray(long ctx,
1316:                    long shaderProgramId, long uniformLocation,
1317:                    int numElements, float[] value);
1318:
1319:            ShaderError setGLSLUniformMatrix3fArray(Context ctx,
1320:                    ShaderProgramId shaderProgramId,
1321:                    ShaderAttrLoc uniformLocation, int numElements,
1322:                    float[] value) {
1323:                return setGLSLUniformMatrix3fArray(unbox(ctx),
1324:                        unbox(shaderProgramId), unbox(uniformLocation),
1325:                        numElements, value);
1326:            }
1327:
1328:            native ShaderError setGLSLUniformMatrix4fArray(long ctx,
1329:                    long shaderProgramId, long uniformLocation,
1330:                    int numElements, float[] value);
1331:
1332:            ShaderError setGLSLUniformMatrix4fArray(Context ctx,
1333:                    ShaderProgramId shaderProgramId,
1334:                    ShaderAttrLoc uniformLocation, int numElements,
1335:                    float[] value) {
1336:                return setGLSLUniformMatrix4fArray(unbox(ctx),
1337:                        unbox(shaderProgramId), unbox(uniformLocation),
1338:                        numElements, value);
1339:            }
1340:
1341:            // native interfaces for shader compilation, etc.
1342:            native ShaderError createGLSLShader(long ctx, int shaderType,
1343:                    long[] shaderId);
1344:
1345:            ShaderError createGLSLShader(Context ctx, int shaderType,
1346:                    ShaderId[] shaderId) {
1347:                long[] nativeId = new long[1];
1348:                ShaderError err = createGLSLShader(unbox(ctx), shaderType,
1349:                        nativeId);
1350:                shaderId[0] = boxShaderId(nativeId[0]);
1351:                return err;
1352:            }
1353:
1354:            native ShaderError destroyGLSLShader(long ctx, long shaderId);
1355:
1356:            ShaderError destroyGLSLShader(Context ctx, ShaderId shaderId) {
1357:                return destroyGLSLShader(unbox(ctx), unbox(shaderId));
1358:            }
1359:
1360:            native ShaderError compileGLSLShader(long ctx, long shaderId,
1361:                    String program);
1362:
1363:            ShaderError compileGLSLShader(Context ctx, ShaderId shaderId,
1364:                    String program) {
1365:                return compileGLSLShader(unbox(ctx), unbox(shaderId), program);
1366:            }
1367:
1368:            native ShaderError createGLSLShaderProgram(long ctx,
1369:                    long[] shaderProgramId);
1370:
1371:            ShaderError createGLSLShaderProgram(Context ctx,
1372:                    ShaderProgramId[] shaderProgramId) {
1373:                long[] nativeId = new long[1];
1374:                ShaderError err = createGLSLShaderProgram(unbox(ctx), nativeId);
1375:                shaderProgramId[0] = boxShaderProgramId(nativeId[0]);
1376:                return err;
1377:            }
1378:
1379:            native ShaderError destroyGLSLShaderProgram(long ctx,
1380:                    long shaderProgramId);
1381:
1382:            ShaderError destroyGLSLShaderProgram(Context ctx,
1383:                    ShaderProgramId shaderProgramId) {
1384:                return destroyGLSLShaderProgram(unbox(ctx),
1385:                        unbox(shaderProgramId));
1386:            }
1387:
1388:            native ShaderError linkGLSLShaderProgram(long ctx,
1389:                    long shaderProgramId, long[] shaderId);
1390:
1391:            ShaderError linkGLSLShaderProgram(Context ctx,
1392:                    ShaderProgramId shaderProgramId, ShaderId[] shaderIds) {
1393:                assert shaderIds != null;
1394:                long[] nativeIds = new long[shaderIds.length];
1395:                for (int i = 0; i < shaderIds.length; i++) {
1396:                    nativeIds[i] = unbox(shaderIds[i]);
1397:                }
1398:                return linkGLSLShaderProgram(unbox(ctx),
1399:                        unbox(shaderProgramId), nativeIds);
1400:            }
1401:
1402:            native ShaderError bindGLSLVertexAttrName(long ctx,
1403:                    long shaderProgramId, String attrName, int attrIndex);
1404:
1405:            ShaderError bindGLSLVertexAttrName(Context ctx,
1406:                    ShaderProgramId shaderProgramId, String attrName,
1407:                    int attrIndex) {
1408:                return bindGLSLVertexAttrName(unbox(ctx),
1409:                        unbox(shaderProgramId), attrName, attrIndex);
1410:            }
1411:
1412:            native void lookupGLSLShaderAttrNames(long ctx,
1413:                    long shaderProgramId, int numAttrNames, String[] attrNames,
1414:                    long[] locArr, int[] typeArr, int[] sizeArr,
1415:                    boolean[] isArrayArr);
1416:
1417:            void lookupGLSLShaderAttrNames(Context ctx,
1418:                    ShaderProgramId shaderProgramId, int numAttrNames,
1419:                    String[] attrNames, ShaderAttrLoc[] locArr, int[] typeArr,
1420:                    int[] sizeArr, boolean[] isArrayArr) {
1421:
1422:                assert numAttrNames == locArr.length;
1423:                long[] nativeLocArr = new long[numAttrNames];
1424:                for (int i = 0; i < numAttrNames; i++) {
1425:                    // Initialize to invalid native location
1426:                    nativeLocArr[i] = -1;
1427:                }
1428:                lookupGLSLShaderAttrNames(unbox(ctx), unbox(shaderProgramId),
1429:                        numAttrNames, attrNames, nativeLocArr, typeArr,
1430:                        sizeArr, isArrayArr);
1431:                for (int i = 0; i < numAttrNames; i++) {
1432:                    locArr[i] = boxShaderAttrLoc(nativeLocArr[i]);
1433:                }
1434:            }
1435:
1436:            native ShaderError useGLSLShaderProgram(long ctx,
1437:                    long shaderProgramId);
1438:
1439:            ShaderError useGLSLShaderProgram(Context ctx,
1440:                    ShaderProgramId shaderProgramId) {
1441:                return useGLSLShaderProgram(unbox(ctx), unbox(shaderProgramId));
1442:            }
1443:
1444:            // ---------------------------------------------------------------------
1445:
1446:            //
1447:            // Renderer methods
1448:            //
1449:
1450:            native void cleanupRenderer();
1451:
1452:            // ---------------------------------------------------------------------
1453:
1454:            //
1455:            // ColoringAttributesRetained methods
1456:            //
1457:
1458:            native void updateColoringAttributes(long ctx, float dRed,
1459:                    float dGreen, float dBlue, float red, float green,
1460:                    float blue, float alpha, boolean lEnable, int shadeModel);
1461:
1462:            void updateColoringAttributes(Context ctx, float dRed,
1463:                    float dGreen, float dBlue, float red, float green,
1464:                    float blue, float alpha, boolean lEnable, int shadeModel) {
1465:                updateColoringAttributes(unbox(ctx), dRed, dGreen, dBlue, red,
1466:                        green, blue, alpha, lEnable, shadeModel);
1467:            }
1468:
1469:            // ---------------------------------------------------------------------
1470:
1471:            //
1472:            // DirectionalLightRetained methods
1473:            //
1474:
1475:            native void updateDirectionalLight(long ctx, int lightSlot,
1476:                    float red, float green, float blue, float x, float y,
1477:                    float z);
1478:
1479:            void updateDirectionalLight(Context ctx, int lightSlot, float red,
1480:                    float green, float blue, float x, float y, float z) {
1481:                updateDirectionalLight(unbox(ctx), lightSlot, red, green, blue,
1482:                        x, y, z);
1483:            }
1484:
1485:            // ---------------------------------------------------------------------
1486:
1487:            //
1488:            // PointLightRetained methods
1489:            //
1490:
1491:            native void updatePointLight(long ctx, int lightSlot, float red,
1492:                    float green, float blue, float ax, float ay, float az,
1493:                    float px, float py, float pz);
1494:
1495:            void updatePointLight(Context ctx, int lightSlot, float red,
1496:                    float green, float blue, float ax, float ay, float az,
1497:                    float px, float py, float pz) {
1498:                updatePointLight(unbox(ctx), lightSlot, red, green, blue, ax,
1499:                        ay, az, px, py, pz);
1500:            }
1501:
1502:            // ---------------------------------------------------------------------
1503:
1504:            //
1505:            // SpotLightRetained methods
1506:            //
1507:
1508:            native void updateSpotLight(long ctx, int lightSlot, float red,
1509:                    float green, float blue, float ax, float ay, float az,
1510:                    float px, float py, float pz, float spreadAngle,
1511:                    float concentration, float dx, float dy, float dz);
1512:
1513:            void updateSpotLight(Context ctx, int lightSlot, float red,
1514:                    float green, float blue, float ax, float ay, float az,
1515:                    float px, float py, float pz, float spreadAngle,
1516:                    float concentration, float dx, float dy, float dz) {
1517:                updateSpotLight(unbox(ctx), lightSlot, red, green, blue, ax,
1518:                        ay, az, px, py, pz, spreadAngle, concentration, dx, dy,
1519:                        dz);
1520:            }
1521:
1522:            // ---------------------------------------------------------------------
1523:
1524:            //
1525:            // ExponentialFogRetained methods
1526:            //
1527:
1528:            native void updateExponentialFog(long ctx, float red, float green,
1529:                    float blue, float density);
1530:
1531:            void updateExponentialFog(Context ctx, float red, float green,
1532:                    float blue, float density) {
1533:                updateExponentialFog(unbox(ctx), red, green, blue, density);
1534:            }
1535:
1536:            // ---------------------------------------------------------------------
1537:
1538:            //
1539:            // LinearFogRetained methods
1540:            //
1541:
1542:            native void updateLinearFog(long ctx, float red, float green,
1543:                    float blue, double fdist, double bdist);
1544:
1545:            void updateLinearFog(Context ctx, float red, float green,
1546:                    float blue, double fdist, double bdist) {
1547:                updateLinearFog(unbox(ctx), red, green, blue, fdist, bdist);
1548:            }
1549:
1550:            // ---------------------------------------------------------------------
1551:
1552:            //
1553:            // LineAttributesRetained methods
1554:            //
1555:
1556:            native void updateLineAttributes(long ctx, float lineWidth,
1557:                    int linePattern, int linePatternMask,
1558:                    int linePatternScaleFactor, boolean lineAntialiasing);
1559:
1560:            void updateLineAttributes(Context ctx, float lineWidth,
1561:                    int linePattern, int linePatternMask,
1562:                    int linePatternScaleFactor, boolean lineAntialiasing) {
1563:                updateLineAttributes(unbox(ctx), lineWidth, linePattern,
1564:                        linePatternMask, linePatternScaleFactor,
1565:                        lineAntialiasing);
1566:            }
1567:
1568:            // ---------------------------------------------------------------------
1569:
1570:            //
1571:            // MaterialRetained methods
1572:            //
1573:
1574:            native void updateMaterial(long ctx, float red, float green,
1575:                    float blue, float alpha, float ared, float agreen,
1576:                    float ablue, float ered, float egreen, float eblue,
1577:                    float dred, float dgreen, float dblue, float sred,
1578:                    float sgreen, float sblue, float shininess,
1579:                    int colorTarget, boolean enable);
1580:
1581:            void updateMaterial(Context ctx, float red, float green,
1582:                    float blue, float alpha, float ared, float agreen,
1583:                    float ablue, float ered, float egreen, float eblue,
1584:                    float dred, float dgreen, float dblue, float sred,
1585:                    float sgreen, float sblue, float shininess,
1586:                    int colorTarget, boolean enable) {
1587:                updateMaterial(unbox(ctx), red, green, blue, alpha, ared,
1588:                        agreen, ablue, ered, egreen, eblue, dred, dgreen,
1589:                        dblue, sred, sgreen, sblue, shininess, colorTarget,
1590:                        enable);
1591:            }
1592:
1593:            // ---------------------------------------------------------------------
1594:
1595:            //
1596:            // ModelClipRetained methods
1597:            //
1598:
1599:            native void updateModelClip(long ctx, int planeNum,
1600:                    boolean enableFlag, double A, double B, double C, double D);
1601:
1602:            void updateModelClip(Context ctx, int planeNum, boolean enableFlag,
1603:                    double A, double B, double C, double D) {
1604:                updateModelClip(unbox(ctx), planeNum, enableFlag, A, B, C, D);
1605:            }
1606:
1607:            // ---------------------------------------------------------------------
1608:
1609:            //
1610:            // PointAttributesRetained methods
1611:            //
1612:
1613:            native void updatePointAttributes(long ctx, float pointSize,
1614:                    boolean pointAntialiasing);
1615:
1616:            void updatePointAttributes(Context ctx, float pointSize,
1617:                    boolean pointAntialiasing) {
1618:                updatePointAttributes(unbox(ctx), pointSize, pointAntialiasing);
1619:            }
1620:
1621:            // ---------------------------------------------------------------------
1622:
1623:            //
1624:            // PolygonAttributesRetained methods
1625:            //
1626:
1627:            native void updatePolygonAttributes(long ctx, int polygonMode,
1628:                    int cullFace, boolean backFaceNormalFlip,
1629:                    float polygonOffset, float polygonOffsetFactor);
1630:
1631:            void updatePolygonAttributes(Context ctx, int polygonMode,
1632:                    int cullFace, boolean backFaceNormalFlip,
1633:                    float polygonOffset, float polygonOffsetFactor) {
1634:                updatePolygonAttributes(unbox(ctx), polygonMode, cullFace,
1635:                        backFaceNormalFlip, polygonOffset, polygonOffsetFactor);
1636:            }
1637:
1638:            // ---------------------------------------------------------------------
1639:
1640:            //
1641:            // RenderingAttributesRetained methods
1642:            //
1643:
1644:            // TODO : Need to handle stencil operation on the native side -- Chien
1645:            native void updateRenderingAttributes(long ctx,
1646:                    boolean depthBufferWriteEnableOverride,
1647:                    boolean depthBufferEnableOverride,
1648:                    boolean depthBufferEnable, boolean depthBufferWriteEnable,
1649:                    int depthTestFunction, float alphaTestValue,
1650:                    int alphaTestFunction, boolean ignoreVertexColors,
1651:                    boolean rasterOpEnable, int rasterOp,
1652:                    boolean userStencilAvailable, boolean stencilEnable,
1653:                    int stencilFailOp, int stencilZFailOp, int stencilZPassOp,
1654:                    int stencilFunction, int stencilReferenceValue,
1655:                    int stencilCompareMask, int stencilWriteMask);
1656:
1657:            void updateRenderingAttributes(Context ctx,
1658:                    boolean depthBufferWriteEnableOverride,
1659:                    boolean depthBufferEnableOverride,
1660:                    boolean depthBufferEnable, boolean depthBufferWriteEnable,
1661:                    int depthTestFunction, float alphaTestValue,
1662:                    int alphaTestFunction, boolean ignoreVertexColors,
1663:                    boolean rasterOpEnable, int rasterOp,
1664:                    boolean userStencilAvailable, boolean stencilEnable,
1665:                    int stencilFailOp, int stencilZFailOp, int stencilZPassOp,
1666:                    int stencilFunction, int stencilReferenceValue,
1667:                    int stencilCompareMask, int stencilWriteMask) {
1668:                updateRenderingAttributes(unbox(ctx),
1669:                        depthBufferWriteEnableOverride,
1670:                        depthBufferEnableOverride, depthBufferEnable,
1671:                        depthBufferWriteEnable, depthTestFunction,
1672:                        alphaTestValue, alphaTestFunction, ignoreVertexColors,
1673:                        rasterOpEnable, rasterOp, userStencilAvailable,
1674:                        stencilEnable, stencilFailOp, stencilZFailOp,
1675:                        stencilZPassOp, stencilFunction, stencilReferenceValue,
1676:                        stencilCompareMask, stencilWriteMask);
1677:            }
1678:
1679:            // ---------------------------------------------------------------------
1680:
1681:            //
1682:            // TexCoordGenerationRetained methods
1683:            //
1684:
1685:            /**
1686:             * This method updates the native context:
1687:             * trans contains eyeTovworld transform in d3d
1688:             * trans contains vworldToEye transform in ogl
1689:             */
1690:            native void updateTexCoordGeneration(long ctx, boolean enable,
1691:                    int genMode, int format, float planeSx, float planeSy,
1692:                    float planeSz, float planeSw, float planeTx, float planeTy,
1693:                    float planeTz, float planeTw, float planeRx, float planeRy,
1694:                    float planeRz, float planeRw, float planeQx, float planeQy,
1695:                    float planeQz, float planeQw, double[] trans);
1696:
1697:            void updateTexCoordGeneration(Context ctx, boolean enable,
1698:                    int genMode, int format, float planeSx, float planeSy,
1699:                    float planeSz, float planeSw, float planeTx, float planeTy,
1700:                    float planeTz, float planeTw, float planeRx, float planeRy,
1701:                    float planeRz, float planeRw, float planeQx, float planeQy,
1702:                    float planeQz, float planeQw, double[] trans) {
1703:                updateTexCoordGeneration(unbox(ctx), enable, genMode, format,
1704:                        planeSx, planeSy, planeSz, planeSw, planeTx, planeTy,
1705:                        planeTz, planeTw, planeRx, planeRy, planeRz, planeRw,
1706:                        planeQx, planeQy, planeQz, planeQw, trans);
1707:            }
1708:
1709:            // ---------------------------------------------------------------------
1710:
1711:            //
1712:            // TransparencyAttributesRetained methods
1713:            //
1714:
1715:            native void updateTransparencyAttributes(long ctx, float alpha,
1716:                    int geometryType, int polygonMode, boolean lineAA,
1717:                    boolean pointAA, int transparencyMode,
1718:                    int srcBlendFunction, int dstBlendFunction);
1719:
1720:            void updateTransparencyAttributes(Context ctx, float alpha,
1721:                    int geometryType, int polygonMode, boolean lineAA,
1722:                    boolean pointAA, int transparencyMode,
1723:                    int srcBlendFunction, int dstBlendFunction) {
1724:                updateTransparencyAttributes(unbox(ctx), alpha, geometryType,
1725:                        polygonMode, lineAA, pointAA, transparencyMode,
1726:                        srcBlendFunction, dstBlendFunction);
1727:            }
1728:
1729:            // ---------------------------------------------------------------------
1730:
1731:            //
1732:            // TextureAttributesRetained methods
1733:            //
1734:
1735:            native void updateTextureAttributes(long ctx, double[] transform,
1736:                    boolean isIdentity, int textureMode,
1737:                    int perspCorrectionMode, float red, float green,
1738:                    float blue, float alpha, int textureFormat);
1739:
1740:            void updateTextureAttributes(Context ctx, double[] transform,
1741:                    boolean isIdentity, int textureMode,
1742:                    int perspCorrectionMode, float red, float green,
1743:                    float blue, float alpha, int textureFormat) {
1744:                updateTextureAttributes(unbox(ctx), transform, isIdentity,
1745:                        textureMode, perspCorrectionMode, red, green, blue,
1746:                        alpha, textureFormat);
1747:            }
1748:
1749:            native void updateRegisterCombiners(long ctx, double[] transform,
1750:                    boolean isIdentity, int textureMode,
1751:                    int perspCorrectionMode, float red, float green,
1752:                    float blue, float alpha, int textureFormat,
1753:                    int combineRgbMode, int combineAlphaMode,
1754:                    int[] combineRgbSrc, int[] combineAlphaSrc,
1755:                    int[] combineRgbFcn, int[] combineAlphaFcn,
1756:                    int combineRgbScale, int combineAlphaScale);
1757:
1758:            void updateRegisterCombiners(Context ctx, double[] transform,
1759:                    boolean isIdentity, int textureMode,
1760:                    int perspCorrectionMode, float red, float green,
1761:                    float blue, float alpha, int textureFormat,
1762:                    int combineRgbMode, int combineAlphaMode,
1763:                    int[] combineRgbSrc, int[] combineAlphaSrc,
1764:                    int[] combineRgbFcn, int[] combineAlphaFcn,
1765:                    int combineRgbScale, int combineAlphaScale) {
1766:                updateRegisterCombiners(unbox(ctx), transform, isIdentity,
1767:                        textureMode, perspCorrectionMode, red, green, blue,
1768:                        alpha, textureFormat, combineRgbMode, combineAlphaMode,
1769:                        combineRgbSrc, combineAlphaSrc, combineRgbFcn,
1770:                        combineAlphaFcn, combineRgbScale, combineAlphaScale);
1771:            }
1772:
1773:            native void updateTextureColorTable(long ctx, int numComponents,
1774:                    int colorTableSize, int[] colorTable);
1775:
1776:            void updateTextureColorTable(Context ctx, int numComponents,
1777:                    int colorTableSize, int[] colorTable) {
1778:                updateTextureColorTable(unbox(ctx), numComponents,
1779:                        colorTableSize, colorTable);
1780:            }
1781:
1782:            native void updateCombiner(long ctx, int combineRgbMode,
1783:                    int combineAlphaMode, int[] combineRgbSrc,
1784:                    int[] combineAlphaSrc, int[] combineRgbFcn,
1785:                    int[] combineAlphaFcn, int combineRgbScale,
1786:                    int combineAlphaScale);
1787:
1788:            void updateCombiner(Context ctx, int combineRgbMode,
1789:                    int combineAlphaMode, int[] combineRgbSrc,
1790:                    int[] combineAlphaSrc, int[] combineRgbFcn,
1791:                    int[] combineAlphaFcn, int combineRgbScale,
1792:                    int combineAlphaScale) {
1793:                updateCombiner(unbox(ctx), combineRgbMode, combineAlphaMode,
1794:                        combineRgbSrc, combineAlphaSrc, combineRgbFcn,
1795:                        combineAlphaFcn, combineRgbScale, combineAlphaScale);
1796:            }
1797:
1798:            // ---------------------------------------------------------------------
1799:
1800:            //
1801:            // TextureUnitStateRetained methods
1802:            //
1803:
1804:            native void updateTextureUnitState(long ctx, int unitIndex,
1805:                    boolean enableFlag);
1806:
1807:            void updateTextureUnitState(Context ctx, int unitIndex,
1808:                    boolean enableFlag) {
1809:                updateTextureUnitState(unbox(ctx), unitIndex, enableFlag);
1810:            }
1811:
1812:            // ---------------------------------------------------------------------
1813:
1814:            //
1815:            // TextureRetained methods
1816:            // Texture2DRetained methods
1817:            //
1818:
1819:            native void bindTexture2D(long ctx, int objectId, boolean enable);
1820:
1821:            void bindTexture2D(Context ctx, int objectId, boolean enable) {
1822:                bindTexture2D(unbox(ctx), objectId, enable);
1823:            }
1824:
1825:            native void updateTexture2DImage(long ctx, int numLevels,
1826:                    int level, int textureFormat, int imageFormat, int width,
1827:                    int height, int boundaryWidth, int imageDataType,
1828:                    Object data, boolean useAutoMipMap);
1829:
1830:            void updateTexture2DImage(Context ctx, int numLevels, int level,
1831:                    int textureFormat, int imageFormat, int width, int height,
1832:                    int boundaryWidth, int imageDataType, Object data,
1833:                    boolean useAutoMipMap) {
1834:                updateTexture2DImage(unbox(ctx), numLevels, level,
1835:                        textureFormat, imageFormat, width, height,
1836:                        boundaryWidth, imageDataType, data, useAutoMipMap);
1837:            }
1838:
1839:            native void updateTexture2DSubImage(long ctx, int level,
1840:                    int xoffset, int yoffset, int textureFormat,
1841:                    int imageFormat, int imgXOffset, int imgYOffset, int tilew,
1842:                    int width, int height, int imageDataType, Object data,
1843:                    boolean useAutoMipMap);
1844:
1845:            void updateTexture2DSubImage(Context ctx, int level, int xoffset,
1846:                    int yoffset, int textureFormat, int imageFormat,
1847:                    int imgXOffset, int imgYOffset, int tilew, int width,
1848:                    int height, int imageDataType, Object data,
1849:                    boolean useAutoMipMap) {
1850:                updateTexture2DSubImage(unbox(ctx), level, xoffset, yoffset,
1851:                        textureFormat, imageFormat, imgXOffset, imgYOffset,
1852:                        tilew, width, height, imageDataType, data,
1853:                        useAutoMipMap);
1854:            }
1855:
1856:            native void updateTexture2DLodRange(long ctx, int baseLevel,
1857:                    int maximumLevel, float minimumLod, float maximumLod);
1858:
1859:            void updateTexture2DLodRange(Context ctx, int baseLevel,
1860:                    int maximumLevel, float minimumLod, float maximumLod) {
1861:                updateTexture2DLodRange(unbox(ctx), baseLevel, maximumLevel,
1862:                        minimumLod, maximumLod);
1863:            }
1864:
1865:            native void updateTexture2DLodOffset(long ctx, float lodOffsetX,
1866:                    float lodOffsetY, float lodOffsetZ);
1867:
1868:            void updateTexture2DLodOffset(Context ctx, float lodOffsetX,
1869:                    float lodOffsetY, float lodOffsetZ) {
1870:                updateTexture2DLodOffset(unbox(ctx), lodOffsetX, lodOffsetY,
1871:                        lodOffsetZ);
1872:            }
1873:
1874:            native void updateTexture2DBoundary(long ctx, int boundaryModeS,
1875:                    int boundaryModeT, float boundaryRed, float boundaryGreen,
1876:                    float boundaryBlue, float boundaryAlpha);
1877:
1878:            void updateTexture2DBoundary(Context ctx, int boundaryModeS,
1879:                    int boundaryModeT, float boundaryRed, float boundaryGreen,
1880:                    float boundaryBlue, float boundaryAlpha) {
1881:                updateTexture2DBoundary(unbox(ctx), boundaryModeS,
1882:                        boundaryModeT, boundaryRed, boundaryGreen,
1883:                        boundaryBlue, boundaryAlpha);
1884:            }
1885:
1886:            native void updateTexture2DFilterModes(long ctx, int minFilter,
1887:                    int magFilter);
1888:
1889:            void updateTexture2DFilterModes(Context ctx, int minFilter,
1890:                    int magFilter) {
1891:                updateTexture2DFilterModes(unbox(ctx), minFilter, magFilter);
1892:            }
1893:
1894:            native void updateTexture2DSharpenFunc(long ctx,
1895:                    int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts);
1896:
1897:            void updateTexture2DSharpenFunc(Context ctx,
1898:                    int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts) {
1899:                updateTexture2DSharpenFunc(unbox(ctx),
1900:                        numSharpenTextureFuncPts, sharpenTextureFuncPts);
1901:            }
1902:
1903:            native void updateTexture2DFilter4Func(long ctx,
1904:                    int numFilter4FuncPts, float[] filter4FuncPts);
1905:
1906:            void updateTexture2DFilter4Func(Context ctx, int numFilter4FuncPts,
1907:                    float[] filter4FuncPts) {
1908:                updateTexture2DFilter4Func(unbox(ctx), numFilter4FuncPts,
1909:                        filter4FuncPts);
1910:            }
1911:
1912:            native void updateTexture2DAnisotropicFilter(long ctx, float degree);
1913:
1914:            void updateTexture2DAnisotropicFilter(Context ctx, float degree) {
1915:                updateTexture2DAnisotropicFilter(unbox(ctx), degree);
1916:            }
1917:
1918:            // ---------------------------------------------------------------------
1919:
1920:            //
1921:            // Texture3DRetained methods
1922:            //
1923:
1924:            native void bindTexture3D(long ctx, int objectId, boolean enable);
1925:
1926:            void bindTexture3D(Context ctx, int objectId, boolean enable) {
1927:                bindTexture3D(unbox(ctx), objectId, enable);
1928:            }
1929:
1930:            native void updateTexture3DImage(long ctx, int numLevels,
1931:                    int level, int textureFormat, int imageFormat, int width,
1932:                    int height, int depth, int boundaryWidth,
1933:                    int imageDataType, Object imageData, boolean useAutoMipMap);
1934:
1935:            void updateTexture3DImage(Context ctx, int numLevels, int level,
1936:                    int textureFormat, int imageFormat, int width, int height,
1937:                    int depth, int boundaryWidth, int imageDataType,
1938:                    Object imageData, boolean useAutoMipMap) {
1939:                updateTexture3DImage(unbox(ctx), numLevels, level,
1940:                        textureFormat, imageFormat, width, height, depth,
1941:                        boundaryWidth, imageDataType, imageData, useAutoMipMap);
1942:            }
1943:
1944:            native void updateTexture3DSubImage(long ctx, int level,
1945:                    int xoffset, int yoffset, int zoffset, int textureFormat,
1946:                    int imageFormat, int imgXoffset, int imgYoffset,
1947:                    int imgZoffset, int tilew, int tileh, int width,
1948:                    int height, int depth, int imageDataType, Object imageData,
1949:                    boolean useAutoMipMap);
1950:
1951:            void updateTexture3DSubImage(Context ctx, int level, int xoffset,
1952:                    int yoffset, int zoffset, int textureFormat,
1953:                    int imageFormat, int imgXoffset, int imgYoffset,
1954:                    int imgZoffset, int tilew, int tileh, int width,
1955:                    int height, int depth, int imageDataType, Object imageData,
1956:                    boolean useAutoMipMap) {
1957:                updateTexture3DSubImage(unbox(ctx), level, xoffset, yoffset,
1958:                        zoffset, textureFormat, imageFormat, imgXoffset,
1959:                        imgYoffset, imgZoffset, tilew, tileh, width, height,
1960:                        depth, imageDataType, imageData, useAutoMipMap);
1961:            }
1962:
1963:            native void updateTexture3DLodRange(long ctx, int baseLevel,
1964:                    int maximumLevel, float minimumLod, float maximumLod);
1965:
1966:            void updateTexture3DLodRange(Context ctx, int baseLevel,
1967:                    int maximumLevel, float minimumLod, float maximumLod) {
1968:                updateTexture3DLodRange(unbox(ctx), baseLevel, maximumLevel,
1969:                        minimumLod, maximumLod);
1970:            }
1971:
1972:            native void updateTexture3DLodOffset(long ctx, float lodOffsetX,
1973:                    float lodOffsetY, float lodOffsetZ);
1974:
1975:            void updateTexture3DLodOffset(Context ctx, float lodOffsetX,
1976:                    float lodOffsetY, float lodOffsetZ) {
1977:                updateTexture3DLodOffset(unbox(ctx), lodOffsetX, lodOffsetY,
1978:                        lodOffsetZ);
1979:            }
1980:
1981:            native void updateTexture3DBoundary(long ctx, int boundaryModeS,
1982:                    int boundaryModeT, int boundaryModeR, float boundaryRed,
1983:                    float boundaryGreen, float boundaryBlue, float boundaryAlpha);
1984:
1985:            void updateTexture3DBoundary(Context ctx, int boundaryModeS,
1986:                    int boundaryModeT, int boundaryModeR, float boundaryRed,
1987:                    float boundaryGreen, float boundaryBlue, float boundaryAlpha) {
1988:                updateTexture3DBoundary(unbox(ctx), boundaryModeS,
1989:                        boundaryModeT, boundaryModeR, boundaryRed,
1990:                        boundaryGreen, boundaryBlue, boundaryAlpha);
1991:            }
1992:
1993:            native void updateTexture3DFilterModes(long ctx, int minFilter,
1994:                    int magFilter);
1995:
1996:            void updateTexture3DFilterModes(Context ctx, int minFilter,
1997:                    int magFilter) {
1998:                updateTexture3DFilterModes(unbox(ctx), minFilter, magFilter);
1999:            }
2000:
2001:            native void updateTexture3DSharpenFunc(long ctx,
2002:                    int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts);
2003:
2004:            void updateTexture3DSharpenFunc(Context ctx,
2005:                    int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts) {
2006:                updateTexture3DSharpenFunc(unbox(ctx),
2007:                        numSharpenTextureFuncPts, sharpenTextureFuncPts);
2008:            }
2009:
2010:            native void updateTexture3DFilter4Func(long ctx,
2011:                    int numFilter4FuncPts, float[] filter4FuncPts);
2012:
2013:            void updateTexture3DFilter4Func(Context ctx, int numFilter4FuncPts,
2014:                    float[] filter4FuncPts) {
2015:                updateTexture3DFilter4Func(unbox(ctx), numFilter4FuncPts,
2016:                        filter4FuncPts);
2017:            }
2018:
2019:            native void updateTexture3DAnisotropicFilter(long ctx, float degree);
2020:
2021:            void updateTexture3DAnisotropicFilter(Context ctx, float degree) {
2022:                updateTexture3DAnisotropicFilter(unbox(ctx), degree);
2023:            }
2024:
2025:            // ---------------------------------------------------------------------
2026:
2027:            //
2028:            // TextureCubeMapRetained methods
2029:            //
2030:
2031:            native void bindTextureCubeMap(long ctx, int objectId,
2032:                    boolean enable);
2033:
2034:            void bindTextureCubeMap(Context ctx, int objectId, boolean enable) {
2035:                bindTextureCubeMap(unbox(ctx), objectId, enable);
2036:            }
2037:
2038:            native void updateTextureCubeMapImage(long ctx, int face,
2039:                    int numLevels, int level, int textureFormat,
2040:                    int imageFormat, int width, int height, int boundaryWidth,
2041:                    int imageDataType, Object imageData, boolean useAutoMipMap);
2042:
2043:            void updateTextureCubeMapImage(Context ctx, int face,
2044:                    int numLevels, int level, int textureFormat,
2045:                    int imageFormat, int width, int height, int boundaryWidth,
2046:                    int imageDataType, Object imageData, boolean useAutoMipMap) {
2047:                updateTextureCubeMapImage(unbox(ctx), face, numLevels, level,
2048:                        textureFormat, imageFormat, width, height,
2049:                        boundaryWidth, imageDataType, imageData, useAutoMipMap);
2050:            }
2051:
2052:            native void updateTextureCubeMapSubImage(long ctx, int face,
2053:                    int level, int xoffset, int yoffset, int textureFormat,
2054:                    int imageFormat, int imgXOffset, int imgYOffset, int tilew,
2055:                    int width, int height, int imageDataType, Object imageData,
2056:                    boolean useAutoMipMap);
2057:
2058:            void updateTextureCubeMapSubImage(Context ctx, int face, int level,
2059:                    int xoffset, int yoffset, int textureFormat,
2060:                    int imageFormat, int imgXOffset, int imgYOffset, int tilew,
2061:                    int width, int height, int imageDataType, Object imageData,
2062:                    boolean useAutoMipMap) {
2063:                updateTextureCubeMapSubImage(unbox(ctx), face, level, xoffset,
2064:                        yoffset, textureFormat, imageFormat, imgXOffset,
2065:                        imgYOffset, tilew, width, height, imageDataType,
2066:                        imageData, useAutoMipMap);
2067:            }
2068:
2069:            native void updateTextureCubeMapLodRange(long ctx, int baseLevel,
2070:                    int maximumLevel, float minimumLod, float maximumLod);
2071:
2072:            void updateTextureCubeMapLodRange(Context ctx, int baseLevel,
2073:                    int maximumLevel, float minimumLod, float maximumLod) {
2074:                updateTextureCubeMapLodRange(unbox(ctx), baseLevel,
2075:                        maximumLevel, minimumLod, maximumLod);
2076:            }
2077:
2078:            native void updateTextureCubeMapLodOffset(long ctx,
2079:                    float lodOffsetX, float lodOffsetY, float lodOffsetZ);
2080:
2081:            void updateTextureCubeMapLodOffset(Context ctx, float lodOffsetX,
2082:                    float lodOffsetY, float lodOffsetZ) {
2083:                updateTextureCubeMapLodOffset(unbox(ctx), lodOffsetX,
2084:                        lodOffsetY, lodOffsetZ);
2085:            }
2086:
2087:            native void updateTextureCubeMapBoundary(long ctx,
2088:                    int boundaryModeS, int boundaryModeT, float boundaryRed,
2089:                    float boundaryGreen, float boundaryBlue, float boundaryAlpha);
2090:
2091:            void updateTextureCubeMapBoundary(Context ctx, int boundaryModeS,
2092:                    int boundaryModeT, float boundaryRed, float boundaryGreen,
2093:                    float boundaryBlue, float boundaryAlpha) {
2094:                updateTextureCubeMapBoundary(unbox(ctx), boundaryModeS,
2095:                        boundaryModeT, boundaryRed, boundaryGreen,
2096:                        boundaryBlue, boundaryAlpha);
2097:            }
2098:
2099:            native void updateTextureCubeMapFilterModes(long ctx,
2100:                    int minFilter, int magFilter);
2101:
2102:            void updateTextureCubeMapFilterModes(Context ctx, int minFilter,
2103:                    int magFilter) {
2104:                updateTextureCubeMapFilterModes(unbox(ctx), minFilter,
2105:                        magFilter);
2106:            }
2107:
2108:            native void updateTextureCubeMapSharpenFunc(long ctx,
2109:                    int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts);
2110:
2111:            void updateTextureCubeMapSharpenFunc(Context ctx,
2112:                    int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts) {
2113:                updateTextureCubeMapSharpenFunc(unbox(ctx),
2114:                        numSharpenTextureFuncPts, sharpenTextureFuncPts);
2115:            }
2116:
2117:            native void updateTextureCubeMapFilter4Func(long ctx,
2118:                    int numFilter4FuncPts, float[] filter4FuncPts);
2119:
2120:            void updateTextureCubeMapFilter4Func(Context ctx,
2121:                    int numFilter4FuncPts, float[] filter4FuncPts) {
2122:                updateTextureCubeMapFilter4Func(unbox(ctx), numFilter4FuncPts,
2123:                        filter4FuncPts);
2124:            }
2125:
2126:            native void updateTextureCubeMapAnisotropicFilter(long ctx,
2127:                    float degree);
2128:
2129:            void updateTextureCubeMapAnisotropicFilter(Context ctx, float degree) {
2130:                updateTextureCubeMapAnisotropicFilter(unbox(ctx), degree);
2131:            }
2132:
2133:            // ---------------------------------------------------------------------
2134:
2135:            //
2136:            // MasterControl methods
2137:            //
2138:
2139:            // Method to return the AWT object
2140:            native long getAWT();
2141:
2142:            // Method to initialize the native J3D library
2143:            native boolean initializeJ3D(boolean disableXinerama);
2144:
2145:            // Maximum lights supported by the native API
2146:            native int getMaximumLights();
2147:
2148:            // ---------------------------------------------------------------------
2149:
2150:            //
2151:            // Canvas3D methods
2152:            //
2153:
2154:            // This is the native method for creating the underlying graphics context.
2155:            native long createNewContext(Canvas3D cv, long display,
2156:                    long drawable, long fbConfig, long shareCtx,
2157:                    boolean isSharedCtx, boolean offScreen,
2158:                    boolean glslLibraryAvailable, boolean cgLibraryAvailable);
2159:
2160:            // This is the native method for creating the underlying graphics context.
2161:            Context createNewContext(Canvas3D cv, long display,
2162:                    Drawable drawable, long fbConfig, Context shareCtx,
2163:                    boolean isSharedCtx, boolean offScreen,
2164:                    boolean glslLibraryAvailable, boolean cgLibraryAvailable) {
2165:
2166:                long nativeCtx = createNewContext(cv, display, unbox(drawable),
2167:                        fbConfig, unbox(shareCtx), isSharedCtx, offScreen,
2168:                        glslLibraryAvailable, cgLibraryAvailable);
2169:
2170:                return boxContext(nativeCtx);
2171:            }
2172:
2173:            native void createQueryContext(Canvas3D cv, long display,
2174:                    long drawable, long fbConfig, boolean offScreen, int width,
2175:                    int height, boolean glslLibraryAvailable,
2176:                    boolean cgLibraryAvailable);
2177:
2178:            void createQueryContext(Canvas3D cv, long display,
2179:                    Drawable drawable, long fbConfig, boolean offScreen,
2180:                    int width, int height, boolean glslLibraryAvailable,
2181:                    boolean cgLibraryAvailable) {
2182:
2183:                createQueryContext(cv, display, unbox(drawable), fbConfig,
2184:                        offScreen, width, height, glslLibraryAvailable,
2185:                        cgLibraryAvailable);
2186:            }
2187:
2188:            // This is the native for creating offscreen buffer
2189:            native long createOffScreenBuffer(Canvas3D cv, long ctx,
2190:                    long display, long fbConfig, int width, int height);
2191:
2192:            Drawable createOffScreenBuffer(Canvas3D cv, Context ctx,
2193:                    long display, long fbConfig, int width, int height) {
2194:                long nativeDrawable = createOffScreenBuffer(cv, unbox(ctx),
2195:                        display, fbConfig, width, height);
2196:                return boxDrawable(nativeDrawable);
2197:            }
2198:
2199:            native void destroyOffScreenBuffer(Canvas3D cv, long ctx,
2200:                    long display, long fbConfig, long drawable);
2201:
2202:            void destroyOffScreenBuffer(Canvas3D cv, Context ctx, long display,
2203:                    long fbConfig, Drawable drawable) {
2204:                destroyOffScreenBuffer(cv, unbox(ctx), display, fbConfig,
2205:                        unbox(drawable));
2206:            }
2207:
2208:            // This is the native for reading the image from the offscreen buffer
2209:            native void readOffScreenBuffer(Canvas3D cv, long ctx, int format,
2210:                    int type, Object data, int width, int height);
2211:
2212:            void readOffScreenBuffer(Canvas3D cv, Context ctx, int format,
2213:                    int type, Object data, int width, int height) {
2214:                readOffScreenBuffer(cv, unbox(ctx), format, type, data, width,
2215:                        height);
2216:            }
2217:
2218:            // The native method for swapBuffers
2219:            native int swapBuffers(Canvas3D cv, long ctx, long dpy,
2220:                    long drawable);
2221:
2222:            int swapBuffers(Canvas3D cv, Context ctx, long dpy,
2223:                    Drawable drawable) {
2224:                return swapBuffers(cv, unbox(ctx), dpy, unbox(drawable));
2225:            }
2226:
2227:            // notify D3D that Canvas is resize
2228:            native int resizeD3DCanvas(Canvas3D cv, long ctx);
2229:
2230:            int resizeD3DCanvas(Canvas3D cv, Context ctx) {
2231:                return resizeD3DCanvas(cv, unbox(ctx));
2232:            }
2233:
2234:            // notify D3D to toggle between FullScreen and window mode
2235:            native int toggleFullScreenMode(Canvas3D cv, long ctx);
2236:
2237:            int toggleFullScreenMode(Canvas3D cv, Context ctx) {
2238:                return toggleFullScreenMode(cv, unbox(ctx));
2239:            }
2240:
2241:            // native method for setting Material when no material is present
2242:            native void updateMaterialColor(long ctx, float r, float g,
2243:                    float b, float a);
2244:
2245:            void updateMaterialColor(Context ctx, float r, float g, float b,
2246:                    float a) {
2247:                updateMaterialColor(unbox(ctx), r, g, b, a);
2248:            }
2249:
2250:            native void destroyContext(long display, long drawable, long ctx);
2251:
2252:            void destroyContext(long display, Drawable drawable, Context ctx) {
2253:                assert display != 0 || VirtualUniverse.mc.isWindows();
2254:                assert ctx != null;
2255:                assert drawable != null;
2256:                destroyContext(display, unbox(drawable), unbox(ctx));
2257:            }
2258:
2259:            // This is the native method for doing accumulation.
2260:            native void accum(long ctx, float value);
2261:
2262:            void accum(Context ctx, float value) {
2263:                accum(unbox(ctx), value);
2264:            }
2265:
2266:            // This is the native method for doing accumulation return.
2267:            native void accumReturn(long ctx);
2268:
2269:            void accumReturn(Context ctx) {
2270:                accumReturn(unbox(ctx));
2271:            }
2272:
2273:            // This is the native method for clearing the accumulation buffer.
2274:            native void clearAccum(long ctx);
2275:
2276:            void clearAccum(Context ctx) {
2277:                clearAccum(unbox(ctx));
2278:            }
2279:
2280:            // This is the native method for getting the number of lights the underlying
2281:            // native library can support.
2282:            native int getNumCtxLights(long ctx);
2283:
2284:            int getNumCtxLights(Context ctx) {
2285:                return getNumCtxLights(unbox(ctx));
2286:            }
2287:
2288:            // Native method for decal 1st child setup
2289:            native boolean decal1stChildSetup(long ctx);
2290:
2291:            boolean decal1stChildSetup(Context ctx) {
2292:                return decal1stChildSetup(unbox(ctx));
2293:            }
2294:
2295:            // Native method for decal nth child setup
2296:            native void decalNthChildSetup(long ctx);
2297:
2298:            void decalNthChildSetup(Context ctx) {
2299:                decalNthChildSetup(unbox(ctx));
2300:            }
2301:
2302:            // Native method for decal reset
2303:            native void decalReset(long ctx, boolean depthBufferEnable);
2304:
2305:            void decalReset(Context ctx, boolean depthBufferEnable) {
2306:                decalReset(unbox(ctx), depthBufferEnable);
2307:            }
2308:
2309:            // Native method for decal reset
2310:            native void ctxUpdateEyeLightingEnable(long ctx,
2311:                    boolean localEyeLightingEnable);
2312:
2313:            void ctxUpdateEyeLightingEnable(Context ctx,
2314:                    boolean localEyeLightingEnable) {
2315:                ctxUpdateEyeLightingEnable(unbox(ctx), localEyeLightingEnable);
2316:            }
2317:
2318:            // The following three methods are used in multi-pass case
2319:
2320:            // native method for setting blend color
2321:            native void setBlendColor(long ctx, float red, float green,
2322:                    float blue, float alpha);
2323:
2324:            void setBlendColor(Context ctx, float red, float green, float blue,
2325:                    float alpha) {
2326:                setBlendColor(unbox(ctx), red, green, blue, alpha);
2327:            }
2328:
2329:            // native method for setting blend func
2330:            native void setBlendFunc(long ctx, int src, int dst);
2331:
2332:            void setBlendFunc(Context ctx, int src, int dst) {
2333:                setBlendFunc(unbox(ctx), src, dst);
2334:            }
2335:
2336:            // native method for setting fog enable flag
2337:            native void setFogEnableFlag(long ctx, boolean enableFlag);
2338:
2339:            void setFogEnableFlag(Context ctx, boolean enableFlag) {
2340:                setFogEnableFlag(unbox(ctx), enableFlag);
2341:            }
2342:
2343:            // Setup the full scene antialising in D3D and ogl when GL_ARB_multisamle supported
2344:            native void setFullSceneAntialiasing(long ctx, boolean enable);
2345:
2346:            void setFullSceneAntialiasing(Context ctx, boolean enable) {
2347:                setFullSceneAntialiasing(unbox(ctx), enable);
2348:            }
2349:
2350:            native void setGlobalAlpha(long ctx, float alpha);
2351:
2352:            void setGlobalAlpha(Context ctx, float alpha) {
2353:                setGlobalAlpha(unbox(ctx), alpha);
2354:            }
2355:
2356:            // Native method to update separate specular color control
2357:            native void updateSeparateSpecularColorEnable(long ctx,
2358:                    boolean control);
2359:
2360:            void updateSeparateSpecularColorEnable(Context ctx, boolean control) {
2361:                updateSeparateSpecularColorEnable(unbox(ctx), control);
2362:            }
2363:
2364:            // Initialization for D3D when scene begin
2365:            native void beginScene(long ctx);
2366:
2367:            void beginScene(Context ctx) {
2368:                beginScene(unbox(ctx));
2369:            }
2370:
2371:            native void endScene(long ctx);
2372:
2373:            void endScene(Context ctx) {
2374:                endScene(unbox(ctx));
2375:            }
2376:
2377:            // True under Solaris,
2378:            // False under windows when display mode <= 8 bit
2379:            native boolean validGraphicsMode();
2380:
2381:            // native method for setting light enables
2382:            native void setLightEnables(long ctx, long enableMask, int maxLights);
2383:
2384:            void setLightEnables(Context ctx, long enableMask, int maxLights) {
2385:                setLightEnables(unbox(ctx), enableMask, maxLights);
2386:            }
2387:
2388:            // native method for setting scene ambient
2389:            native void setSceneAmbient(long ctx, float red, float green,
2390:                    float blue);
2391:
2392:            void setSceneAmbient(Context ctx, float red, float green, float blue) {
2393:                setSceneAmbient(unbox(ctx), red, green, blue);
2394:            }
2395:
2396:            // native method for disabling fog
2397:            native void disableFog(long ctx);
2398:
2399:            void disableFog(Context ctx) {
2400:                disableFog(unbox(ctx));
2401:            }
2402:
2403:            // native method for disabling modelClip
2404:            native void disableModelClip(long ctx);
2405:
2406:            void disableModelClip(Context ctx) {
2407:                disableModelClip(unbox(ctx));
2408:            }
2409:
2410:            // native method for setting default RenderingAttributes
2411:            native void resetRenderingAttributes(long ctx,
2412:                    boolean depthBufferWriteEnableOverride,
2413:                    boolean depthBufferEnableOverride);
2414:
2415:            void resetRenderingAttributes(Context ctx,
2416:                    boolean depthBufferWriteEnableOverride,
2417:                    boolean depthBufferEnableOverride) {
2418:                resetRenderingAttributes(unbox(ctx),
2419:                        depthBufferWriteEnableOverride,
2420:                        depthBufferEnableOverride);
2421:            }
2422:
2423:            // native method for setting default texture
2424:            native void resetTextureNative(long ctx, int texUnitIndex);
2425:
2426:            void resetTextureNative(Context ctx, int texUnitIndex) {
2427:                resetTextureNative(unbox(ctx), texUnitIndex);
2428:            }
2429:
2430:            // native method for activating a particular texture unit
2431:            native void activeTextureUnit(long ctx, int texUnitIndex);
2432:
2433:            void activeTextureUnit(Context ctx, int texUnitIndex) {
2434:                activeTextureUnit(unbox(ctx), texUnitIndex);
2435:            }
2436:
2437:            // native method for setting default TexCoordGeneration
2438:            native void resetTexCoordGeneration(long ctx);
2439:
2440:            void resetTexCoordGeneration(Context ctx) {
2441:                resetTexCoordGeneration(unbox(ctx));
2442:            }
2443:
2444:            // native method for setting default TextureAttributes
2445:            native void resetTextureAttributes(long ctx);
2446:
2447:            void resetTextureAttributes(Context ctx) {
2448:                resetTextureAttributes(unbox(ctx));
2449:            }
2450:
2451:            // native method for setting default PolygonAttributes
2452:            native void resetPolygonAttributes(long ctx);
2453:
2454:            void resetPolygonAttributes(Context ctx) {
2455:                resetPolygonAttributes(unbox(ctx));
2456:            }
2457:
2458:            // native method for setting default LineAttributes
2459:            native void resetLineAttributes(long ctx);
2460:
2461:            void resetLineAttributes(Context ctx) {
2462:                resetLineAttributes(unbox(ctx));
2463:            }
2464:
2465:            // native method for setting default PointAttributes
2466:            native void resetPointAttributes(long ctx);
2467:
2468:            void resetPointAttributes(Context ctx) {
2469:                resetPointAttributes(unbox(ctx));
2470:            }
2471:
2472:            // native method for setting default TransparencyAttributes
2473:            native void resetTransparency(long ctx, int geometryType,
2474:                    int polygonMode, boolean lineAA, boolean pointAA);
2475:
2476:            void resetTransparency(Context ctx, int geometryType,
2477:                    int polygonMode, boolean lineAA, boolean pointAA) {
2478:                resetTransparency(unbox(ctx), geometryType, polygonMode,
2479:                        lineAA, pointAA);
2480:            }
2481:
2482:            // native method for setting default ColoringAttributes
2483:            native void resetColoringAttributes(long ctx, float r, float g,
2484:                    float b, float a, boolean enableLight);
2485:
2486:            void resetColoringAttributes(Context ctx, float r, float g,
2487:                    float b, float a, boolean enableLight) {
2488:                resetColoringAttributes(unbox(ctx), r, g, b, a, enableLight);
2489:            }
2490:
2491:            /**
2492:             *  This native method makes sure that the rendering for this canvas
2493:             *  gets done now.
2494:             */
2495:            native void syncRender(long ctx, boolean wait);
2496:
2497:            void syncRender(Context ctx, boolean wait) {
2498:                syncRender(unbox(ctx), wait);
2499:            }
2500:
2501:            // The native method that sets this ctx to be the current one
2502:            native boolean useCtx(long ctx, long display, long drawable);
2503:
2504:            boolean useCtx(Context ctx, long display, Drawable drawable) {
2505:                assert display != 0 || VirtualUniverse.mc.isWindows();
2506:                return useCtx(unbox(ctx), display, unbox(drawable));
2507:            }
2508:
2509:            native void clear(long ctx, float r, float g, float b,
2510:                    boolean clearStencil);
2511:
2512:            void clear(Context ctx, float r, float g, float b,
2513:                    boolean clearStencil) {
2514:                clear(unbox(ctx), r, g, b, clearStencil);
2515:
2516:            }
2517:
2518:            native void textureFillBackground(long ctx, float texMinU,
2519:                    float texMaxU, float texMinV, float texMaxV, float mapMinX,
2520:                    float mapMaxX, float mapMinY, float mapMaxY,
2521:                    boolean useBiliearFilter);
2522:
2523:            void textureFillBackground(Context ctx, float texMinU,
2524:                    float texMaxU, float texMinV, float texMaxV, float mapMinX,
2525:                    float mapMaxX, float mapMinY, float mapMaxY,
2526:                    boolean useBiliearFilter) {
2527:                textureFillBackground(unbox(ctx), texMinU, texMaxU, texMinV,
2528:                        texMaxV, mapMinX, mapMaxX, mapMinY, mapMaxY,
2529:                        useBiliearFilter);
2530:            }
2531:
2532:            native void textureFillRaster(long ctx, float texMinU,
2533:                    float texMaxU, float texMinV, float texMaxV, float mapMinX,
2534:                    float mapMaxX, float mapMinY, float mapMaxY, float mapZ,
2535:                    float alpha, boolean useBiliearFilter);
2536:
2537:            void textureFillRaster(Context ctx, float texMinU, float texMaxU,
2538:                    float texMinV, float texMaxV, float mapMinX, float mapMaxX,
2539:                    float mapMinY, float mapMaxY, float mapZ, float alpha,
2540:                    boolean useBiliearFilter) {
2541:                textureFillRaster(unbox(ctx), texMinU, texMaxU, texMinV,
2542:                        texMaxV, mapMinX, mapMaxX, mapMinY, mapMaxY, mapZ,
2543:                        alpha, useBiliearFilter);
2544:            }
2545:
2546:            native void executeRasterDepth(long ctx, float posX, float posY,
2547:                    float posZ, int srcOffsetX, int srcOffsetY,
2548:                    int rasterWidth, int rasterHeight, int depthWidth,
2549:                    int depthHeight, int depthType, Object depthData);
2550:
2551:            void executeRasterDepth(Context ctx, float posX, float posY,
2552:                    float posZ, int srcOffsetX, int srcOffsetY,
2553:                    int rasterWidth, int rasterHeight, int depthWidth,
2554:                    int depthHeight, int depthType, Object depthData) {
2555:                executeRasterDepth(unbox(ctx), posX, posY, posZ, srcOffsetX,
2556:                        srcOffsetY, rasterWidth, rasterHeight, depthWidth,
2557:                        depthHeight, depthType, depthData);
2558:            }
2559:
2560:            // The native method for setting the ModelView matrix.
2561:            native void setModelViewMatrix(long ctx, double[] viewMatrix,
2562:                    double[] modelMatrix);
2563:
2564:            void setModelViewMatrix(Context ctx, double[] viewMatrix,
2565:                    double[] modelMatrix) {
2566:                setModelViewMatrix(unbox(ctx), viewMatrix, modelMatrix);
2567:            }
2568:
2569:            // The native method for setting the Projection matrix.
2570:            native void setProjectionMatrix(long ctx, double[] projMatrix);
2571:
2572:            void setProjectionMatrix(Context ctx, double[] projMatrix) {
2573:                setProjectionMatrix(unbox(ctx), projMatrix);
2574:            }
2575:
2576:            // The native method for setting the Viewport.
2577:            native void setViewport(long ctx, int x, int y, int width,
2578:                    int height);
2579:
2580:            void setViewport(Context ctx, int x, int y, int width, int height) {
2581:                setViewport(unbox(ctx), x, y, width, height);
2582:            }
2583:
2584:            // used for display Lists
2585:            native void newDisplayList(long ctx, int displayListId);
2586:
2587:            void newDisplayList(Context ctx, int displayListId) {
2588:                newDisplayList(unbox(ctx), displayListId);
2589:            }
2590:
2591:            native void endDisplayList(long ctx);
2592:
2593:            void endDisplayList(Context ctx) {
2594:                endDisplayList(unbox(ctx));
2595:            }
2596:
2597:            native void callDisplayList(long ctx, int id,
2598:                    boolean isNonUniformScale);
2599:
2600:            void callDisplayList(Context ctx, int id, boolean isNonUniformScale) {
2601:                callDisplayList(unbox(ctx), id, isNonUniformScale);
2602:            }
2603:
2604:            native void freeDisplayList(long ctx, int id);
2605:
2606:            void freeDisplayList(Context ctx, int id) {
2607:                freeDisplayList(unbox(ctx), id);
2608:            }
2609:
2610:            native void freeTexture(long ctx, int id);
2611:
2612:            void freeTexture(Context ctx, int id) {
2613:                freeTexture(unbox(ctx), id);
2614:            }
2615:
2616:            native void texturemapping(long ctx, int px, int py, int xmin,
2617:                    int ymin, int xmax, int ymax, int texWidth, int texHeight,
2618:                    int rasWidth, int format, int objectId, byte[] image,
2619:                    int winWidth, int winHeight);
2620:
2621:            void texturemapping(Context ctx, int px, int py, int xmin,
2622:                    int ymin, int xmax, int ymax, int texWidth, int texHeight,
2623:                    int rasWidth, int format, int objectId, byte[] image,
2624:                    int winWidth, int winHeight) {
2625:                texturemapping(unbox(ctx), px, py, xmin, ymin, xmax, ymax,
2626:                        texWidth, texHeight, rasWidth, format, objectId, image,
2627:                        winWidth, winHeight);
2628:            }
2629:
2630:            native boolean initTexturemapping(long ctx, int texWidth,
2631:                    int texHeight, int objectId);
2632:
2633:            boolean initTexturemapping(Context ctx, int texWidth,
2634:                    int texHeight, int objectId) {
2635:                return initTexturemapping(unbox(ctx), texWidth, texHeight,
2636:                        objectId);
2637:            }
2638:
2639:            // Set internal render mode to one of FIELD_ALL, FIELD_LEFT or
2640:            // FIELD_RIGHT.  Note that it is up to the caller to ensure that
2641:            // stereo is available before setting the mode to FIELD_LEFT or
2642:            // FIELD_RIGHT.  The boolean isTRUE for double buffered mode, FALSE
2643:            // foe single buffering.
2644:            native void setRenderMode(long ctx, int mode, boolean doubleBuffer);
2645:
2646:            void setRenderMode(Context ctx, int mode, boolean doubleBuffer) {
2647:                setRenderMode(unbox(ctx), mode, doubleBuffer);
2648:            }
2649:
2650:            // Set glDepthMask.
2651:            native void setDepthBufferWriteEnable(long ctx, boolean mode);
2652:
2653:            void setDepthBufferWriteEnable(Context ctx, boolean mode) {
2654:                setDepthBufferWriteEnable(unbox(ctx), mode);
2655:            }
2656:
2657:            // ---------------------------------------------------------------------
2658:
2659:            //
2660:            // Canvas3D / GraphicsConfigTemplate3D methods - logic dealing with
2661:            // native graphics configuration or drawing surface
2662:            //
2663:
2664:            // Return a graphics config based on the one passed in. Note that we can
2665:            // assert that the input config is non-null and was created from a
2666:            // GraphicsConfigTemplate3D.
2667:            // This method must return a valid GraphicsConfig, or else it must throw
2668:            // an exception if one cannot be returned.
2669:            GraphicsConfiguration getGraphicsConfig(
2670:                    GraphicsConfiguration gconfig) {
2671:                //KCR:        System.err.println("NativePipeline.getGraphicsConfig()");
2672:
2673:                // Just return the input graphics config
2674:                return gconfig;
2675:            }
2676:
2677:            // Get the native FBconfig pointer
2678:            long getFbConfig(GraphicsConfigInfo gcInfo) {
2679:                long fbConfig = ((Long) gcInfo.getPrivateData()).longValue();
2680:                if (fbConfig == 0L) {
2681:                    throw new IllegalArgumentException(J3dI18N
2682:                            .getString("Canvas3D23"));
2683:                }
2684:
2685:                return fbConfig;
2686:            }
2687:
2688:            // Get best graphics config from pipeline
2689:            GraphicsConfiguration getBestConfiguration(
2690:                    GraphicsConfigTemplate3D gct, GraphicsConfiguration[] gc) {
2691:                return NativeConfigTemplate3D.getNativeConfigTemplate3D()
2692:                        .getBestConfiguration(gct, gc);
2693:            }
2694:
2695:            // Determine whether specified graphics config is supported by pipeline
2696:            boolean isGraphicsConfigSupported(GraphicsConfigTemplate3D gct,
2697:                    GraphicsConfiguration gc) {
2698:                return NativeConfigTemplate3D.getNativeConfigTemplate3D()
2699:                        .isGraphicsConfigSupported(gct, gc);
2700:            }
2701:
2702:            // Methods to get actual capabilities from Canvas3D
2703:            boolean hasDoubleBuffer(Canvas3D cv) {
2704:                return NativeConfigTemplate3D.getNativeConfigTemplate3D()
2705:                        .hasDoubleBuffer(cv);
2706:            }
2707:
2708:            boolean hasStereo(Canvas3D cv) {
2709:                return NativeConfigTemplate3D.getNativeConfigTemplate3D()
2710:                        .hasStereo(cv);
2711:            }
2712:
2713:            int getStencilSize(Canvas3D cv) {
2714:                return NativeConfigTemplate3D.getNativeConfigTemplate3D()
2715:                        .getStencilSize(cv);
2716:            }
2717:
2718:            boolean hasSceneAntialiasingMultisample(Canvas3D cv) {
2719:                return NativeConfigTemplate3D.getNativeConfigTemplate3D()
2720:                        .hasSceneAntialiasingMultisample(cv);
2721:            }
2722:
2723:            boolean hasSceneAntialiasingAccum(Canvas3D cv) {
2724:                return NativeConfigTemplate3D.getNativeConfigTemplate3D()
2725:                        .hasSceneAntialiasingAccum(cv);
2726:            }
2727:
2728:            // Methods to get native WS display and screen
2729:            long getDisplay() {
2730:                return NativeScreenInfo.getNativeScreenInfo().getDisplay();
2731:            }
2732:
2733:            int getScreen(GraphicsDevice graphicsDevice) {
2734:                return NativeScreenInfo.getNativeScreenInfo().getScreen(
2735:                        graphicsDevice);
2736:            }
2737:
2738:            // ---------------------------------------------------------------------
2739:
2740:            //
2741:            // DrawingSurfaceObject methods
2742:            //
2743:
2744:            // Method to construct a new DrawingSurfaceObject
2745:            DrawingSurfaceObject createDrawingSurfaceObject(Canvas3D cv) {
2746:                return new DrawingSurfaceObjectAWT(cv, VirtualUniverse.mc.awt,
2747:                        cv.screen.display, cv.screen.screen,
2748:                        VirtualUniverse.mc.xineramaDisabled);
2749:            }
2750:
2751:            // Method to free the drawing surface object
2752:            // (called from Canvas3D.removeNotify)
2753:            void freeDrawingSurface(Canvas3D cv,
2754:                    DrawingSurfaceObject drawingSurfaceObject) {
2755:                synchronized (drawingSurfaceObject) {
2756:                    DrawingSurfaceObjectAWT dso = (DrawingSurfaceObjectAWT) drawingSurfaceObject;
2757:                    // get nativeDS before it is set to 0 in invalidate()
2758:                    long ds = dso.getDS();
2759:                    long ds_struct[] = { ds, dso.getDSI() };
2760:                    if (ds != 0) {
2761:                        VirtualUniverse.mc.postRequest(
2762:                                MasterControl.FREE_DRAWING_SURFACE, ds_struct);
2763:                    }
2764:
2765:                    drawingSurfaceObject.invalidate();
2766:                }
2767:            }
2768:
2769:            // Method to free the native drawing surface object
2770:            void freeDrawingSurfaceNative(Object o) {
2771:                DrawingSurfaceObjectAWT.freeDrawingSurface(o);
2772:            }
2773:
2774:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.