0001: /*
0002: * $RCSfile: Pipeline.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.11 $
0028: * $Date: 2008/02/28 20:17:28 $
0029: * $State: Exp $
0030: */
0031:
0032: package javax.media.j3d;
0033:
0034: import java.awt.GraphicsConfiguration;
0035: import java.awt.GraphicsDevice;
0036:
0037: /**
0038: * Abstract pipeline class for rendering pipeline methods. All rendering
0039: * pipeline methods are defined here.
0040: */
0041: abstract class Pipeline {
0042: // Supported rendering pipelines
0043: enum Type {
0044: // Native rendering pipelines using OGL or D3D library
0045: NATIVE_OGL, NATIVE_D3D,
0046:
0047: // Java rendering pipeline using Java Bindings for OpenGL
0048: JOGL,
0049:
0050: // No-op rendering pipeline
0051: NOOP,
0052: }
0053:
0054: private static final String CLASSNAME_NATIVE = "javax.media.j3d.NativePipeline";
0055: private static final String CLASSNAME_JOGL = "javax.media.j3d.JoglPipeline";
0056: private static final String CLASSNAME_NOOP = "javax.media.j3d.NoopPipeline";
0057:
0058: // Singleton pipeline instance
0059: private static Pipeline pipeline;
0060:
0061: // Type of rendering pipeline (as defined above)
0062: private Type pipelineType = null;
0063:
0064: /**
0065: * An instance of a specific Pipeline subclass should only be constructed
0066: * // from the createPipeline method.
0067: */
0068: protected Pipeline() {
0069: }
0070:
0071: /**
0072: * Method to check whether the native OpenGL library can and should be used
0073: * on Windows. We will use D3D if OpenGL is unavailable or undesirable.
0074: */
0075: static boolean useNativeOgl(boolean isWindowsVista,
0076: boolean nativeOglRequested) {
0077:
0078: // Get the OpenGL vendor string.
0079: String vendorString;
0080: try {
0081: vendorString = NativePipeline.getSupportedOglVendor();
0082: } catch (Exception ex) {
0083: MasterControl.getCoreLogger().severe(ex.toString());
0084: return false;
0085: } catch (Error ex) {
0086: MasterControl.getCoreLogger().severe(ex.toString());
0087: return false;
0088: }
0089:
0090: // A null vendor string means OpenGL 1.2+ support unavailable.
0091: if (vendorString == null) {
0092: return false;
0093: }
0094:
0095: // If OGL was explicitly requested, we will use it
0096: if (nativeOglRequested) {
0097: return true;
0098: }
0099:
0100: // Check OS type and vendor string to see whether OGL is preferred
0101: return preferOgl(isWindowsVista, vendorString);
0102: }
0103:
0104: // Returns a flag inticating whether the specified vendor prefers OpenGL.
0105: private static boolean preferOgl(boolean isWindowsVista,
0106: String vendorString) {
0107: // We prefer OpenGL on all Windows/XP cards
0108: if (!isWindowsVista) {
0109: return true;
0110: }
0111:
0112: // List of vendors for which we will prefer to use D3D on Windows Vista
0113: // This must be all lower case.
0114: final String[] vistaD3dList = { "microsoft", "ati",
0115: // TODO: add the following if Intel's OpenGL driver turns out to be buggy on Vista
0116: // "intel",
0117: };
0118: final String lcVendorString = vendorString.toLowerCase();
0119:
0120: // If we are running on Windows Vista, we will check the vendor string
0121: // against the list of vendors that prefer D3D on Vista, and return true
0122: // *unless* the vendor is in that list.
0123: for (int i = 0; i < vistaD3dList.length; i++) {
0124: if (lcVendorString.startsWith(vistaD3dList[i])) {
0125: return false;
0126: }
0127: }
0128:
0129: return true;
0130: }
0131:
0132: /**
0133: * Initialize the Pipeline. Called exactly once by
0134: * MasterControl.loadLibraries() to create the singleton
0135: * Pipeline object.
0136: */
0137: static void createPipeline(Type pipelineType) {
0138: String className = null;
0139: switch (pipelineType) {
0140: case NATIVE_OGL:
0141: case NATIVE_D3D:
0142: className = CLASSNAME_NATIVE;
0143: break;
0144: case JOGL:
0145: className = CLASSNAME_JOGL;
0146: break;
0147: case NOOP:
0148: className = CLASSNAME_NOOP;
0149: break;
0150: default:
0151: // Should not get here
0152: throw new AssertionError("missing case statement");
0153: }
0154:
0155: final String pipelineClassName = className;
0156: pipeline = (Pipeline) java.security.AccessController
0157: .doPrivileged(new java.security.PrivilegedAction() {
0158: public Object run() {
0159: try {
0160: Class pipelineClass = Class
0161: .forName(pipelineClassName);
0162: return pipelineClass.newInstance();
0163: } catch (Exception e) {
0164: throw new RuntimeException(e);
0165: }
0166: }
0167: });
0168:
0169: pipeline.initialize(pipelineType);
0170: }
0171:
0172: /**
0173: * Returns the singleton Pipeline object.
0174: */
0175: static Pipeline getPipeline() {
0176: return pipeline;
0177: }
0178:
0179: /**
0180: * Initializes the pipeline object. Only called by initPipeline.
0181: * Pipeline subclasses may override this, but must call
0182: * super.initialize(pipelineType);
0183: */
0184: void initialize(Type pipelineType) {
0185: setPipelineType(pipelineType);
0186: }
0187:
0188: /**
0189: * Sets the pipeline type. Only called by initialize.
0190: */
0191: private void setPipelineType(Type pipelineType) {
0192: this .pipelineType = pipelineType;
0193: }
0194:
0195: /**
0196: * Returns the pipeline type
0197: */
0198: Type getPipelineType() {
0199: return pipelineType;
0200: }
0201:
0202: /**
0203: * Returns the pipeline name
0204: */
0205: String getPipelineName() {
0206: switch (pipelineType) {
0207: case NATIVE_OGL:
0208: return "NATIVE_OGL";
0209: case NATIVE_D3D:
0210: return "NATIVE_D3D";
0211: case JOGL:
0212: return "JOGL";
0213: case NOOP:
0214: return "NOOP";
0215: default:
0216: // Should not get here
0217: throw new AssertionError("missing case statement");
0218: }
0219: }
0220:
0221: /**
0222: * Returns the renderer name
0223: */
0224: String getRendererName() {
0225: switch (pipelineType) {
0226: case NATIVE_OGL:
0227: case JOGL:
0228: return "OpenGL";
0229: case NATIVE_D3D:
0230: return "DirectX";
0231: case NOOP:
0232: return "None";
0233: default:
0234: // Should not get here
0235: throw new AssertionError("missing case statement");
0236: }
0237: }
0238:
0239: // ---------------------------------------------------------------------
0240:
0241: //
0242: // Methods to initialize and load required libraries (from MasterControl)
0243: //
0244:
0245: /**
0246: * Load all of the required libraries
0247: */
0248: abstract void loadLibraries(int globalShadingLanguage);
0249:
0250: /**
0251: * Returns true if the Cg library is loaded and available. Note that this
0252: * does not necessarily mean that Cg is supported by the graphics card.
0253: */
0254: abstract boolean isCgLibraryAvailable();
0255:
0256: /**
0257: * Returns true if the GLSL library is loaded and available. Note that this
0258: * does not necessarily mean that GLSL is supported by the graphics card.
0259: */
0260: abstract boolean isGLSLLibraryAvailable();
0261:
0262: // ---------------------------------------------------------------------
0263:
0264: //
0265: // GeometryArrayRetained methods
0266: //
0267:
0268: // Used by D3D to free vertex buffer
0269: abstract void freeD3DArray(GeometryArrayRetained geo,
0270: boolean deleteVB);
0271:
0272: // used for GeometryArrays by Copy or interleaved
0273: abstract void execute(Context ctx, GeometryArrayRetained geo,
0274: int geo_type, boolean isNonUniformScale, boolean useAlpha,
0275: boolean ignoreVertexColors, int startVIndex, int vcount,
0276: int vformat, int texCoordSetCount, int[] texCoordSetMap,
0277: int texCoordSetMapLen, int[] texCoordSetOffset,
0278: int numActiveTexUnitState, int vertexAttrCount,
0279: int[] vertexAttrSizes, float[] varray, float[] cdata,
0280: int cdirty);
0281:
0282: // used by GeometryArray by Reference with java arrays
0283: abstract void executeVA(Context ctx, GeometryArrayRetained geo,
0284: int geo_type, boolean isNonUniformScale,
0285: boolean ignoreVertexColors, int vcount, int vformat,
0286: int vdefined, int coordIndex, float[] vfcoords,
0287: double[] vdcoords, int colorIndex, float[] cfdata,
0288: byte[] cbdata, int normalIndex, float[] ndata,
0289: int vertexAttrCount, int[] vertexAttrSizes,
0290: int[] vertexAttrIndex, float[][] vertexAttrData,
0291: int texcoordmaplength, int[] texcoordoffset,
0292: int numActiveTexUnitState, int[] texIndex, int texstride,
0293: Object[] texCoords, int cdirty);
0294:
0295: // used by GeometryArray by Reference with NIO buffer
0296: abstract void executeVABuffer(Context ctx,
0297: GeometryArrayRetained geo, int geo_type,
0298: boolean isNonUniformScale, boolean ignoreVertexColors,
0299: int vcount, int vformat, int vdefined, int coordIndex,
0300: Object vcoords, int colorIndex, Object cdataBuffer,
0301: float[] cfdata, byte[] cbdata, int normalIndex,
0302: Object ndata, int vertexAttrCount, int[] vertexAttrSizes,
0303: int[] vertexAttrIndex, Object[] vertexAttrData,
0304: int texcoordmaplength, int[] texcoordoffset,
0305: int numActiveTexUnitState, int[] texIndex, int texstride,
0306: Object[] texCoords, int cdirty);
0307:
0308: // used by GeometryArray by Reference in interleaved format with NIO buffer
0309: abstract void executeInterleavedBuffer(Context ctx,
0310: GeometryArrayRetained geo, int geo_type,
0311: boolean isNonUniformScale, boolean useAlpha,
0312: boolean ignoreVertexColors, int startVIndex, int vcount,
0313: int vformat, int texCoordSetCount, int[] texCoordSetMap,
0314: int texCoordSetMapLen, int[] texCoordSetOffset,
0315: int numActiveTexUnitState, Object varray, float[] cdata,
0316: int cdirty);
0317:
0318: abstract void setVertexFormat(Context ctx,
0319: GeometryArrayRetained geo, int vformat, boolean useAlpha,
0320: boolean ignoreVertexColors);
0321:
0322: abstract void disableGlobalAlpha(Context ctx,
0323: GeometryArrayRetained geo, int vformat, boolean useAlpha,
0324: boolean ignoreVertexColors);
0325:
0326: // used for GeometryArrays
0327: abstract void buildGA(Context ctx, GeometryArrayRetained geo,
0328: int geo_type, boolean isNonUniformScale,
0329: boolean updateAlpha, float alpha,
0330: boolean ignoreVertexColors, int startVIndex, int vcount,
0331: int vformat, int texCoordSetCount, int[] texCoordSetMap,
0332: int texCoordSetMapLen, int[] texCoordSetMapOffset,
0333: int vertexAttrCount, int[] vertexAttrSizes, double[] xform,
0334: double[] nxform, float[] varray);
0335:
0336: // used to Build Dlist GeometryArray by Reference with java arrays
0337: abstract void buildGAForByRef(Context ctx,
0338: GeometryArrayRetained geo, int geo_type,
0339: boolean isNonUniformScale, boolean updateAlpha,
0340: float alpha, boolean ignoreVertexColors, int vcount,
0341: int vformat, int vdefined, int coordIndex,
0342: float[] vfcoords, double[] vdcoords, int colorIndex,
0343: float[] cfdata, byte[] cbdata, int normalIndex,
0344: float[] ndata, int vertexAttrCount, int[] vertexAttrSizes,
0345: int[] vertexAttrIndex, float[][] vertexAttrData,
0346: int texcoordmaplength, int[] texcoordoffset,
0347: int[] texIndex, int texstride, Object[] texCoords,
0348: double[] xform, double[] nxform);
0349:
0350: // used to Build Dlist GeometryArray by Reference with NIO buffer
0351: // NOTE: NIO buffers are no longer supported in display lists. We
0352: // have no plans to add this support.
0353: /*
0354: abstract void buildGAForBuffer(Context ctx,
0355: GeometryArrayRetained geo, int geo_type,
0356: boolean isNonUniformScale, boolean updateAlpha,
0357: float alpha,
0358: boolean ignoreVertexColors,
0359: int vcount,
0360: int vformat,
0361: int vdefined,
0362: int coordIndex, Object vcoords,
0363: int colorIndex, Object cdata,
0364: int normalIndex, Object ndata,
0365: int texcoordmaplength,
0366: int[] texcoordoffset,
0367: int[] texIndex, int texstride, Object[] texCoords,
0368: double[] xform, double[] nxform);
0369: */
0370:
0371: // ---------------------------------------------------------------------
0372: //
0373: // IndexedGeometryArrayRetained methods
0374: //
0375: // by-copy or interleaved, by reference, Java arrays
0376: abstract void executeIndexedGeometry(Context ctx,
0377: GeometryArrayRetained geo, int geo_type,
0378: boolean isNonUniformScale, boolean useAlpha,
0379: boolean ignoreVertexColors, int initialIndexIndex,
0380: int indexCount, int vertexCount, int vformat,
0381: int vertexAttrCount, int[] vertexAttrSizes,
0382: int texCoordSetCount, int[] texCoordSetMap,
0383: int texCoordSetMapLen, int[] texCoordSetOffset,
0384: int numActiveTexUnitState, float[] varray, float[] cdata,
0385: int cdirty, int[] indexCoord);
0386:
0387: // interleaved, by reference, nio buffer
0388: abstract void executeIndexedGeometryBuffer(Context ctx,
0389: GeometryArrayRetained geo, int geo_type,
0390: boolean isNonUniformScale, boolean useAlpha,
0391: boolean ignoreVertexColors, int initialIndexIndex,
0392: int indexCount, int vertexCount, int vformat,
0393: int texCoordSetCount, int[] texCoordSetMap,
0394: int texCoordSetMapLen, int[] texCoordSetOffset,
0395: int numActiveTexUnitState, Object varray, float[] cdata,
0396: int cdirty, int[] indexCoord);
0397:
0398: // non interleaved, by reference, Java arrays
0399: abstract void executeIndexedGeometryVA(Context ctx,
0400: GeometryArrayRetained geo, int geo_type,
0401: boolean isNonUniformScale, boolean ignoreVertexColors,
0402: int initialIndexIndex, int validIndexCount,
0403: int vertexCount, int vformat, int vdefined,
0404: float[] vfcoords, double[] vdcoords, float[] cfdata,
0405: byte[] cbdata, float[] ndata, int vertexAttrCount,
0406: int[] vertexAttrSizes, float[][] vertexAttrData,
0407: int texcoordmaplength, int[] texcoordoffset,
0408: int numActiveTexUnitState, int texstride,
0409: Object[] texCoords, int cdirty, int[] indexCoord);
0410:
0411: // non interleaved, by reference, nio buffer
0412: abstract void executeIndexedGeometryVABuffer(Context ctx,
0413: GeometryArrayRetained geo, int geo_type,
0414: boolean isNonUniformScale, boolean ignoreVertexColors,
0415: int initialIndexIndex, int validIndexCount,
0416: int vertexCount, int vformat, int vdefined, Object vcoords,
0417: Object cdataBuffer, float[] cfdata, byte[] cbdata,
0418: Object normal, int vertexAttrCount, int[] vertexAttrSizes,
0419: Object[] vertexAttrData, int texcoordmaplength,
0420: int[] texcoordoffset, int numActiveTexUnitState,
0421: int texstride, Object[] texCoords, int cdirty,
0422: int[] indexCoord);
0423:
0424: // by-copy geometry
0425: abstract void buildIndexedGeometry(Context ctx,
0426: GeometryArrayRetained geo, int geo_type,
0427: boolean isNonUniformScale, boolean updateAlpha,
0428: float alpha, boolean ignoreVertexColors,
0429: int initialIndexIndex, int validIndexCount,
0430: int vertexCount, int vformat, int vertexAttrCount,
0431: int[] vertexAttrSizes, int texCoordSetCount,
0432: int[] texCoordSetMap, int texCoordSetMapLen,
0433: int[] texCoordSetMapOffset, double[] xform,
0434: double[] nxform, float[] varray, int[] indexCoord);
0435:
0436: // ---------------------------------------------------------------------
0437:
0438: //
0439: // GraphicsContext3D methods
0440: //
0441:
0442: // Native method for readRaster
0443: abstract void readRaster(Context ctx, int type, int xSrcOffset,
0444: int ySrcOffset, int width, int height, int hCanvas,
0445: int imageDataType, int imageFormat, Object imageBuffer,
0446: int depthFormat, Object depthBuffer);
0447:
0448: // ---------------------------------------------------------------------
0449:
0450: //
0451: // CgShaderProgramRetained methods
0452: //
0453:
0454: // ShaderAttributeValue methods
0455:
0456: abstract ShaderError setCgUniform1i(Context ctx,
0457: ShaderProgramId shaderProgramId,
0458: ShaderAttrLoc uniformLocation, int value);
0459:
0460: abstract ShaderError setCgUniform1f(Context ctx,
0461: ShaderProgramId shaderProgramId,
0462: ShaderAttrLoc uniformLocation, float value);
0463:
0464: abstract ShaderError setCgUniform2i(Context ctx,
0465: ShaderProgramId shaderProgramId,
0466: ShaderAttrLoc uniformLocation, int[] value);
0467:
0468: abstract ShaderError setCgUniform2f(Context ctx,
0469: ShaderProgramId shaderProgramId,
0470: ShaderAttrLoc uniformLocation, float[] value);
0471:
0472: abstract ShaderError setCgUniform3i(Context ctx,
0473: ShaderProgramId shaderProgramId,
0474: ShaderAttrLoc uniformLocation, int[] value);
0475:
0476: abstract ShaderError setCgUniform3f(Context ctx,
0477: ShaderProgramId shaderProgramId,
0478: ShaderAttrLoc uniformLocation, float[] value);
0479:
0480: abstract ShaderError setCgUniform4i(Context ctx,
0481: ShaderProgramId shaderProgramId,
0482: ShaderAttrLoc uniformLocation, int[] value);
0483:
0484: abstract ShaderError setCgUniform4f(Context ctx,
0485: ShaderProgramId shaderProgramId,
0486: ShaderAttrLoc uniformLocation, float[] value);
0487:
0488: abstract ShaderError setCgUniformMatrix3f(Context ctx,
0489: ShaderProgramId shaderProgramId,
0490: ShaderAttrLoc uniformLocation, float[] value);
0491:
0492: abstract ShaderError setCgUniformMatrix4f(Context ctx,
0493: ShaderProgramId shaderProgramId,
0494: ShaderAttrLoc uniformLocation, float[] value);
0495:
0496: // ShaderAttributeArray methods
0497:
0498: abstract ShaderError setCgUniform1iArray(Context ctx,
0499: ShaderProgramId shaderProgramId,
0500: ShaderAttrLoc uniformLocation, int numElements, int[] value);
0501:
0502: abstract ShaderError setCgUniform1fArray(Context ctx,
0503: ShaderProgramId shaderProgramId,
0504: ShaderAttrLoc uniformLocation, int numElements,
0505: float[] value);
0506:
0507: abstract ShaderError setCgUniform2iArray(Context ctx,
0508: ShaderProgramId shaderProgramId,
0509: ShaderAttrLoc uniformLocation, int numElements, int[] value);
0510:
0511: abstract ShaderError setCgUniform2fArray(Context ctx,
0512: ShaderProgramId shaderProgramId,
0513: ShaderAttrLoc uniformLocation, int numElements,
0514: float[] value);
0515:
0516: abstract ShaderError setCgUniform3iArray(Context ctx,
0517: ShaderProgramId shaderProgramId,
0518: ShaderAttrLoc uniformLocation, int numElements, int[] value);
0519:
0520: abstract ShaderError setCgUniform3fArray(Context ctx,
0521: ShaderProgramId shaderProgramId,
0522: ShaderAttrLoc uniformLocation, int numElements,
0523: float[] value);
0524:
0525: abstract ShaderError setCgUniform4iArray(Context ctx,
0526: ShaderProgramId shaderProgramId,
0527: ShaderAttrLoc uniformLocation, int numElements, int[] value);
0528:
0529: abstract ShaderError setCgUniform4fArray(Context ctx,
0530: ShaderProgramId shaderProgramId,
0531: ShaderAttrLoc uniformLocation, int numElements,
0532: float[] value);
0533:
0534: abstract ShaderError setCgUniformMatrix3fArray(Context ctx,
0535: ShaderProgramId shaderProgramId,
0536: ShaderAttrLoc uniformLocation, int numElements,
0537: float[] value);
0538:
0539: abstract ShaderError setCgUniformMatrix4fArray(Context ctx,
0540: ShaderProgramId shaderProgramId,
0541: ShaderAttrLoc uniformLocation, int numElements,
0542: float[] value);
0543:
0544: // abstract interfaces for shader compilation, etc.
0545: abstract ShaderError createCgShader(Context ctx, int shaderType,
0546: ShaderId[] shaderId);
0547:
0548: abstract ShaderError destroyCgShader(Context ctx, ShaderId shaderId);
0549:
0550: abstract ShaderError compileCgShader(Context ctx,
0551: ShaderId shaderId, String program);
0552:
0553: abstract ShaderError createCgShaderProgram(Context ctx,
0554: ShaderProgramId[] shaderProgramId);
0555:
0556: abstract ShaderError destroyCgShaderProgram(Context ctx,
0557: ShaderProgramId shaderProgramId);
0558:
0559: abstract ShaderError linkCgShaderProgram(Context ctx,
0560: ShaderProgramId shaderProgramId, ShaderId[] shaderIds);
0561:
0562: abstract void lookupCgVertexAttrNames(Context ctx,
0563: ShaderProgramId shaderProgramId, int numAttrNames,
0564: String[] attrNames, boolean[] errArr);
0565:
0566: abstract void lookupCgShaderAttrNames(Context ctx,
0567: ShaderProgramId shaderProgramId, int numAttrNames,
0568: String[] attrNames, ShaderAttrLoc[] locArr, int[] typeArr,
0569: int[] sizeArr, boolean[] isArrayArr);
0570:
0571: abstract ShaderError useCgShaderProgram(Context ctx,
0572: ShaderProgramId shaderProgramId);
0573:
0574: // ---------------------------------------------------------------------
0575:
0576: //
0577: // GLSLShaderProgramRetained methods
0578: //
0579:
0580: // ShaderAttributeValue methods
0581:
0582: abstract ShaderError setGLSLUniform1i(Context ctx,
0583: ShaderProgramId shaderProgramId,
0584: ShaderAttrLoc uniformLocation, int value);
0585:
0586: abstract ShaderError setGLSLUniform1f(Context ctx,
0587: ShaderProgramId shaderProgramId,
0588: ShaderAttrLoc uniformLocation, float value);
0589:
0590: abstract ShaderError setGLSLUniform2i(Context ctx,
0591: ShaderProgramId shaderProgramId,
0592: ShaderAttrLoc uniformLocation, int[] value);
0593:
0594: abstract ShaderError setGLSLUniform2f(Context ctx,
0595: ShaderProgramId shaderProgramId,
0596: ShaderAttrLoc uniformLocation, float[] value);
0597:
0598: abstract ShaderError setGLSLUniform3i(Context ctx,
0599: ShaderProgramId shaderProgramId,
0600: ShaderAttrLoc uniformLocation, int[] value);
0601:
0602: abstract ShaderError setGLSLUniform3f(Context ctx,
0603: ShaderProgramId shaderProgramId,
0604: ShaderAttrLoc uniformLocation, float[] value);
0605:
0606: abstract ShaderError setGLSLUniform4i(Context ctx,
0607: ShaderProgramId shaderProgramId,
0608: ShaderAttrLoc uniformLocation, int[] value);
0609:
0610: abstract ShaderError setGLSLUniform4f(Context ctx,
0611: ShaderProgramId shaderProgramId,
0612: ShaderAttrLoc uniformLocation, float[] value);
0613:
0614: abstract ShaderError setGLSLUniformMatrix3f(Context ctx,
0615: ShaderProgramId shaderProgramId,
0616: ShaderAttrLoc uniformLocation, float[] value);
0617:
0618: abstract ShaderError setGLSLUniformMatrix4f(Context ctx,
0619: ShaderProgramId shaderProgramId,
0620: ShaderAttrLoc uniformLocation, float[] value);
0621:
0622: // ShaderAttributeArray methods
0623:
0624: abstract ShaderError setGLSLUniform1iArray(Context ctx,
0625: ShaderProgramId shaderProgramId,
0626: ShaderAttrLoc uniformLocation, int numElements, int[] value);
0627:
0628: abstract ShaderError setGLSLUniform1fArray(Context ctx,
0629: ShaderProgramId shaderProgramId,
0630: ShaderAttrLoc uniformLocation, int numElements,
0631: float[] value);
0632:
0633: abstract ShaderError setGLSLUniform2iArray(Context ctx,
0634: ShaderProgramId shaderProgramId,
0635: ShaderAttrLoc uniformLocation, int numElements, int[] value);
0636:
0637: abstract ShaderError setGLSLUniform2fArray(Context ctx,
0638: ShaderProgramId shaderProgramId,
0639: ShaderAttrLoc uniformLocation, int numElements,
0640: float[] value);
0641:
0642: abstract ShaderError setGLSLUniform3iArray(Context ctx,
0643: ShaderProgramId shaderProgramId,
0644: ShaderAttrLoc uniformLocation, int numElements, int[] value);
0645:
0646: abstract ShaderError setGLSLUniform3fArray(Context ctx,
0647: ShaderProgramId shaderProgramId,
0648: ShaderAttrLoc uniformLocation, int numElements,
0649: float[] value);
0650:
0651: abstract ShaderError setGLSLUniform4iArray(Context ctx,
0652: ShaderProgramId shaderProgramId,
0653: ShaderAttrLoc uniformLocation, int numElements, int[] value);
0654:
0655: abstract ShaderError setGLSLUniform4fArray(Context ctx,
0656: ShaderProgramId shaderProgramId,
0657: ShaderAttrLoc uniformLocation, int numElements,
0658: float[] value);
0659:
0660: abstract ShaderError setGLSLUniformMatrix3fArray(Context ctx,
0661: ShaderProgramId shaderProgramId,
0662: ShaderAttrLoc uniformLocation, int numElements,
0663: float[] value);
0664:
0665: abstract ShaderError setGLSLUniformMatrix4fArray(Context ctx,
0666: ShaderProgramId shaderProgramId,
0667: ShaderAttrLoc uniformLocation, int numElements,
0668: float[] value);
0669:
0670: // abstract interfaces for shader compilation, etc.
0671: abstract ShaderError createGLSLShader(Context ctx, int shaderType,
0672: ShaderId[] shaderId);
0673:
0674: abstract ShaderError destroyGLSLShader(Context ctx,
0675: ShaderId shaderId);
0676:
0677: abstract ShaderError compileGLSLShader(Context ctx,
0678: ShaderId shaderId, String program);
0679:
0680: abstract ShaderError createGLSLShaderProgram(Context ctx,
0681: ShaderProgramId[] shaderProgramId);
0682:
0683: abstract ShaderError destroyGLSLShaderProgram(Context ctx,
0684: ShaderProgramId shaderProgramId);
0685:
0686: abstract ShaderError linkGLSLShaderProgram(Context ctx,
0687: ShaderProgramId shaderProgramId, ShaderId[] shaderIds);
0688:
0689: abstract ShaderError bindGLSLVertexAttrName(Context ctx,
0690: ShaderProgramId shaderProgramId, String attrName,
0691: int attrIndex);
0692:
0693: abstract void lookupGLSLShaderAttrNames(Context ctx,
0694: ShaderProgramId shaderProgramId, int numAttrNames,
0695: String[] attrNames, ShaderAttrLoc[] locArr, int[] typeArr,
0696: int[] sizeArr, boolean[] isArrayArr);
0697:
0698: abstract ShaderError useGLSLShaderProgram(Context ctx,
0699: ShaderProgramId shaderProgramId);
0700:
0701: // ---------------------------------------------------------------------
0702:
0703: //
0704: // J3DBuffer methods
0705: //
0706:
0707: // Method to verify that we can access a direct NIO buffer
0708: // from native code
0709: boolean checkNativeBufferAccess(java.nio.Buffer buffer) {
0710: // Return true by default. Pipeline can override and implement, if
0711: // we decide that it is necessary.
0712: return true;
0713: }
0714:
0715: // ---------------------------------------------------------------------
0716:
0717: //
0718: // Renderer methods
0719: //
0720:
0721: abstract void cleanupRenderer();
0722:
0723: // ---------------------------------------------------------------------
0724:
0725: //
0726: // ColoringAttributesRetained methods
0727: //
0728:
0729: abstract void updateColoringAttributes(Context ctx, float dRed,
0730: float dGreen, float dBlue, float red, float green,
0731: float blue, float alpha, boolean lEnable, int shadeModel);
0732:
0733: // ---------------------------------------------------------------------
0734:
0735: //
0736: // DirectionalLightRetained methods
0737: //
0738:
0739: abstract void updateDirectionalLight(Context ctx, int lightSlot,
0740: float red, float green, float blue, float x, float y,
0741: float z);
0742:
0743: // ---------------------------------------------------------------------
0744:
0745: //
0746: // PointLightRetained methods
0747: //
0748:
0749: abstract void updatePointLight(Context ctx, int lightSlot,
0750: float red, float green, float blue, float ax, float ay,
0751: float az, float px, float py, float pz);
0752:
0753: // ---------------------------------------------------------------------
0754:
0755: //
0756: // SpotLightRetained methods
0757: //
0758:
0759: abstract void updateSpotLight(Context ctx, int lightSlot,
0760: float red, float green, float blue, float ax, float ay,
0761: float az, float px, float py, float pz, float spreadAngle,
0762: float concentration, float dx, float dy, float dz);
0763:
0764: // ---------------------------------------------------------------------
0765:
0766: //
0767: // ExponentialFogRetained methods
0768: //
0769:
0770: abstract void updateExponentialFog(Context ctx, float red,
0771: float green, float blue, float density);
0772:
0773: // ---------------------------------------------------------------------
0774:
0775: //
0776: // LinearFogRetained methods
0777: //
0778:
0779: abstract void updateLinearFog(Context ctx, float red, float green,
0780: float blue, double fdist, double bdist);
0781:
0782: // ---------------------------------------------------------------------
0783:
0784: //
0785: // LineAttributesRetained methods
0786: //
0787:
0788: abstract void updateLineAttributes(Context ctx, float lineWidth,
0789: int linePattern, int linePatternMask,
0790: int linePatternScaleFactor, boolean lineAntialiasing);
0791:
0792: // ---------------------------------------------------------------------
0793:
0794: //
0795: // MaterialRetained methods
0796: //
0797:
0798: abstract void updateMaterial(Context ctx, float red, float green,
0799: float blue, float alpha, float ared, float agreen,
0800: float ablue, float ered, float egreen, float eblue,
0801: float dred, float dgreen, float dblue, float sred,
0802: float sgreen, float sblue, float shininess,
0803: int colorTarget, boolean enable);
0804:
0805: // ---------------------------------------------------------------------
0806:
0807: //
0808: // ModelClipRetained methods
0809: //
0810:
0811: abstract void updateModelClip(Context ctx, int planeNum,
0812: boolean enableFlag, double A, double B, double C, double D);
0813:
0814: // ---------------------------------------------------------------------
0815:
0816: //
0817: // PointAttributesRetained methods
0818: //
0819:
0820: abstract void updatePointAttributes(Context ctx, float pointSize,
0821: boolean pointAntialiasing);
0822:
0823: // ---------------------------------------------------------------------
0824:
0825: //
0826: // PolygonAttributesRetained methods
0827: //
0828:
0829: abstract void updatePolygonAttributes(Context ctx, int polygonMode,
0830: int cullFace, boolean backFaceNormalFlip,
0831: float polygonOffset, float polygonOffsetFactor);
0832:
0833: // ---------------------------------------------------------------------
0834:
0835: //
0836: // RenderingAttributesRetained methods
0837: //
0838:
0839: abstract void updateRenderingAttributes(Context ctx,
0840: boolean depthBufferWriteEnableOverride,
0841: boolean depthBufferEnableOverride,
0842: boolean depthBufferEnable, boolean depthBufferWriteEnable,
0843: int depthTestFunction, float alphaTestValue,
0844: int alphaTestFunction, boolean ignoreVertexColors,
0845: boolean rasterOpEnable, int rasterOp,
0846: boolean userStencilAvailable, boolean stencilEnable,
0847: int stencilFailOp, int stencilZFailOp, int stencilZPassOp,
0848: int stencilFunction, int stencilReferenceValue,
0849: int stencilCompareMask, int stencilWriteMask);
0850:
0851: // ---------------------------------------------------------------------
0852:
0853: //
0854: // TexCoordGenerationRetained methods
0855: //
0856:
0857: /**
0858: * This method updates the native context:
0859: * trans contains eyeTovworld transform in d3d
0860: * trans contains vworldToEye transform in ogl
0861: */
0862: abstract void updateTexCoordGeneration(Context ctx, boolean enable,
0863: int genMode, int format, float planeSx, float planeSy,
0864: float planeSz, float planeSw, float planeTx, float planeTy,
0865: float planeTz, float planeTw, float planeRx, float planeRy,
0866: float planeRz, float planeRw, float planeQx, float planeQy,
0867: float planeQz, float planeQw, double[] trans);
0868:
0869: // ---------------------------------------------------------------------
0870:
0871: //
0872: // TransparencyAttributesRetained methods
0873: //
0874:
0875: abstract void updateTransparencyAttributes(Context ctx,
0876: float alpha, int geometryType, int polygonMode,
0877: boolean lineAA, boolean pointAA, int transparencyMode,
0878: int srcBlendFunction, int dstBlendFunction);
0879:
0880: // ---------------------------------------------------------------------
0881:
0882: //
0883: // TextureAttributesRetained methods
0884: //
0885:
0886: abstract void updateTextureAttributes(Context ctx,
0887: double[] transform, boolean isIdentity, int textureMode,
0888: int perspCorrectionMode, float red, float green,
0889: float blue, float alpha, int textureFormat);
0890:
0891: abstract void updateRegisterCombiners(Context ctx,
0892: double[] transform, boolean isIdentity, int textureMode,
0893: int perspCorrectionMode, float red, float green,
0894: float blue, float alpha, int textureFormat,
0895: int combineRgbMode, int combineAlphaMode,
0896: int[] combineRgbSrc, int[] combineAlphaSrc,
0897: int[] combineRgbFcn, int[] combineAlphaFcn,
0898: int combineRgbScale, int combineAlphaScale);
0899:
0900: abstract void updateTextureColorTable(Context ctx,
0901: int numComponents, int colorTableSize, int[] colorTable);
0902:
0903: abstract void updateCombiner(Context ctx, int combineRgbMode,
0904: int combineAlphaMode, int[] combineRgbSrc,
0905: int[] combineAlphaSrc, int[] combineRgbFcn,
0906: int[] combineAlphaFcn, int combineRgbScale,
0907: int combineAlphaScale);
0908:
0909: // ---------------------------------------------------------------------
0910:
0911: //
0912: // TextureUnitStateRetained methods
0913: //
0914:
0915: abstract void updateTextureUnitState(Context ctx, int unitIndex,
0916: boolean enableFlag);
0917:
0918: // ---------------------------------------------------------------------
0919:
0920: //
0921: // TextureRetained methods
0922: // Texture2DRetained methods
0923: //
0924:
0925: abstract void bindTexture2D(Context ctx, int objectId,
0926: boolean enable);
0927:
0928: abstract void updateTexture2DImage(Context ctx, int numLevels,
0929: int level, int textureFormat, int imageFormat, int width,
0930: int height, int boundaryWidth, int imageDataType,
0931: Object data, boolean useAutoMipMap);
0932:
0933: abstract void updateTexture2DSubImage(Context ctx, int level,
0934: int xoffset, int yoffset, int textureFormat,
0935: int imageFormat, int imgXOffset, int imgYOffset, int tilew,
0936: int width, int height, int imageDataType, Object data,
0937: boolean useAutoMipMap);
0938:
0939: abstract void updateTexture2DLodRange(Context ctx, int baseLevel,
0940: int maximumLevel, float minimumLod, float maximumLod);
0941:
0942: abstract void updateTexture2DLodOffset(Context ctx,
0943: float lodOffsetX, float lodOffsetY, float lodOffsetZ);
0944:
0945: abstract void updateTexture2DBoundary(Context ctx,
0946: int boundaryModeS, int boundaryModeT, float boundaryRed,
0947: float boundaryGreen, float boundaryBlue, float boundaryAlpha);
0948:
0949: abstract void updateTexture2DFilterModes(Context ctx,
0950: int minFilter, int magFilter);
0951:
0952: abstract void updateTexture2DSharpenFunc(Context ctx,
0953: int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts);
0954:
0955: abstract void updateTexture2DFilter4Func(Context ctx,
0956: int numFilter4FuncPts, float[] filter4FuncPts);
0957:
0958: abstract void updateTexture2DAnisotropicFilter(Context ctx,
0959: float degree);
0960:
0961: // ---------------------------------------------------------------------
0962:
0963: //
0964: // Texture3DRetained methods
0965: //
0966:
0967: abstract void bindTexture3D(Context ctx, int objectId,
0968: boolean enable);
0969:
0970: abstract void updateTexture3DImage(Context ctx, int numLevels,
0971: int level, int textureFormat, int imageFormat, int width,
0972: int height, int depth, int boundaryWidth,
0973: int imageDataType, Object imageData, boolean useAutoMipMap);
0974:
0975: abstract void updateTexture3DSubImage(Context ctx, int level,
0976: int xoffset, int yoffset, int zoffset, int textureFormat,
0977: int imageFormat, int imgXoffset, int imgYoffset,
0978: int imgZoffset, int tilew, int tileh, int width,
0979: int height, int depth, int imageDataType, Object imageData,
0980: boolean useAutoMipMap);
0981:
0982: abstract void updateTexture3DLodRange(Context ctx, int baseLevel,
0983: int maximumLevel, float minimumLod, float maximumLod);
0984:
0985: abstract void updateTexture3DLodOffset(Context ctx,
0986: float lodOffsetX, float lodOffsetY, float lodOffsetZ);
0987:
0988: abstract void updateTexture3DBoundary(Context ctx,
0989: int boundaryModeS, int boundaryModeT, int boundaryModeR,
0990: float boundaryRed, float boundaryGreen, float boundaryBlue,
0991: float boundaryAlpha);
0992:
0993: abstract void updateTexture3DFilterModes(Context ctx,
0994: int minFilter, int magFilter);
0995:
0996: abstract void updateTexture3DSharpenFunc(Context ctx,
0997: int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts);
0998:
0999: abstract void updateTexture3DFilter4Func(Context ctx,
1000: int numFilter4FuncPts, float[] filter4FuncPts);
1001:
1002: abstract void updateTexture3DAnisotropicFilter(Context ctx,
1003: float degree);
1004:
1005: // ---------------------------------------------------------------------
1006:
1007: //
1008: // TextureCubeMapRetained methods
1009: //
1010:
1011: abstract void bindTextureCubeMap(Context ctx, int objectId,
1012: boolean enable);
1013:
1014: abstract void updateTextureCubeMapImage(Context ctx, int face,
1015: int numLevels, int level, int textureFormat,
1016: int imageFormat, int width, int height, int boundaryWidth,
1017: int imageDataType, Object imageData, boolean useAutoMipMap);
1018:
1019: abstract void updateTextureCubeMapSubImage(Context ctx, int face,
1020: int level, int xoffset, int yoffset, int textureFormat,
1021: int imageFormat, int imgXOffset, int imgYOffset, int tilew,
1022: int width, int height, int imageDataType, Object imageData,
1023: boolean useAutoMipMap);
1024:
1025: abstract void updateTextureCubeMapLodRange(Context ctx,
1026: int baseLevel, int maximumLevel, float minimumLod,
1027: float maximumLod);
1028:
1029: abstract void updateTextureCubeMapLodOffset(Context ctx,
1030: float lodOffsetX, float lodOffsetY, float lodOffsetZ);
1031:
1032: abstract void updateTextureCubeMapBoundary(Context ctx,
1033: int boundaryModeS, int boundaryModeT, float boundaryRed,
1034: float boundaryGreen, float boundaryBlue, float boundaryAlpha);
1035:
1036: abstract void updateTextureCubeMapFilterModes(Context ctx,
1037: int minFilter, int magFilter);
1038:
1039: abstract void updateTextureCubeMapSharpenFunc(Context ctx,
1040: int numSharpenTextureFuncPts, float[] sharpenTextureFuncPts);
1041:
1042: abstract void updateTextureCubeMapFilter4Func(Context ctx,
1043: int numFilter4FuncPts, float[] filter4FuncPts);
1044:
1045: abstract void updateTextureCubeMapAnisotropicFilter(Context ctx,
1046: float degree);
1047:
1048: // ---------------------------------------------------------------------
1049:
1050: //
1051: // MasterControl methods
1052: //
1053:
1054: // Method to return the AWT object
1055: abstract long getAWT();
1056:
1057: // Method to initialize the native J3D library
1058: abstract boolean initializeJ3D(boolean disableXinerama);
1059:
1060: // Maximum lights supported by the native API
1061: abstract int getMaximumLights();
1062:
1063: // ---------------------------------------------------------------------
1064:
1065: //
1066: // Canvas3D methods - native wrappers
1067: //
1068:
1069: // This is the native method for creating the underlying graphics context.
1070: abstract Context createNewContext(Canvas3D cv, long display,
1071: Drawable drawable, long fbConfig, Context shareCtx,
1072: boolean isSharedCtx, boolean offScreen,
1073: boolean glslLibraryAvailable, boolean cgLibraryAvailable);
1074:
1075: abstract void createQueryContext(Canvas3D cv, long display,
1076: Drawable drawable, long fbConfig, boolean offScreen,
1077: int width, int height, boolean glslLibraryAvailable,
1078: boolean cgLibraryAvailable);
1079:
1080: // This is the native for creating offscreen buffer
1081: abstract Drawable createOffScreenBuffer(Canvas3D cv, Context ctx,
1082: long display, long fbConfig, int width, int height);
1083:
1084: abstract void destroyOffScreenBuffer(Canvas3D cv, Context ctx,
1085: long display, long fbConfig, Drawable drawable);
1086:
1087: // This is the native for reading the image from the offscreen buffer
1088: abstract void readOffScreenBuffer(Canvas3D cv, Context ctx,
1089: int format, int type, Object data, int width, int height);
1090:
1091: // The native method for swapBuffers
1092: abstract int swapBuffers(Canvas3D cv, Context ctx, long dpy,
1093: Drawable drawable);
1094:
1095: // notify D3D that Canvas is resize
1096: abstract int resizeD3DCanvas(Canvas3D cv, Context ctx);
1097:
1098: // notify D3D to toggle between FullScreen and window mode
1099: abstract int toggleFullScreenMode(Canvas3D cv, Context ctx);
1100:
1101: // native method for setting Material when no material is present
1102: abstract void updateMaterialColor(Context ctx, float r, float g,
1103: float b, float a);
1104:
1105: abstract void destroyContext(long display, Drawable drawable,
1106: Context ctx);
1107:
1108: // This is the native method for doing accumulation.
1109: abstract void accum(Context ctx, float value);
1110:
1111: // This is the native method for doing accumulation return.
1112: abstract void accumReturn(Context ctx);
1113:
1114: // This is the native method for clearing the accumulation buffer.
1115: abstract void clearAccum(Context ctx);
1116:
1117: // This is the native method for getting the number of lights the underlying
1118: // native library can support.
1119: abstract int getNumCtxLights(Context ctx);
1120:
1121: // Native method for decal 1st child setup
1122: abstract boolean decal1stChildSetup(Context ctx);
1123:
1124: // Native method for decal nth child setup
1125: abstract void decalNthChildSetup(Context ctx);
1126:
1127: // Native method for decal reset
1128: abstract void decalReset(Context ctx, boolean depthBufferEnable);
1129:
1130: // Native method for decal reset
1131: abstract void ctxUpdateEyeLightingEnable(Context ctx,
1132: boolean localEyeLightingEnable);
1133:
1134: // The following three methods are used in multi-pass case
1135:
1136: // native method for setting blend color
1137: abstract void setBlendColor(Context ctx, float red, float green,
1138: float blue, float alpha);
1139:
1140: // native method for setting blend func
1141: abstract void setBlendFunc(Context ctx, int src, int dst);
1142:
1143: // native method for setting fog enable flag
1144: abstract void setFogEnableFlag(Context ctx, boolean enableFlag);
1145:
1146: // Setup the full scene antialising in D3D and ogl when GL_ARB_multisamle supported
1147: abstract void setFullSceneAntialiasing(Context ctx, boolean enable);
1148:
1149: abstract void setGlobalAlpha(Context ctx, float alpha);
1150:
1151: // Native method to update separate specular color control
1152: abstract void updateSeparateSpecularColorEnable(Context ctx,
1153: boolean control);
1154:
1155: // Initialization for D3D when scene begin
1156: abstract void beginScene(Context ctx);
1157:
1158: abstract void endScene(Context ctx);
1159:
1160: // True under Solaris,
1161: // False under windows when display mode <= 8 bit
1162: abstract boolean validGraphicsMode();
1163:
1164: // native method for setting light enables
1165: abstract void setLightEnables(Context ctx, long enableMask,
1166: int maxLights);
1167:
1168: // native method for setting scene ambient
1169: abstract void setSceneAmbient(Context ctx, float red, float green,
1170: float blue);
1171:
1172: // native method for disabling fog
1173: abstract void disableFog(Context ctx);
1174:
1175: // native method for disabling modelClip
1176: abstract void disableModelClip(Context ctx);
1177:
1178: // native method for setting default RenderingAttributes
1179: abstract void resetRenderingAttributes(Context ctx,
1180: boolean depthBufferWriteEnableOverride,
1181: boolean depthBufferEnableOverride);
1182:
1183: // native method for setting default texture
1184: abstract void resetTextureNative(Context ctx, int texUnitIndex);
1185:
1186: // native method for activating a particular texture unit
1187: abstract void activeTextureUnit(Context ctx, int texUnitIndex);
1188:
1189: // native method for setting default TexCoordGeneration
1190: abstract void resetTexCoordGeneration(Context ctx);
1191:
1192: // native method for setting default TextureAttributes
1193: abstract void resetTextureAttributes(Context ctx);
1194:
1195: // native method for setting default PolygonAttributes
1196: abstract void resetPolygonAttributes(Context ctx);
1197:
1198: // native method for setting default LineAttributes
1199: abstract void resetLineAttributes(Context ctx);
1200:
1201: // native method for setting default PointAttributes
1202: abstract void resetPointAttributes(Context ctx);
1203:
1204: // native method for setting default TransparencyAttributes
1205: abstract void resetTransparency(Context ctx, int geometryType,
1206: int polygonMode, boolean lineAA, boolean pointAA);
1207:
1208: // native method for setting default ColoringAttributes
1209: abstract void resetColoringAttributes(Context ctx, float r,
1210: float g, float b, float a, boolean enableLight);
1211:
1212: /**
1213: * This native method makes sure that the rendering for this canvas
1214: * gets done now.
1215: */
1216: abstract void syncRender(Context ctx, boolean wait);
1217:
1218: // The native method that sets this ctx to be the current one
1219: abstract boolean useCtx(Context ctx, long display, Drawable drawable);
1220:
1221: // Optionally release the context. A pipeline may override this and
1222: // returns true if the context was released.
1223: boolean releaseCtx(Context ctx, long dpy) {
1224: return false;
1225: }
1226:
1227: abstract void clear(Context ctx, float r, float g, float b,
1228: boolean clearStencil);
1229:
1230: abstract void textureFillBackground(Context ctx, float texMinU,
1231: float texMaxU, float texMinV, float texMaxV, float mapMinX,
1232: float mapMaxX, float mapMinY, float mapMaxY,
1233: boolean useBiliearFilter);
1234:
1235: abstract void textureFillRaster(Context ctx, float texMinU,
1236: float texMaxU, float texMinV, float texMaxV, float mapMinX,
1237: float mapMaxX, float mapMinY, float mapMaxY, float mapZ,
1238: float alpha, boolean useBiliearFilter);
1239:
1240: abstract void executeRasterDepth(Context ctx, float posX,
1241: float posY, float posZ, int srcOffsetX, int srcOffsetY,
1242: int rasterWidth, int rasterHeight, int depthWidth,
1243: int depthHeight, int depthType, Object depthData);
1244:
1245: // The native method for setting the ModelView matrix.
1246: abstract void setModelViewMatrix(Context ctx, double[] viewMatrix,
1247: double[] modelMatrix);
1248:
1249: // The native method for setting the Projection matrix.
1250: abstract void setProjectionMatrix(Context ctx, double[] projMatrix);
1251:
1252: // The native method for setting the Viewport.
1253: abstract void setViewport(Context ctx, int x, int y, int width,
1254: int height);
1255:
1256: // used for display Lists
1257: abstract void newDisplayList(Context ctx, int displayListId);
1258:
1259: abstract void endDisplayList(Context ctx);
1260:
1261: abstract void callDisplayList(Context ctx, int id,
1262: boolean isNonUniformScale);
1263:
1264: abstract void freeDisplayList(Context ctx, int id);
1265:
1266: abstract void freeTexture(Context ctx, int id);
1267:
1268: abstract void texturemapping(Context ctx, int px, int py, int xmin,
1269: int ymin, int xmax, int ymax, int texWidth, int texHeight,
1270: int rasWidth, int format, int objectId, byte[] image,
1271: int winWidth, int winHeight);
1272:
1273: abstract boolean initTexturemapping(Context ctx, int texWidth,
1274: int texHeight, int objectId);
1275:
1276: // Set internal render mode to one of FIELD_ALL, FIELD_LEFT or
1277: // FIELD_RIGHT. Note that it is up to the caller to ensure that
1278: // stereo is available before setting the mode to FIELD_LEFT or
1279: // FIELD_RIGHT. The boolean isTRUE for double buffered mode, FALSE
1280: // foe single buffering.
1281: abstract void setRenderMode(Context ctx, int mode,
1282: boolean doubleBuffer);
1283:
1284: // Set glDepthMask.
1285: abstract void setDepthBufferWriteEnable(Context ctx, boolean mode);
1286:
1287: // ---------------------------------------------------------------------
1288:
1289: //
1290: // Canvas3D / GraphicsConfigTemplate3D methods - logic dealing with
1291: // native graphics configuration or drawing surface
1292: //
1293:
1294: // Return a graphics config based on the one passed in. Note that we can
1295: // assert that the input config is non-null and was created from a
1296: // GraphicsConfigTemplate3D.
1297: // This method must return a valid GraphicsConfig, or else it must throw
1298: // an exception if one cannot be returned.
1299: abstract GraphicsConfiguration getGraphicsConfig(
1300: GraphicsConfiguration gconfig);
1301:
1302: // Get the native FBconfig pointer
1303: abstract long getFbConfig(GraphicsConfigInfo gcInfo);
1304:
1305: // Get best graphics config from pipeline
1306: abstract GraphicsConfiguration getBestConfiguration(
1307: GraphicsConfigTemplate3D gct, GraphicsConfiguration[] gc);
1308:
1309: // Determine whether specified graphics config is supported by pipeline
1310: abstract boolean isGraphicsConfigSupported(
1311: GraphicsConfigTemplate3D gct, GraphicsConfiguration gc);
1312:
1313: // Methods to get actual capabilities from Canvas3D
1314: abstract boolean hasDoubleBuffer(Canvas3D cv);
1315:
1316: abstract boolean hasStereo(Canvas3D cv);
1317:
1318: abstract int getStencilSize(Canvas3D cv);
1319:
1320: abstract boolean hasSceneAntialiasingMultisample(Canvas3D cv);
1321:
1322: abstract boolean hasSceneAntialiasingAccum(Canvas3D cv);
1323:
1324: // Methods to get native WS display and screen
1325: abstract long getDisplay();
1326:
1327: abstract int getScreen(GraphicsDevice graphicsDevice);
1328:
1329: // ---------------------------------------------------------------------
1330:
1331: //
1332: // DrawingSurfaceObject methods
1333: //
1334:
1335: // Method to construct a new DrawingSurfaceObject
1336: abstract DrawingSurfaceObject createDrawingSurfaceObject(Canvas3D cv);
1337:
1338: // Method to free the drawing surface object
1339: abstract void freeDrawingSurface(Canvas3D cv,
1340: DrawingSurfaceObject drawingSurfaceObject);
1341:
1342: // Method to free the native drawing surface object
1343: abstract void freeDrawingSurfaceNative(Object o);
1344:
1345: }
|