1 /* !---- DO NOT EDIT: This file autogenerated by com/sun/gluegen/opengl/GLEmitter.java on Thu May 22 01:39:45 PDT 2008 ----! */
2 
3 package javax.media.opengl.glu;
4 
5 import javax.media.opengl.*;
6 import javax.media.opengl.glu.*;
7 import com.sun.opengl.impl.*;
8 import com.sun.opengl.impl.tessellator.GLUtessellatorImpl;
9 import com.sun.opengl.impl.error.Error;
10 import com.sun.opengl.impl.mipmap.Mipmap;
11 import com.sun.opengl.impl.registry.Registry;
12 import com.sun.opengl.impl.nurbs.*;
13 import com.sun.opengl.util.*;
14 import java.security.*;
15 import com.sun.gluegen.runtime.*;
16 
17  /**
18   * Provides access to the OpenGL Utility Library (GLU). This library
19   * provides standard methods for setting up view volumes, building
20   * mipmaps and performing other common operations.  The GLU NURBS
21   * routines are not currently exposed.
22   *
23   * <P>
24   *
25   * Notes from the Reference Implementation for this class:
26   * Thanks to the contributions of many individuals, this class is a
27   * pure Java port of SGI's original C sources. All of the projection,
28   * mipmap, scaling, and tessellation routines that are exposed are
29   * compatible with the GLU 1.3 specification. The GLU NURBS routines
30   * are not currently exposed.
31   */
32 public class GLU
33 {
34   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluBuild1DMipmapLevels}(GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *  data); </code>    */
gluBuild1DMipmapLevelsC(int target, int internalFormat, int width, int format, int type, int level, int base, int max, java.nio.Buffer data)35   private int gluBuild1DMipmapLevelsC(int target, int internalFormat, int width, int format, int type, int level, int base, int max, java.nio.Buffer data)
36   {
37     boolean _direct = BufferFactory.isDirect(data);
38     final long __addr_ = getGLUProcAddressTable()._addressof_gluBuild1DMipmapLevels;
39     if (__addr_ == 0) {
40       throw new GLException("Method \"gluBuild1DMipmapLevels\" not available");
41     }
42     if (_direct) {
43         return dispatch_gluBuild1DMipmapLevelsC0(target, internalFormat, width, format, type, level, base, max, data, BufferFactory.getDirectBufferByteOffset(data), __addr_);
44     } else {
45       return dispatch_gluBuild1DMipmapLevelsC1(target, internalFormat, width, format, type, level, base, max, BufferFactory.getArray(data), BufferFactory.getIndirectBufferByteOffset(data), __addr_);
46     }
47   }
48 
49   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluBuild1DMipmapLevels}(GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *  data); </code>    */
dispatch_gluBuild1DMipmapLevelsC0(int target, int internalFormat, int width, int format, int type, int level, int base, int max, Object data, int data_byte_offset, long procAddress)50   private native int dispatch_gluBuild1DMipmapLevelsC0(int target, int internalFormat, int width, int format, int type, int level, int base, int max, Object data, int data_byte_offset, long procAddress);
51 
52   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluBuild1DMipmapLevels}(GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *  data); </code>    */
dispatch_gluBuild1DMipmapLevelsC1(int target, int internalFormat, int width, int format, int type, int level, int base, int max, Object data, int data_byte_offset, long procAddress)53   private native int dispatch_gluBuild1DMipmapLevelsC1(int target, int internalFormat, int width, int format, int type, int level, int base, int max, Object data, int data_byte_offset, long procAddress);
54 
55   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluBuild1DMipmaps}(GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const void *  data); </code>    */
gluBuild1DMipmapsC(int target, int internalFormat, int width, int format, int type, java.nio.Buffer data)56   private int gluBuild1DMipmapsC(int target, int internalFormat, int width, int format, int type, java.nio.Buffer data)
57   {
58     boolean _direct = BufferFactory.isDirect(data);
59     final long __addr_ = getGLUProcAddressTable()._addressof_gluBuild1DMipmaps;
60     if (__addr_ == 0) {
61       throw new GLException("Method \"gluBuild1DMipmaps\" not available");
62     }
63     if (_direct) {
64         return dispatch_gluBuild1DMipmapsC0(target, internalFormat, width, format, type, data, BufferFactory.getDirectBufferByteOffset(data), __addr_);
65     } else {
66       return dispatch_gluBuild1DMipmapsC1(target, internalFormat, width, format, type, BufferFactory.getArray(data), BufferFactory.getIndirectBufferByteOffset(data), __addr_);
67     }
68   }
69 
70   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluBuild1DMipmaps}(GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const void *  data); </code>    */
dispatch_gluBuild1DMipmapsC0(int target, int internalFormat, int width, int format, int type, Object data, int data_byte_offset, long procAddress)71   private native int dispatch_gluBuild1DMipmapsC0(int target, int internalFormat, int width, int format, int type, Object data, int data_byte_offset, long procAddress);
72 
73   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluBuild1DMipmaps}(GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const void *  data); </code>    */
dispatch_gluBuild1DMipmapsC1(int target, int internalFormat, int width, int format, int type, Object data, int data_byte_offset, long procAddress)74   private native int dispatch_gluBuild1DMipmapsC1(int target, int internalFormat, int width, int format, int type, Object data, int data_byte_offset, long procAddress);
75 
76   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluBuild2DMipmapLevels}(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *  data); </code>    */
gluBuild2DMipmapLevelsC(int target, int internalFormat, int width, int height, int format, int type, int level, int base, int max, java.nio.Buffer data)77   private int gluBuild2DMipmapLevelsC(int target, int internalFormat, int width, int height, int format, int type, int level, int base, int max, java.nio.Buffer data)
78   {
79     boolean _direct = BufferFactory.isDirect(data);
80     final long __addr_ = getGLUProcAddressTable()._addressof_gluBuild2DMipmapLevels;
81     if (__addr_ == 0) {
82       throw new GLException("Method \"gluBuild2DMipmapLevels\" not available");
83     }
84     if (_direct) {
85         return dispatch_gluBuild2DMipmapLevelsC0(target, internalFormat, width, height, format, type, level, base, max, data, BufferFactory.getDirectBufferByteOffset(data), __addr_);
86     } else {
87       return dispatch_gluBuild2DMipmapLevelsC1(target, internalFormat, width, height, format, type, level, base, max, BufferFactory.getArray(data), BufferFactory.getIndirectBufferByteOffset(data), __addr_);
88     }
89   }
90 
91   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluBuild2DMipmapLevels}(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *  data); </code>    */
dispatch_gluBuild2DMipmapLevelsC0(int target, int internalFormat, int width, int height, int format, int type, int level, int base, int max, Object data, int data_byte_offset, long procAddress)92   private native int dispatch_gluBuild2DMipmapLevelsC0(int target, int internalFormat, int width, int height, int format, int type, int level, int base, int max, Object data, int data_byte_offset, long procAddress);
93 
94   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluBuild2DMipmapLevels}(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *  data); </code>    */
dispatch_gluBuild2DMipmapLevelsC1(int target, int internalFormat, int width, int height, int format, int type, int level, int base, int max, Object data, int data_byte_offset, long procAddress)95   private native int dispatch_gluBuild2DMipmapLevelsC1(int target, int internalFormat, int width, int height, int format, int type, int level, int base, int max, Object data, int data_byte_offset, long procAddress);
96 
97   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluBuild2DMipmaps}(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *  data); </code>    */
gluBuild2DMipmapsC(int target, int internalFormat, int width, int height, int format, int type, java.nio.Buffer data)98   private int gluBuild2DMipmapsC(int target, int internalFormat, int width, int height, int format, int type, java.nio.Buffer data)
99   {
100     boolean _direct = BufferFactory.isDirect(data);
101     final long __addr_ = getGLUProcAddressTable()._addressof_gluBuild2DMipmaps;
102     if (__addr_ == 0) {
103       throw new GLException("Method \"gluBuild2DMipmaps\" not available");
104     }
105     if (_direct) {
106         return dispatch_gluBuild2DMipmapsC0(target, internalFormat, width, height, format, type, data, BufferFactory.getDirectBufferByteOffset(data), __addr_);
107     } else {
108       return dispatch_gluBuild2DMipmapsC1(target, internalFormat, width, height, format, type, BufferFactory.getArray(data), BufferFactory.getIndirectBufferByteOffset(data), __addr_);
109     }
110   }
111 
112   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluBuild2DMipmaps}(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *  data); </code>    */
dispatch_gluBuild2DMipmapsC0(int target, int internalFormat, int width, int height, int format, int type, Object data, int data_byte_offset, long procAddress)113   private native int dispatch_gluBuild2DMipmapsC0(int target, int internalFormat, int width, int height, int format, int type, Object data, int data_byte_offset, long procAddress);
114 
115   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluBuild2DMipmaps}(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *  data); </code>    */
dispatch_gluBuild2DMipmapsC1(int target, int internalFormat, int width, int height, int format, int type, Object data, int data_byte_offset, long procAddress)116   private native int dispatch_gluBuild2DMipmapsC1(int target, int internalFormat, int width, int height, int format, int type, Object data, int data_byte_offset, long procAddress);
117 
118   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluBuild3DMipmapLevels}(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *  data); </code>    */
gluBuild3DMipmapLevelsC(int target, int internalFormat, int width, int height, int depth, int format, int type, int level, int base, int max, java.nio.Buffer data)119   private int gluBuild3DMipmapLevelsC(int target, int internalFormat, int width, int height, int depth, int format, int type, int level, int base, int max, java.nio.Buffer data)
120   {
121     boolean _direct = BufferFactory.isDirect(data);
122     final long __addr_ = getGLUProcAddressTable()._addressof_gluBuild3DMipmapLevels;
123     if (__addr_ == 0) {
124       throw new GLException("Method \"gluBuild3DMipmapLevels\" not available");
125     }
126     if (_direct) {
127         return dispatch_gluBuild3DMipmapLevelsC0(target, internalFormat, width, height, depth, format, type, level, base, max, data, BufferFactory.getDirectBufferByteOffset(data), __addr_);
128     } else {
129       return dispatch_gluBuild3DMipmapLevelsC1(target, internalFormat, width, height, depth, format, type, level, base, max, BufferFactory.getArray(data), BufferFactory.getIndirectBufferByteOffset(data), __addr_);
130     }
131   }
132 
133   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluBuild3DMipmapLevels}(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *  data); </code>    */
dispatch_gluBuild3DMipmapLevelsC0(int target, int internalFormat, int width, int height, int depth, int format, int type, int level, int base, int max, Object data, int data_byte_offset, long procAddress)134   private native int dispatch_gluBuild3DMipmapLevelsC0(int target, int internalFormat, int width, int height, int depth, int format, int type, int level, int base, int max, Object data, int data_byte_offset, long procAddress);
135 
136   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluBuild3DMipmapLevels}(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *  data); </code>    */
dispatch_gluBuild3DMipmapLevelsC1(int target, int internalFormat, int width, int height, int depth, int format, int type, int level, int base, int max, Object data, int data_byte_offset, long procAddress)137   private native int dispatch_gluBuild3DMipmapLevelsC1(int target, int internalFormat, int width, int height, int depth, int format, int type, int level, int base, int max, Object data, int data_byte_offset, long procAddress);
138 
139   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluBuild3DMipmaps}(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *  data); </code>    */
gluBuild3DMipmapsC(int target, int internalFormat, int width, int height, int depth, int format, int type, java.nio.Buffer data)140   private int gluBuild3DMipmapsC(int target, int internalFormat, int width, int height, int depth, int format, int type, java.nio.Buffer data)
141   {
142     boolean _direct = BufferFactory.isDirect(data);
143     final long __addr_ = getGLUProcAddressTable()._addressof_gluBuild3DMipmaps;
144     if (__addr_ == 0) {
145       throw new GLException("Method \"gluBuild3DMipmaps\" not available");
146     }
147     if (_direct) {
148         return dispatch_gluBuild3DMipmapsC0(target, internalFormat, width, height, depth, format, type, data, BufferFactory.getDirectBufferByteOffset(data), __addr_);
149     } else {
150       return dispatch_gluBuild3DMipmapsC1(target, internalFormat, width, height, depth, format, type, BufferFactory.getArray(data), BufferFactory.getIndirectBufferByteOffset(data), __addr_);
151     }
152   }
153 
154   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluBuild3DMipmaps}(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *  data); </code>    */
dispatch_gluBuild3DMipmapsC0(int target, int internalFormat, int width, int height, int depth, int format, int type, Object data, int data_byte_offset, long procAddress)155   private native int dispatch_gluBuild3DMipmapsC0(int target, int internalFormat, int width, int height, int depth, int format, int type, Object data, int data_byte_offset, long procAddress);
156 
157   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluBuild3DMipmaps}(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *  data); </code>    */
dispatch_gluBuild3DMipmapsC1(int target, int internalFormat, int width, int height, int depth, int format, int type, Object data, int data_byte_offset, long procAddress)158   private native int dispatch_gluBuild3DMipmapsC1(int target, int internalFormat, int width, int height, int depth, int format, int type, Object data, int data_byte_offset, long procAddress);
159 
160   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluScaleImage}(GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *  dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid *  dataOut); </code>    */
gluScaleImageC(int format, int wIn, int hIn, int typeIn, java.nio.Buffer dataIn, int wOut, int hOut, int typeOut, java.nio.Buffer dataOut)161   private int gluScaleImageC(int format, int wIn, int hIn, int typeIn, java.nio.Buffer dataIn, int wOut, int hOut, int typeOut, java.nio.Buffer dataOut)
162   {
163     boolean _direct = BufferFactory.isDirect(dataIn);
164     if (dataOut != null && _direct != BufferFactory.isDirect(dataOut))
165       throw new GLException("Argument \"dataOut\" : Buffers passed to this method must all be either direct or indirect");
166     final long __addr_ = getGLUProcAddressTable()._addressof_gluScaleImage;
167     if (__addr_ == 0) {
168       throw new GLException("Method \"gluScaleImage\" not available");
169     }
170     if (_direct) {
171         return dispatch_gluScaleImageC0(format, wIn, hIn, typeIn, dataIn, BufferFactory.getDirectBufferByteOffset(dataIn), wOut, hOut, typeOut, dataOut, BufferFactory.getDirectBufferByteOffset(dataOut), __addr_);
172     } else {
173       return dispatch_gluScaleImageC1(format, wIn, hIn, typeIn, BufferFactory.getArray(dataIn), BufferFactory.getIndirectBufferByteOffset(dataIn), wOut, hOut, typeOut, BufferFactory.getArray(dataOut), BufferFactory.getIndirectBufferByteOffset(dataOut), __addr_);
174     }
175   }
176 
177   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluScaleImage}(GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *  dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid *  dataOut); </code>    */
dispatch_gluScaleImageC0(int format, int wIn, int hIn, int typeIn, Object dataIn, int dataIn_byte_offset, int wOut, int hOut, int typeOut, Object dataOut, int dataOut_byte_offset, long procAddress)178   private native int dispatch_gluScaleImageC0(int format, int wIn, int hIn, int typeIn, Object dataIn, int dataIn_byte_offset, int wOut, int hOut, int typeOut, Object dataOut, int dataOut_byte_offset, long procAddress);
179 
180   /** Entry point (through function pointer) to C language function: <br> <code> GLint {@native gluScaleImage}(GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *  dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid *  dataOut); </code>    */
dispatch_gluScaleImageC1(int format, int wIn, int hIn, int typeIn, Object dataIn, int dataIn_byte_offset, int wOut, int hOut, int typeOut, Object dataOut, int dataOut_byte_offset, long procAddress)181   private native int dispatch_gluScaleImageC1(int format, int wIn, int hIn, int typeIn, Object dataIn, int dataIn_byte_offset, int wOut, int hOut, int typeOut, Object dataOut, int dataOut_byte_offset, long procAddress);
182 
183 
184   // --- Begin CustomJavaCode .cfg declarations
185   private static boolean useJavaMipmapCode = true;
186 
187   static {
AccessController.doPrivileged(new PrivilegedAction() { public Object run() { String val = System.getProperty(R); if (val != null && !val.toLowerCase().equals(R)) { useJavaMipmapCode = false; } return null; } })188     AccessController.doPrivileged(new PrivilegedAction() {
189         public Object run() {
190           String val = System.getProperty("jogl.glu.nojava");
191           if (val != null && !val.toLowerCase().equals("false")) {
192             useJavaMipmapCode = false;
193           }
194           return null;
195         }
196       });
197   }
198 
199   /**
200    * Instantiates a new OpenGL Utility Library object. A GLU object may
201    * be instantiated at any point in the application and is not
202    * inherently tied to any particular OpenGL context; however, the GLU
203    * object may only be used when an OpenGL context is current on the
204    * current thread. Attempts to call most of the methods in the GLU
205    * library when no OpenGL context is current will cause an exception
206    * to be thrown.
207    *
208    * <P>
209    *
210    * The returned GLU object is not guaranteed to be thread-safe and
211    * should only be used from one thread at a time. Multiple GLU objects
212    * may be instantiated to be used from different threads
213    * simultaneously.
214    */
215 
GLU()216   public GLU()
217   {
218     this.project = new Project();
219   }
220 
221   //----------------------------------------------------------------------
222   // Utility routines
223   //
224 
225   /**
226    * Returns the GL object associated with the OpenGL context current on
227    * the current thread. Throws GLException if no OpenGL context is
228    * current.
229    */
230 
getCurrentGL()231   public static GL getCurrentGL() throws GLException {
232     GLContext curContext = GLContext.getCurrent();
233     if (curContext == null) {
234       throw new GLException("No OpenGL context current on this thread");
235     }
236     return curContext.getGL();
237   }
238 
gluErrorString(int errorCode)239   public String gluErrorString(int errorCode) {
240     return Error.gluErrorString(errorCode);
241   }
242 
243   /* extName is an extension name.
244    * extString is a string of extensions separated by blank(s). There may or
245    * may not be leading or trailing blank(s) in extString.
246    * This works in cases of extensions being prefixes of another like
247    * GL_EXT_texture and GL_EXT_texture3D.
248    * Returns true if extName is found otherwise it returns false.
249    */
gluCheckExtension(java.lang.String extName, java.lang.String extString)250   public boolean gluCheckExtension(java.lang.String extName, java.lang.String extString) {
251     return Registry.gluCheckExtension(extName, extString);
252   }
253 
gluGetString(int name)254   public String gluGetString(int name) {
255     return Registry.gluGetString(name);
256   }
257 
258   /**
259    * Returns true if the specified GLU core- or extension-function can be
260    * successfully used through this GLU instance. By "successfully" we mean
261    * that the function is both <i>callable</i> on the machine running the
262    * program and <i>available</i> on the current display.<P>
263    *
264    * A GLU function is <i>callable</i> if it is a GLU core- or extension-function
265    * that is supported by the underlying GLU implementation. The function is
266    * <i>available</i> if the OpenGL implementation on the display meets the
267    * requirements of the GLU function being called (because GLU functions utilize
268    * OpenGL functions). <P>
269    *
270    * Whether or not a GLU function is <i>callable</i> is determined as follows:
271    * <ul>
272    *   <li>If the function is a GLU core function (i.e., not an
273    *   extension), <code>gluGetString(GLU_VERSION)</code> is used to determine the
274    *   version number of the underlying GLU implementation on the host.
275    *   then the function name is cross-referenced with that specification to
276    *   see if it is part of that version's specification.
277    *
278    *   <li> If the function is a GLU extension, the function name is
279    *   cross-referenced with the list returned by
280    *   <code>gluGetString(GLU_EXTENSIONS)</code> to see if the function is one of
281    *   the extensions that is supported by the underlying GLU implementation.
282    * </ul>
283    *
284    * Whether or not a GLU function is <i>available</i> is determined as follows:
285    * <ul>
286    *   <li>If the function is a GLU core function then the function is first
287    *   cross-referenced with the GLU specifications to find the minimum GLU
288    *   version required to <i>call</i> that GLU function. Then the following table
289    *   is consulted to determine the minimum GL version required for that version
290    *   of GLU:
291    *   <ul>
292    *   <li> GLU 1.0 requires OpenGL 1.0
293    *   <li> GLU 1.1 requires OpenGL 1.0
294    *   <li> GLU 1.2 requires OpenGL 1.1
295    *   <li> GLU 1.3 requires OpenGL 1.2
296    *   </ul>
297    *   Finally, <code>glGetString(GL_VERSION)</code> is used to determine the
298    *   highest OpenGL version that both host and display support, and from that it
299    *   is possible to determine if the GL facilities required by the GLU function
300    *   are <i>available</i> on the display.
301    *
302    *   <li> If the function is a GLU extension, the function name is
303    *   cross-referenced with the list returned by
304    *   <code>gluGetString(GLU_EXTENSIONS)</code> to see if the function is one of
305    *   the extensions that is supported by the underlying GLU implementation.
306    * </ul>
307    *
308    * <b>NOTE:</b>The availability of a function may change at runtime in
309    * response to changes in the display environment. For example, when a window
310    * is dragged from one display to another on a multi-display system, or when
311    * the properties of the display device are modified (e.g., changing the color
312    * depth of the display). Any application that is concerned with handling
313    * these situations correctly should confirm availability after a display
314    * change before calling a questionable OpenGL function. To detect a change in
315    * the display device, please see {@link
316    * GLEventListener#displayChanged(GLAutoDrawable,boolean,boolean)}.
317    *
318    * @param gluFunctionName the name of the OpenGL function (e.g., use
319    * "gluNurbsCallbackDataEXT" to check if the <code>
320    * gluNurbsCallbackDataEXT(GLUnurbs, GLvoid)</code> extension is available).
321    */
isFunctionAvailable(String gluFunctionName)322   public boolean isFunctionAvailable(String gluFunctionName)
323   {
324     if (useJavaMipmapCode) {
325       // All GLU functions are available in Java port
326       return true;
327     }
328     return (gluProcAddressTable.getAddressFor(gluFunctionName) != 0);
329   }
330 
331   //----------------------------------------------------------------------
332   // Tessellation routines
333   //
334 
335   /*****************************************************************************
336    * <b>gluNewTess</b> creates and returns a new tessellation object.  This
337    * object must be referred to when calling tesselation methods.  A return
338    * value of null means that there was not enough memeory to allocate the
339    * object.
340    *
341    * @return A new tessellation object.
342    *
343    * @see #gluTessBeginPolygon gluTessBeginPolygon
344    * @see #gluDeleteTess       gluDeleteTess
345    * @see #gluTessCallback     gluTessCallback
346    ****************************************************************************/
gluNewTess()347   public GLUtessellator gluNewTess() {
348       return GLUtessellatorImpl.gluNewTess();
349   }
350 
351   /*****************************************************************************
352    * <b>gluDeleteTess</b> destroys the indicated tessellation object (which was
353    * created with {@link #gluNewTess gluNewTess}).
354    *
355    * @param tessellator
356    *        Specifies the tessellation object to destroy.
357    *
358    * @see #gluBeginPolygon gluBeginPolygon
359    * @see #gluNewTess      gluNewTess
360    * @see #gluTessCallback gluTessCallback
361    ****************************************************************************/
gluDeleteTess(GLUtessellator tessellator)362   public void gluDeleteTess(GLUtessellator tessellator) {
363       GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
364       tess.gluDeleteTess();
365   }
366 
367   /*****************************************************************************
368    * <b>gluTessProperty</b> is used to control properites stored in a
369    * tessellation object.  These properties affect the way that the polygons are
370    * interpreted and rendered.  The legal value for <i>which</i> are as
371    * follows:<P>
372    *
373    * <b>GLU_TESS_WINDING_RULE</b>
374    * <UL>
375    *   Determines which parts of the polygon are on the "interior".
376    *   <em>value</em> may be set to one of
377    *   <BR><b>GLU_TESS_WINDING_ODD</b>,
378    *   <BR><b>GLU_TESS_WINDING_NONZERO</b>,
379    *   <BR><b>GLU_TESS_WINDING_POSITIVE</b>, or
380    *   <BR><b>GLU_TESS_WINDING_NEGATIVE</b>, or
381    *   <BR><b>GLU_TESS_WINDING_ABS_GEQ_TWO</b>.<P>
382    *
383    *   To understand how the winding rule works, consider that the input
384    *   contours partition the plane into regions.  The winding rule determines
385    *   which of these regions are inside the polygon.<P>
386    *
387    *   For a single contour C, the winding number of a point x is simply the
388    *   signed number of revolutions we make around x as we travel once around C
389    *   (where CCW is positive).  When there are several contours, the individual
390    *   winding numbers are summed.  This procedure associates a signed integer
391    *   value with each point x in the plane.  Note that the winding number is
392    *   the same for all points in a single region.<P>
393    *
394    *   The winding rule classifies a region as "inside" if its winding number
395    *   belongs to the chosen category (odd, nonzero, positive, negative, or
396    *   absolute value of at least two).  The previous GLU tessellator (prior to
397    *   GLU 1.2) used the "odd" rule.  The "nonzero" rule is another common way
398    *   to define the interior.  The other three rules are useful for polygon CSG
399    *   operations.
400    * </UL>
401    * <BR><b>GLU_TESS_BOUNDARY_ONLY</b>
402    * <UL>
403    *   Is a boolean value ("value" should be set to GL_TRUE or GL_FALSE). When
404    *   set to GL_TRUE, a set of closed contours separating the polygon interior
405    *   and exterior are returned instead of a tessellation.  Exterior contours
406    *   are oriented CCW with respect to the normal; interior contours are
407    *   oriented CW. The <b>GLU_TESS_BEGIN</b> and <b>GLU_TESS_BEGIN_DATA</b>
408    *   callbacks use the type GL_LINE_LOOP for each contour.
409    * </UL>
410    * <BR><b>GLU_TESS_TOLERANCE</b>
411    * <UL>
412    *   Specifies a tolerance for merging features to reduce the size of the
413    *   output. For example, two vertices that are very close to each other
414    *   might be replaced by a single vertex.  The tolerance is multiplied by the
415    *   largest coordinate magnitude of any input vertex; this specifies the
416    *   maximum distance that any feature can move as the result of a single
417    *   merge operation.  If a single feature takes part in several merge
418    *   operations, the toal distance moved could be larger.<P>
419    *
420    *   Feature merging is completely optional; the tolerance is only a hint.
421    *   The implementation is free to merge in some cases and not in others, or
422    *   to never merge features at all.  The initial tolerance is 0.<P>
423    *
424    *   The current implementation merges vertices only if they are exactly
425    *   coincident, regardless of the current tolerance.  A vertex is spliced
426    *   into an edge only if the implementation is unable to distinguish which
427    *   side of the edge the vertex lies on.  Two edges are merged only when both
428    *   endpoints are identical.
429    * </UL>
430    *
431    * @param tessellator
432    *        Specifies the tessellation object created with
433    *        {@link #gluNewTess gluNewTess}
434    * @param which
435    *        Specifies the property to be set.  Valid values are
436    *        <b>GLU_TESS_WINDING_RULE</b>, <b>GLU_TESS_BOUNDARDY_ONLY</b>,
437    *        <b>GLU_TESS_TOLERANCE</b>.
438    * @param value
439    *        Specifices the value of the indicated property.
440    *
441    * @see #gluGetTessProperty gluGetTessProperty
442    * @see #gluNewTess         gluNewTess
443    ****************************************************************************/
gluTessProperty(GLUtessellator tessellator, int which, double value)444   public void gluTessProperty(GLUtessellator tessellator, int which, double value) {
445       GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
446       tess.gluTessProperty(which, value);
447   }
448 
449   /*****************************************************************************
450    * <b>gluGetTessProperty</b> retrieves properties stored in a tessellation
451    * object.  These properties affect the way that tessellation objects are
452    * interpreted and rendered.  See the
453    * {@link #gluTessProperty gluTessProperty} reference
454    * page for information about the properties and what they do.
455    *
456    * @param tessellator
457    *        Specifies the tessellation object (created with
458    *        {@link #gluNewTess gluNewTess}).
459    * @param which
460    *        Specifies the property whose value is to be fetched. Valid values
461    *        are <b>GLU_TESS_WINDING_RULE</b>, <b>GLU_TESS_BOUNDARY_ONLY</b>,
462    *        and <b>GLU_TESS_TOLERANCES</b>.
463    * @param value
464    *        Specifices an array into which the value of the named property is
465    *        written.
466    *
467    * @see #gluNewTess      gluNewTess
468    * @see #gluTessProperty gluTessProperty
469    ****************************************************************************/
gluGetTessProperty(GLUtessellator tessellator, int which, double[] value, int value_offset)470   public void gluGetTessProperty(GLUtessellator tessellator, int which, double[] value, int value_offset) {
471       GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
472       tess.gluGetTessProperty(which, value, value_offset);
473   }
474 
475   /*****************************************************************************
476    * <b>gluTessNormal</b> describes a normal for a polygon that the program is
477    * defining. All input data will be projected onto a plane perpendicular to
478    * the one of the three coordinate axes before tessellation and all output
479    * triangles will be oriented CCW with repsect to the normal (CW orientation
480    * can be obtained by reversing the sign of the supplied normal).  For
481    * example, if you know that all polygons lie in the x-y plane, call
482    * <b>gluTessNormal</b>(tess, 0.0, 0.0, 0.0) before rendering any polygons.<P>
483    *
484    * If the supplied normal is (0.0, 0.0, 0.0)(the initial value), the normal
485    * is determined as follows.  The direction of the normal, up to its sign, is
486    * found by fitting a plane to the vertices, without regard to how the
487    * vertices are connected.  It is expected that the input data lies
488    * approximately in the plane; otherwise, projection perpendicular to one of
489    * the three coordinate axes may substantially change the geometry.  The sign
490    * of the normal is chosen so that the sum of the signed areas of all input
491    * contours is nonnegative (where a CCW contour has positive area).<P>
492    *
493    * The supplied normal persists until it is changed by another call to
494    * <b>gluTessNormal</b>.
495    *
496    * @param tessellator
497    *        Specifies the tessellation object (created by
498    *        {@link #gluNewTess gluNewTess}).
499    * @param x
500    *        Specifies the first component of the normal.
501    * @param y
502    *        Specifies the second component of the normal.
503    * @param z
504    *        Specifies the third component of the normal.
505    *
506    * @see #gluTessBeginPolygon gluTessBeginPolygon
507    * @see #gluTessEndPolygon   gluTessEndPolygon
508    ****************************************************************************/
gluTessNormal(GLUtessellator tessellator, double x, double y, double z)509   public void gluTessNormal(GLUtessellator tessellator, double x, double y, double z) {
510       GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
511       tess.gluTessNormal(x, y, z);
512   }
513 
514   /*****************************************************************************
515    * <b>gluTessCallback</b> is used to indicate a callback to be used by a
516    * tessellation object. If the specified callback is already defined, then it
517    * is replaced. If <i>aCallback</i> is null, then the existing callback
518    * becomes undefined.<P>
519    *
520    * These callbacks are used by the tessellation object to describe how a
521    * polygon specified by the user is broken into triangles. Note that there are
522    * two versions of each callback: one with user-specified polygon data and one
523    * without. If both versions of a particular callback are specified, then the
524    * callback with user-specified polygon data will be used. Note that the
525    * polygonData parameter used by some of the methods is a copy of the
526    * reference that was specified when
527    * {@link #gluTessBeginPolygon gluTessBeginPolygon}
528    * was called. The legal callbacks are as follows:<P>
529    *
530    * <b>GLU_TESS_BEGIN</b>
531    * <UL>
532    *   The begin callback is invoked like {@link javax.media.opengl.GL#glBegin
533    *   glBegin} to indicate the start of a (triangle) primitive. The method
534    *   takes a single argument of type int. If the
535    *   <b>GLU_TESS_BOUNDARY_ONLY</b> property is set to <b>GL_FALSE</b>, then
536    *   the argument is set to either <b>GL_TRIANGLE_FAN</b>,
537    *   <b>GL_TRIANGLE_STRIP</b>, or <b>GL_TRIANGLES</b>. If the
538    *   <b>GLU_TESS_BOUNDARY_ONLY</b> property is set to <b>GL_TRUE</b>, then the
539    *   argument will be set to <b>GL_LINE_LOOP</b>. The method prototype for
540    *   this callback is:
541    * </UL>
542    *
543    * <PRE>
544    *         void begin(int type);</PRE><P>
545    *
546    * <b>GLU_TESS_BEGIN_DATA</b>
547    * <UL>
548    *   The same as the <b>GLU_TESS_BEGIN</b> callback except
549    *   that it takes an additional reference argument. This reference is
550    *   identical to the opaque reference provided when
551    *   {@link #gluTessBeginPolygon gluTessBeginPolygon}
552    *   was called. The method prototype for this callback is:
553    * </UL>
554    *
555    * <PRE>
556    *         void beginData(int type, Object polygonData);</PRE>
557    *
558    * <b>GLU_TESS_EDGE_FLAG</b>
559    * <UL>
560    *   The edge flag callback is similar to
561    *   {@link javax.media.opengl.GL#glEdgeFlag glEdgeFlag}. The method takes
562    *   a single boolean boundaryEdge that indicates which edges lie on the
563    *   polygon boundary. If the boundaryEdge is <b>GL_TRUE</b>, then each vertex
564    *   that follows begins an edge that lies on the polygon boundary, that is,
565    *   an edge that separates an interior region from an exterior one. If the
566    *   boundaryEdge is <b>GL_FALSE</b>, then each vertex that follows begins an
567    *   edge that lies in the polygon interior. The edge flag callback (if
568    *   defined) is invoked before the first vertex callback.<P>
569    *
570    *   Since triangle fans and triangle strips do not support edge flags, the
571    *   begin callback is not called with <b>GL_TRIANGLE_FAN</b> or
572    *   <b>GL_TRIANGLE_STRIP</b> if a non-null edge flag callback is provided.
573    *   (If the callback is initialized to null, there is no impact on
574    *   performance). Instead, the fans and strips are converted to independent
575    *   triangles. The method prototype for this callback is:
576    * </UL>
577    *
578    * <PRE>
579    *         void edgeFlag(boolean boundaryEdge);</PRE>
580    *
581    * <b>GLU_TESS_EDGE_FLAG_DATA</b>
582    * <UL>
583    *   The same as the <b>GLU_TESS_EDGE_FLAG</b> callback except that it takes
584    *   an additional reference argument. This reference is identical to the
585    *   opaque reference provided when
586    *   {@link #gluTessBeginPolygon gluTessBeginPolygon}
587    *   was called. The method prototype for this callback is:
588    * </UL>
589    *
590    * <PRE>
591    *         void edgeFlagData(boolean boundaryEdge, Object polygonData);</PRE>
592    *
593    * <b>GLU_TESS_VERTEX</b>
594    * <UL>
595    *   The vertex callback is invoked between the begin and end callbacks. It is
596    *   similar to {@link javax.media.opengl.GL#glVertex3f glVertex3f}, and it
597    *   defines the vertices of the triangles created by the tessellation
598    *   process. The method takes a reference as its only argument. This
599    *   reference is identical to the opaque reference provided by the user when
600    *   the vertex was described (see
601    *   {@link #gluTessVertex gluTessVertex}). The method
602    *   prototype for this callback is:
603    * </UL>
604    *
605    * <PRE>
606    *         void vertex(Object vertexData);</PRE>
607    *
608    * <b>GLU_TESS_VERTEX_DATA</b>
609    * <UL>
610    *   The same as the <b>GLU_TESS_VERTEX</b> callback except that it takes an
611    *   additional reference argument. This reference is identical to the opaque
612    *   reference provided when
613    *   {@link #gluTessBeginPolygon gluTessBeginPolygon}
614    *   was called. The method prototype for this callback is:
615    * </UL>
616    *
617    * <PRE>
618    *         void vertexData(Object vertexData, Object polygonData);</PRE>
619    *
620    * <b>GLU_TESS_END</b>
621    * <UL>
622    *   The end callback serves the same purpose as
623    *   {@link javax.media.opengl.GL#glEnd glEnd}. It indicates the end of a
624    *   primitive and it takes no arguments. The method prototype for this
625    *   callback is:
626    * </UL>
627    *
628    * <PRE>
629    *         void end();</PRE>
630    *
631    * <b>GLU_TESS_END_DATA</b>
632    * <UL>
633    *   The same as the <b>GLU_TESS_END</b> callback except that it takes an
634    *   additional reference argument. This reference is identical to the opaque
635    *   reference provided when
636    *   {@link #gluTessBeginPolygon gluTessBeginPolygon}
637    *   was called. The method prototype for this callback is:
638    * </UL>
639    *
640    * <PRE>
641    *         void endData(Object polygonData);</PRE>
642    *
643    * <b>GLU_TESS_COMBINE</b>
644    * <UL>
645    *   The combine callback is called to create a new vertex when the
646    *   tessellation detects an intersection, or wishes to merge features. The
647    *   method takes four arguments: an array of three elements each of type
648    *   double, an array of four references, an array of four elements each of
649    *   type float, and a reference to a reference. The prototype is:
650    * </UL>
651    *
652    * <PRE>
653    *         void combine(double[] coords, Object[] data,
654    *                      float[] weight, Object[] outData);</PRE>
655    *
656    * <UL>
657    *   The vertex is defined as a linear combination of up to four existing
658    *   vertices, stored in <i>data</i>. The coefficients of the linear
659    *   combination are given by <i>weight</i>; these weights always add up to 1.
660    *   All vertex pointers are valid even when some of the weights are 0.
661    *   <i>coords</i> gives the location of the new vertex.<P>
662    *
663    *   The user must allocate another vertex, interpolate parameters using
664    *   <i>data</i> and <i>weight</i>, and return the new vertex pointer
665    *   in <i>outData</i>. This handle is supplied during rendering callbacks.
666    *   The user is responsible for freeing the memory some time after
667    *   {@link #gluTessEndPolygon gluTessEndPolygon} is
668    *   called.<P>
669    *
670    *   For example, if the polygon lies in an arbitrary plane in 3-space, and a
671    *   color is associated with each vertex, the <b>GLU_TESS_COMBINE</b>
672    *   callback might look like this:
673    * </UL>
674    * <PRE>
675    *         void myCombine(double[] coords, Object[] data,
676    *                        float[] weight, Object[] outData)
677    *         {
678    *            MyVertex newVertex = new MyVertex();
679    *
680    *            newVertex.x = coords[0];
681    *            newVertex.y = coords[1];
682    *            newVertex.z = coords[2];
683    *            newVertex.r = weight[0]*data[0].r +
684    *                          weight[1]*data[1].r +
685    *                          weight[2]*data[2].r +
686    *                          weight[3]*data[3].r;
687    *            newVertex.g = weight[0]*data[0].g +
688    *                          weight[1]*data[1].g +
689    *                          weight[2]*data[2].g +
690    *                          weight[3]*data[3].g;
691    *            newVertex.b = weight[0]*data[0].b +
692    *                          weight[1]*data[1].b +
693    *                          weight[2]*data[2].b +
694    *                          weight[3]*data[3].b;
695    *            newVertex.a = weight[0]*data[0].a +
696    *                          weight[1]*data[1].a +
697    *                          weight[2]*data[2].a +
698    *                          weight[3]*data[3].a;
699    *            outData = newVertex;
700    *         }</PRE>
701    *
702    * <UL>
703    *   If the tessellation detects an intersection, then the
704    *   <b>GLU_TESS_COMBINE</b> or <b>GLU_TESS_COMBINE_DATA</b> callback (see
705    *   below) must be defined, and it must write a non-null reference into
706    *   <i>outData</i>. Otherwise the <b>GLU_TESS_NEED_COMBINE_CALLBACK</b> error
707    *   occurs, and no output is generated.
708    * </UL>
709    *
710    * <b>GLU_TESS_COMBINE_DATA</b>
711    * <UL>
712    *   The same as the <b>GLU_TESS_COMBINE</b> callback except that it takes an
713    *   additional reference argument. This reference is identical to the opaque
714    *   reference provided when
715    *   {@link #gluTessBeginPolygon gluTessBeginPolygon}
716    *   was called. The method prototype for this callback is:
717    * </UL>
718    *
719    * <PRE>
720    *         void combineData(double[] coords, Object[] data,
721                               float[] weight, Object[] outData,
722                               Object polygonData);</PRE>
723    *
724    * <b>GLU_TESS_ERROR</b>
725    * <UL>
726    *   The error callback is called when an error is encountered. The one
727    *   argument is of type int; it indicates the specific error that occurred
728    *   and will be set to one of <b>GLU_TESS_MISSING_BEGIN_POLYGON</b>,
729    *   <b>GLU_TESS_MISSING_END_POLYGON</b>,
730    *   <b>GLU_TESS_MISSING_BEGIN_CONTOUR</b>,
731    *   <b>GLU_TESS_MISSING_END_CONTOUR</b>, <b>GLU_TESS_COORD_TOO_LARGE</b>,
732    *   <b>GLU_TESS_NEED_COMBINE_CALLBACK</b> or <b>GLU_OUT_OF_MEMORY</b>.
733    *   Character strings describing these errors can be retrieved with the
734    *   {@link #gluErrorString gluErrorString} call. The
735    *   method prototype for this callback is:
736    * </UL>
737    *
738    * <PRE>
739    *         void error(int errnum);</PRE>
740    *
741    * <UL>
742    *   The GLU library will recover from the first four errors by inserting the
743    *   missing call(s). <b>GLU_TESS_COORD_TOO_LARGE</b> indicates that some
744    *   vertex coordinate exceeded the predefined constant
745    *   <b>GLU_TESS_MAX_COORD</b> in absolute value, and that the value has been
746    *   clamped. (Coordinate values must be small enough so that two can be
747    *   multiplied together without overflow.)
748    *   <b>GLU_TESS_NEED_COMBINE_CALLBACK</b> indicates that the tessellation
749    *   detected an intersection between two edges in the input data, and the
750    *   <b>GLU_TESS_COMBINE</b> or <b>GLU_TESS_COMBINE_DATA</b> callback was not
751    *   provided. No output is generated. <b>GLU_OUT_OF_MEMORY</b> indicates that
752    *   there is not enough memory so no output is generated.
753    * </UL>
754    *
755    * <b>GLU_TESS_ERROR_DATA</b>
756    * <UL>
757    *   The same as the GLU_TESS_ERROR callback except that it takes an
758    *   additional reference argument. This reference is identical to the opaque
759    *   reference provided when
760    *   {@link #gluTessBeginPolygon gluTessBeginPolygon}
761    *   was called. The method prototype for this callback is:
762    * </UL>
763    *
764    * <PRE>
765    *         void errorData(int errnum, Object polygonData);</PRE>
766    *
767    * @param tessellator
768    *        Specifies the tessellation object (created with
769    *        {@link #gluNewTess gluNewTess}).
770    * @param which
771    *        Specifies the callback being defined. The following values are
772    *        valid: <b>GLU_TESS_BEGIN</b>, <b>GLU_TESS_BEGIN_DATA</b>,
773    *        <b>GLU_TESS_EDGE_FLAG</b>, <b>GLU_TESS_EDGE_FLAG_DATA</b>,
774    *        <b>GLU_TESS_VERTEX</b>, <b>GLU_TESS_VERTEX_DATA</b>,
775    *        <b>GLU_TESS_END</b>, <b>GLU_TESS_END_DATA</b>,
776    *        <b>GLU_TESS_COMBINE</b>,  <b>GLU_TESS_COMBINE_DATA</b>,
777    *        <b>GLU_TESS_ERROR</b>, and <b>GLU_TESS_ERROR_DATA</b>.
778    * @param aCallback
779    *        Specifies the callback object to be called.
780    *
781    * @see javax.media.opengl.GL#glBegin              glBegin
782    * @see javax.media.opengl.GL#glEdgeFlag           glEdgeFlag
783    * @see javax.media.opengl.GL#glVertex3f           glVertex3f
784    * @see #gluNewTess          gluNewTess
785    * @see #gluErrorString      gluErrorString
786    * @see #gluTessVertex       gluTessVertex
787    * @see #gluTessBeginPolygon gluTessBeginPolygon
788    * @see #gluTessBeginContour gluTessBeginContour
789    * @see #gluTessProperty     gluTessProperty
790    * @see #gluTessNormal       gluTessNormal
791    ****************************************************************************/
gluTessCallback(GLUtessellator tessellator, int which, GLUtessellatorCallback aCallback)792   public void gluTessCallback(GLUtessellator tessellator, int which, GLUtessellatorCallback aCallback) {
793       GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
794       tess.gluTessCallback(which, aCallback);
795   }
796 
797   /*****************************************************************************
798    * <b>gluTessVertex</b> describes a vertex on a polygon that the program
799    * defines. Successive <b>gluTessVertex</b> calls describe a closed contour.
800    * For example, to describe a quadrilateral <b>gluTessVertex</b> should be
801    * called four times. <b>gluTessVertex</b> can only be called between
802    * {@link #gluTessBeginContour gluTessBeginContour} and
803    * {@link #gluTessBeginContour gluTessEndContour}.<P>
804    *
805    * <b>data</b> normally references to a structure containing the vertex
806    * location, as well as other per-vertex attributes such as color and normal.
807    * This reference is passed back to the user through the
808    * <b>GLU_TESS_VERTEX</b> or <b>GLU_TESS_VERTEX_DATA</b> callback after
809    * tessellation (see the {@link #gluTessCallback
810    * gluTessCallback} reference page).
811    *
812    * @param tessellator
813    *        Specifies the tessellation object (created with
814    *        {@link #gluNewTess gluNewTess}).
815    * @param coords
816    *        Specifies the coordinates of the vertex.
817    * @param data
818    *        Specifies an opaque reference passed back to the program with the
819    *        vertex callback (as specified by
820    *        {@link #gluTessCallback gluTessCallback}).
821    *
822    * @see #gluTessBeginPolygon gluTessBeginPolygon
823    * @see #gluNewTess          gluNewTess
824    * @see #gluTessBeginContour gluTessBeginContour
825    * @see #gluTessCallback     gluTessCallback
826    * @see #gluTessProperty     gluTessProperty
827    * @see #gluTessNormal       gluTessNormal
828    * @see #gluTessEndPolygon   gluTessEndPolygon
829    ****************************************************************************/
gluTessVertex(GLUtessellator tessellator, double[] coords, int coords_offset, Object data)830   public void gluTessVertex(GLUtessellator tessellator, double[] coords, int coords_offset, Object data) {
831       GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
832       tess.gluTessVertex(coords, coords_offset, data);
833   }
834 
835   /*****************************************************************************
836    * <b>gluTessBeginPolygon</b> and
837    * {@link #gluTessEndPolygon gluTessEndPolygon} delimit
838    * the definition of a convex, concave or self-intersecting polygon. Within
839    * each <b>gluTessBeginPolygon</b>/
840    * {@link #gluTessEndPolygon gluTessEndPolygon} pair,
841    * there must be one or more calls to
842    * {@link #gluTessBeginContour gluTessBeginContour}/
843    * {@link #gluTessEndContour gluTessEndContour}. Within
844    * each contour, there are zero or more calls to
845    * {@link #gluTessVertex gluTessVertex}. The vertices
846    * specify a closed contour (the last vertex of each contour is automatically
847    * linked to the first). See the {@link #gluTessVertex
848    * gluTessVertex}, {@link #gluTessBeginContour
849    * gluTessBeginContour}, and {@link #gluTessEndContour
850    * gluTessEndContour} reference pages for more details.<P>
851    *
852    * <b>data</b> is a reference to a user-defined data structure. If the
853    * appropriate callback(s) are specified (see
854    * {@link #gluTessCallback gluTessCallback}), then this
855    * reference is returned to the callback method(s). Thus, it is a convenient
856    * way to store per-polygon information.<P>
857    *
858    * Once {@link #gluTessEndPolygon gluTessEndPolygon} is
859    * called, the polygon is tessellated, and the resulting triangles are
860    * described through callbacks. See
861    * {@link #gluTessCallback gluTessCallback} for
862    * descriptions of the callback methods.
863    *
864    * @param tessellator
865    *        Specifies the tessellation object (created with
866    *        {@link #gluNewTess gluNewTess}).
867    * @param data
868    *        Specifies a reference to user polygon data.
869    *
870    * @see #gluNewTess          gluNewTess
871    * @see #gluTessBeginContour gluTessBeginContour
872    * @see #gluTessVertex       gluTessVertex
873    * @see #gluTessCallback     gluTessCallback
874    * @see #gluTessProperty     gluTessProperty
875    * @see #gluTessNormal       gluTessNormal
876    * @see #gluTessEndPolygon   gluTessEndPolygon
877    ****************************************************************************/
gluTessBeginPolygon(GLUtessellator tessellator, Object data)878   public void gluTessBeginPolygon(GLUtessellator tessellator, Object data) {
879       GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
880       tess.gluTessBeginPolygon(data);
881   }
882 
883   /*****************************************************************************
884    * <b>gluTessBeginContour</b> and
885    * {@link #gluTessEndContour gluTessEndContour} delimit
886    * the definition of a polygon contour. Within each
887    * <b>gluTessBeginContour</b>/
888    * {@link #gluTessEndContour gluTessEndContour} pair,
889    * there can be zero or more calls to
890    * {@link #gluTessVertex gluTessVertex}. The vertices
891    * specify a closed contour (the last vertex of each contour is automatically
892    * linked to the first). See the {@link #gluTessVertex
893    * gluTessVertex} reference page for more details. <b>gluTessBeginContour</b>
894    * can only be called between
895    * {@link #gluTessBeginPolygon gluTessBeginPolygon} and
896    * {@link #gluTessEndPolygon gluTessEndPolygon}.
897    *
898    * @param tessellator
899    *        Specifies the tessellation object (created with
900    *        {@link #gluNewTess gluNewTess}).
901    *
902    * @see #gluNewTess          gluNewTess
903    * @see #gluTessBeginPolygon gluTessBeginPolygon
904    * @see #gluTessVertex       gluTessVertex
905    * @see #gluTessCallback     gluTessCallback
906    * @see #gluTessProperty     gluTessProperty
907    * @see #gluTessNormal       gluTessNormal
908    * @see #gluTessEndPolygon   gluTessEndPolygon
909    ****************************************************************************/
gluTessBeginContour(GLUtessellator tessellator)910   public void gluTessBeginContour(GLUtessellator tessellator) {
911       GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
912       tess.gluTessBeginContour();
913   }
914 
915   /*****************************************************************************
916    *  <b>gluTessEndContour</b> and
917    * {@link #gluTessBeginContour gluTessBeginContour}
918    * delimit the definition of a polygon contour. Within each
919    * {@link #gluTessBeginContour gluTessBeginContour}/
920    * <b>gluTessEndContour</b> pair, there can be zero or more calls to
921    * {@link #gluTessVertex gluTessVertex}. The vertices
922    * specify a closed contour (the last vertex of each contour is automatically
923    * linked to the first). See the {@link #gluTessVertex
924    * gluTessVertex} reference page for more details.
925    * {@link #gluTessBeginContour gluTessBeginContour} can
926    * only be called between {@link #gluTessBeginPolygon
927    * gluTessBeginPolygon} and
928    * {@link #gluTessEndPolygon gluTessEndPolygon}.
929    *
930    * @param tessellator
931    *        Specifies the tessellation object (created with
932    *        {@link #gluNewTess gluNewTess}).
933    *
934    * @see #gluNewTess          gluNewTess
935    * @see #gluTessBeginPolygon gluTessBeginPolygon
936    * @see #gluTessVertex       gluTessVertex
937    * @see #gluTessCallback     gluTessCallback
938    * @see #gluTessProperty     gluTessProperty
939    * @see #gluTessNormal       gluTessNormal
940    * @see #gluTessEndPolygon   gluTessEndPolygon
941    ****************************************************************************/
gluTessEndContour(GLUtessellator tessellator)942   public void gluTessEndContour(GLUtessellator tessellator) {
943       GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
944       tess.gluTessEndContour();
945   }
946 
947   /*****************************************************************************
948    * <b>gluTessEndPolygon</b> and
949    * {@link #gluTessBeginPolygon gluTessBeginPolygon}
950    * delimit the definition of a convex, concave or self-intersecting polygon.
951    * Within each {@link #gluTessBeginPolygon
952    * gluTessBeginPolygon}/<b>gluTessEndPolygon</b> pair, there must be one or
953    * more calls to {@link #gluTessBeginContour
954    * gluTessBeginContour}/{@link #gluTessEndContour
955    * gluTessEndContour}. Within each contour, there are zero or more calls to
956    * {@link #gluTessVertex gluTessVertex}. The vertices
957    * specify a closed contour (the last vertex of each contour is automatically
958    * linked to the first). See the {@link #gluTessVertex
959    * gluTessVertex}, {@link #gluTessBeginContour
960    * gluTessBeginContour} and {@link #gluTessEndContour
961    * gluTessEndContour} reference pages for more details.<P>
962    *
963    * Once <b>gluTessEndPolygon</b> is called, the polygon is tessellated, and
964    * the resulting triangles are described through callbacks. See
965    * {@link #gluTessCallback gluTessCallback} for
966    * descriptions of the callback functions.
967    *
968    * @param tessellator
969    *        Specifies the tessellation object (created with
970    *        {@link #gluNewTess gluNewTess}).
971    *
972    * @see #gluNewTess          gluNewTess
973    * @see #gluTessBeginContour gluTessBeginContour
974    * @see #gluTessVertex       gluTessVertex
975    * @see #gluTessCallback     gluTessCallback
976    * @see #gluTessProperty     gluTessProperty
977    * @see #gluTessNormal       gluTessNormal
978    * @see #gluTessBeginPolygon gluTessBeginPolygon
979    ****************************************************************************/
gluTessEndPolygon(GLUtessellator tessellator)980   public void gluTessEndPolygon(GLUtessellator tessellator) {
981       GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
982       tess.gluTessEndPolygon();
983   }
984 
985   /*****************************************************************************
986 
987    * <b>gluBeginPolygon</b> and {@link #gluEndPolygon gluEndPolygon}
988    * delimit the definition of a nonconvex polygon. To define such a
989    * polygon, first call <b>gluBeginPolygon</b>. Then define the
990    * contours of the polygon by calling {@link #gluTessVertex
991    * gluTessVertex} for each vertex and {@link #gluNextContour
992    * gluNextContour} to start each new contour. Finally, call {@link
993    * #gluEndPolygon gluEndPolygon} to signal the end of the
994    * definition. See the {@link #gluTessVertex gluTessVertex} and {@link
995    * #gluNextContour gluNextContour} reference pages for more
996    * details.<P>
997 
998    *
999    * Once {@link #gluEndPolygon gluEndPolygon} is called,
1000    * the polygon is tessellated, and the resulting triangles are described
1001    * through callbacks. See {@link #gluTessCallback
1002    * gluTessCallback} for descriptions of the callback methods.
1003    *
1004    * @param tessellator
1005    *        Specifies the tessellation object (created with
1006    *        {@link #gluNewTess gluNewTess}).
1007    *
1008    * @see #gluNewTess          gluNewTess
1009    * @see #gluNextContour      gluNextContour
1010    * @see #gluTessCallback     gluTessCallback
1011    * @see #gluTessVertex       gluTessVertex
1012    * @see #gluTessBeginPolygon gluTessBeginPolygon
1013    * @see #gluTessBeginContour gluTessBeginContour
1014    ****************************************************************************/
gluBeginPolygon(GLUtessellator tessellator)1015   public void gluBeginPolygon(GLUtessellator tessellator) {
1016       GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
1017       tess.gluBeginPolygon();
1018   }
1019 
1020   /*****************************************************************************
1021    * <b>gluNextContour</b> is used to describe polygons with multiple
1022    * contours. After you describe the first contour through a series of
1023    * {@link #gluTessVertex gluTessVertex} calls, a
1024    * <b>gluNextContour</b> call indicates that the previous contour is complete
1025    * and that the next contour is about to begin. Perform another series of
1026    * {@link #gluTessVertex gluTessVertex} calls to
1027    * describe the new contour. Repeat this process until all contours have been
1028    * described.<P>
1029    *
1030    * The type parameter defines what type of contour follows. The following
1031    * values are valid. <P>
1032    *
1033    * <b>GLU_EXTERIOR</b>
1034    * <UL>
1035    *   An exterior contour defines an exterior boundary of the polygon.
1036    * </UL>
1037    * <b>GLU_INTERIOR</b>
1038    * <UL>
1039    *   An interior contour defines an interior boundary of the polygon (such as
1040    *   a hole).
1041    * </UL>
1042    * <b>GLU_UNKNOWN</b>
1043    * <UL>
1044    *   An unknown contour is analyzed by the library to determine whether it is
1045    *   interior or exterior.
1046    * </UL>
1047    * <b>GLU_CCW, GLU_CW</b>
1048    * <UL>
1049    *   The first <b>GLU_CCW</b> or <b>GLU_CW</b> contour defined is considered
1050    *   to be exterior. All other contours are considered to be exterior if they
1051    *   are oriented in the same direction (clockwise or counterclockwise) as the
1052    *   first contour, and interior if they are not. If one contour is of type
1053    *   <b>GLU_CCW</b> or <b>GLU_CW</b>, then all contours must be of the same
1054    *   type (if they are not, then all <b>GLU_CCW</b> and <b>GLU_CW</b> contours
1055    *   will be changed to <b>GLU_UNKNOWN</b>). Note that there is no
1056    *   real difference between the <b>GLU_CCW</b> and <b>GLU_CW</b> contour
1057    *   types.
1058    * </UL><P>
1059    *
1060    * To define the type of the first contour, you can call <b>gluNextContour</b>
1061    * before describing the first contour. If you do not call
1062    * <b>gluNextContour</b> before the first contour, the first contour is marked
1063    * <b>GLU_EXTERIOR</b>.<P>
1064    *
1065    * <UL>
1066    *   <b>Note:</b>  The <b>gluNextContour</b> function is obsolete and is
1067    *   provided for backward compatibility only. The <b>gluNextContour</b>
1068    *   function is mapped to {@link #gluTessEndContour
1069    *   gluTessEndContour} followed by
1070    *   {@link #gluTessBeginContour gluTessBeginContour}.
1071    * </UL>
1072    *
1073    * @param tessellator
1074    *        Specifies the tessellation object (created with
1075    *        {@link #gluNewTess gluNewTess}).
1076    * @param type
1077    *        The type of the contour being defined.
1078    *
1079    * @see #gluNewTess          gluNewTess
1080    * @see #gluTessBeginContour gluTessBeginContour
1081    * @see #gluTessBeginPolygon gluTessBeginPolygon
1082    * @see #gluTessCallback     gluTessCallback
1083    * @see #gluTessEndContour   gluTessEndContour
1084    * @see #gluTessVertex       gluTessVertex
1085    ****************************************************************************/
gluNextContour(GLUtessellator tessellator, int type)1086   public void gluNextContour(GLUtessellator tessellator, int type) {
1087       GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
1088       tess.gluNextContour(type);
1089   }
1090 
1091   /*****************************************************************************
1092    * <b>gluEndPolygon</b> and {@link #gluBeginPolygon
1093    * gluBeginPolygon} delimit the definition of a nonconvex polygon. To define
1094    * such a polygon, first call {@link #gluBeginPolygon
1095    * gluBeginPolygon}. Then define the contours of the polygon by calling
1096    * {@link #gluTessVertex gluTessVertex} for each vertex
1097    * and {@link #gluNextContour gluNextContour} to start
1098    * each new contour. Finally, call <b>gluEndPolygon</b> to signal the end of
1099    * the definition. See the {@link #gluTessVertex
1100    * gluTessVertex} and {@link #gluNextContour
1101    * gluNextContour} reference pages for more details.<P>
1102    *
1103    * Once <b>gluEndPolygon</b> is called, the polygon is tessellated, and the
1104    * resulting triangles are described through callbacks. See
1105    * {@link #gluTessCallback gluTessCallback} for
1106    * descriptions of the callback methods.
1107    *
1108    * @param tessellator
1109    *        Specifies the tessellation object (created with
1110    *        {@link #gluNewTess gluNewTess}).
1111    *
1112    * @see #gluNewTess          gluNewTess
1113    * @see #gluNextContour      gluNextContour
1114    * @see #gluTessCallback     gluTessCallback
1115    * @see #gluTessVertex       gluTessVertex
1116    * @see #gluTessBeginPolygon gluTessBeginPolygon
1117    * @see #gluTessBeginContour gluTessBeginContour
1118    ****************************************************************************/
gluEndPolygon(GLUtessellator tessellator)1119   public void gluEndPolygon(GLUtessellator tessellator) {
1120       GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
1121       tess.gluEndPolygon();
1122   }
1123 
1124   //----------------------------------------------------------------------
1125   // Quadric functionality
1126   //
1127 
1128   /** Interface to C language function: <br> <code> void gluCylinder(GLUquadric *  quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks); </code>    */
gluCylinder(GLUquadric quad, double base, double top, double height, int slices, int stacks)1129   public void gluCylinder(GLUquadric quad, double base, double top, double height, int slices, int stacks) {
1130     ((GLUquadricImpl) quad).drawCylinder(getCurrentGL(), (float) base, (float) top, (float) height, slices, stacks);
1131   }
1132 
1133   /** Interface to C language function: <br> <code> void gluDeleteQuadric(GLUquadric *  quad); </code>    */
gluDeleteQuadric(GLUquadric quad)1134   public void gluDeleteQuadric(GLUquadric quad) {
1135   }
1136 
1137   /** Interface to C language function: <br> <code> void gluDisk(GLUquadric *  quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops); </code>    */
gluDisk(GLUquadric quad, double inner, double outer, int slices, int loops)1138   public void gluDisk(GLUquadric quad, double inner, double outer, int slices, int loops) {
1139     ((GLUquadricImpl) quad).drawDisk(getCurrentGL(), (float) inner, (float) outer, slices, loops);
1140   }
1141 
1142   /** Interface to C language function: <br> <code> GLUquadric *  gluNewQuadric(void); </code>    */
gluNewQuadric()1143   public GLUquadric gluNewQuadric() {
1144     return new GLUquadricImpl();
1145   }
1146 
1147   /** Interface to C language function: <br> <code> void gluPartialDisk(GLUquadric *  quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep); </code>    */
gluPartialDisk(GLUquadric quad, double inner, double outer, int slices, int loops, double start, double sweep)1148   public void gluPartialDisk(GLUquadric quad, double inner, double outer, int slices, int loops, double start, double sweep) {
1149     ((GLUquadricImpl) quad).drawPartialDisk(getCurrentGL(), (float) inner, (float) outer, slices, loops, (float) start, (float) sweep);
1150   }
1151 
1152   /** Interface to C language function: <br> <code> void gluQuadricDrawStyle(GLUquadric *  quad, GLenum draw); </code>    */
gluQuadricDrawStyle(GLUquadric quad, int draw)1153   public void gluQuadricDrawStyle(GLUquadric quad, int draw) {
1154     ((GLUquadricImpl) quad).setDrawStyle(draw);
1155   }
1156 
1157   /** Interface to C language function: <br> <code> void gluQuadricNormals(GLUquadric *  quad, GLenum normal); </code>    */
gluQuadricNormals(GLUquadric quad, int normal)1158   public void gluQuadricNormals(GLUquadric quad, int normal) {
1159     ((GLUquadricImpl) quad).setNormals(normal);
1160   }
1161 
1162   /** Interface to C language function: <br> <code> void gluQuadricOrientation(GLUquadric *  quad, GLenum orientation); </code>    */
gluQuadricOrientation(GLUquadric quad, int orientation)1163   public void gluQuadricOrientation(GLUquadric quad, int orientation) {
1164     ((GLUquadricImpl) quad).setOrientation(orientation);
1165   }
1166 
1167   /** Interface to C language function: <br> <code> void gluQuadricTexture(GLUquadric *  quad, GLboolean texture); </code>    */
gluQuadricTexture(GLUquadric quad, boolean texture)1168   public void gluQuadricTexture(GLUquadric quad, boolean texture) {
1169     ((GLUquadricImpl) quad).setTextureFlag(texture);
1170   }
1171 
1172   /** Interface to C language function: <br> <code> void gluSphere(GLUquadric *  quad, GLdouble radius, GLint slices, GLint stacks); </code>    */
gluSphere(GLUquadric quad, double radius, int slices, int stacks)1173   public void gluSphere(GLUquadric quad, double radius, int slices, int stacks) {
1174     ((GLUquadricImpl) quad).drawSphere(getCurrentGL(), (float) radius, slices, stacks);
1175   }
1176 
1177   //----------------------------------------------------------------------
1178   // Projection routines
1179   //
1180 
1181   private Project project;
1182 
gluOrtho2D(double left, double right, double bottom, double top)1183   public void gluOrtho2D(double left, double right, double bottom, double top) {
1184     project.gluOrtho2D(getCurrentGL(), left, right, bottom, top);
1185   }
1186 
gluPerspective(double fovy, double aspect, double zNear, double zFar)1187   public void gluPerspective(double fovy, double aspect, double zNear, double zFar) {
1188     project.gluPerspective(getCurrentGL(), fovy, aspect, zNear, zFar);
1189   }
1190 
gluLookAt(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ)1191   public void gluLookAt(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ) {
1192     project.gluLookAt(getCurrentGL(), eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ);
1193   }
1194 
1195   /** Interface to C language function: <br> <code> GLint gluProject(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *  model, const GLdouble *  proj, const GLint *  view, GLdouble *  winX, GLdouble *  winY, GLdouble *  winZ); </code>
1196    * <P> Accepts the outgoing window coordinates as a single array.
1197    */
gluProject(double objX, double objY, double objZ, double[] model, int model_offset, double[] proj, int proj_offset, int[] view, int view_offset, double[] winPos, int winPos_offset)1198   public boolean gluProject(double objX, double objY, double objZ, double[] model, int model_offset, double[] proj, int proj_offset, int[] view, int view_offset, double[] winPos, int winPos_offset) {
1199     return project.gluProject(objX, objY, objZ, model, model_offset, proj, proj_offset, view, view_offset, winPos, winPos_offset);
1200   }
1201 
1202   /** Interface to C language function: <br> <code> GLint gluProject(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *  model, const GLdouble *  proj, const GLint *  view, GLdouble *  winX, GLdouble *  winY, GLdouble *  winZ); </code>
1203    * <P> Accepts the outgoing window coordinates as a single buffer.
1204    */
gluProject(double objX, double objY, double objZ, java.nio.DoubleBuffer model, java.nio.DoubleBuffer proj, java.nio.IntBuffer view, java.nio.DoubleBuffer winPos)1205   public boolean gluProject(double objX, double objY, double objZ, java.nio.DoubleBuffer model, java.nio.DoubleBuffer proj, java.nio.IntBuffer view, java.nio.DoubleBuffer winPos) {
1206     return project.gluProject(objX, objY, objZ, model, proj, view, winPos);
1207   }
1208 
1209   /** Interface to C language function: <br> <code> GLint gluUnProject(GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble *  model, const GLdouble *  proj, const GLint *  view, GLdouble *  objX, GLdouble *  objY, GLdouble *  objZ); </code>
1210    * <P> Accepts the outgoing object coordinates (a 3-vector) as a single array.
1211    */
gluUnProject(double winX, double winY, double winZ, double[] model, int model_offset, double[] proj, int proj_offset, int[] view, int view_offset, double[] objPos, int objPos_offset)1212   public boolean gluUnProject(double winX, double winY, double winZ, double[] model, int model_offset, double[] proj, int proj_offset, int[] view, int view_offset, double[] objPos, int objPos_offset) {
1213     return project.gluUnProject(winX, winY, winZ, model, model_offset, proj, proj_offset, view, view_offset, objPos, objPos_offset);
1214   }
1215 
1216   /** Interface to C language function: <br> <code> GLint gluUnProject(GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble *  model, const GLdouble *  proj, const GLint *  view, GLdouble *  objX, GLdouble *  objY, GLdouble *  objZ); </code>
1217    * <P> Accepts the outgoing object coordinates (a 3-vector) as a single buffer.
1218    */
gluUnProject(double winX, double winY, double winZ, java.nio.DoubleBuffer model, java.nio.DoubleBuffer proj, java.nio.IntBuffer view, java.nio.DoubleBuffer objPos)1219   public boolean gluUnProject(double winX, double winY, double winZ, java.nio.DoubleBuffer model, java.nio.DoubleBuffer proj, java.nio.IntBuffer view, java.nio.DoubleBuffer objPos) {
1220     return project.gluUnProject(winX, winY, winZ, model, proj, view, objPos);
1221   }
1222 
1223   /** Interface to C language function: <br> <code> GLint gluUnProject4(GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble *  model, const GLdouble *  proj, const GLint *  view, GLdouble nearVal, GLdouble farVal, GLdouble *  objX, GLdouble *  objY, GLdouble *  objZ, GLdouble *  objW); </code>
1224    * <P> Accepts the outgoing object coordinates (a 4-vector) as a single array.
1225    */
gluUnProject4(double winX, double winY, double winZ, double clipW, double[] model, int model_offset, double[] proj, int proj_offset, int[] view, int view_offset, double nearVal, double farVal, double[] objPos, int objPos_offset)1226   public boolean gluUnProject4(double winX, double winY, double winZ, double clipW, double[] model, int model_offset, double[] proj, int proj_offset, int[] view, int view_offset, double nearVal, double farVal, double[] objPos, int objPos_offset) {
1227     return project.gluUnProject4(winX, winY, winZ, clipW, model, model_offset, proj, proj_offset, view, view_offset, nearVal, farVal, objPos, objPos_offset);
1228   }
1229 
1230   /** Interface to C language function: <br> <code> GLint gluUnProject4(GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble *  model, const GLdouble *  proj, const GLint *  view, GLdouble nearVal, GLdouble farVal, GLdouble *  objX, GLdouble *  objY, GLdouble *  objZ, GLdouble *  objW); </code>
1231    * <P> Accepts the outgoing object coordinates (a 4-vector) as a single buffer.
1232    */
gluUnProject4(double winX, double winY, double winZ, double clipW, java.nio.DoubleBuffer model, java.nio.DoubleBuffer proj, java.nio.IntBuffer view, double nearVal, double farVal, java.nio.DoubleBuffer objPos)1233   public boolean gluUnProject4(double winX, double winY, double winZ, double clipW, java.nio.DoubleBuffer model, java.nio.DoubleBuffer proj, java.nio.IntBuffer view, double nearVal, double farVal, java.nio.DoubleBuffer objPos) {
1234     return project.gluUnProject4(winX, winY, winZ, clipW, model, proj, view, nearVal, farVal, objPos);
1235   }
1236 
gluPickMatrix(double x, double y, double delX, double delY, int[] viewport, int viewport_offset)1237   public void gluPickMatrix(double x, double y, double delX, double delY, int[] viewport, int viewport_offset) {
1238     project.gluPickMatrix(getCurrentGL(), x, y, delX, delY, viewport, viewport_offset);
1239   }
1240 
gluPickMatrix(double x, double y, double delX, double delY, java.nio.IntBuffer viewport)1241   public void gluPickMatrix(double x, double y, double delX, double delY, java.nio.IntBuffer viewport) {
1242     project.gluPickMatrix(getCurrentGL(), x, y, delX, delY, viewport);
1243   }
1244 
1245   //----------------------------------------------------------------------
1246   // Mipmap and image scaling functionality
1247 
1248 
1249   // Boolean
1250   public static final int GLU_FALSE = 0;
1251   public static final int GLU_TRUE = 1;
1252 
1253   // String Name
1254   public static final int GLU_VERSION = 100800;
1255   public static final int GLU_EXTENSIONS = 100801;
1256 
1257   // Extensions
1258   public static final String versionString = "1.3";
1259   public static final String extensionString = "GLU_EXT_nurbs_tessellator " +
1260                                                "GLU_EXT_object_space_tess ";
1261 
1262   // ErrorCode
1263   public static final int GLU_INVALID_ENUM = 100900;
1264   public static final int GLU_INVALID_VALUE = 100901;
1265   public static final int GLU_OUT_OF_MEMORY = 100902;
1266   public static final int GLU_INVALID_OPERATION = 100904;
1267 
1268   // NurbsDisplay
1269   // GLU_FILL
1270   //public static final int GLU_OUTLINE_POLYGON = 100240;
1271   //public static final int GLU_OUTLINE_PATCH = 100241;
1272 
1273   // NurbsCallback
1274   //public static final int GLU_NURBS_ERROR = 100103;
1275   public static final int GLU_ERROR = 100103;
1276   //public static final int GLU_NURBS_BEGIN = 100164;
1277   //public static final int GLU_NURBS_BEGIN_EXT = 100164;
1278   //public static final int GLU_NURBS_VERTEX = 100165;
1279   //public static final int GLU_NURBS_VERTEX_EXT = 100165;
1280   //public static final int GLU_NURBS_NORMAL = 100166;
1281   //public static final int GLU_NURBS_NORMAL_EXT = 100166;
1282   //public static final int GLU_NURBS_COLOR = 100167;
1283   //public static final int GLU_NURBS_COLOR_EXT = 100167;
1284   //public static final int GLU_NURBS_TEXTURE_COORD = 100168;
1285   //public static final int GLU_NURBS_TEX_COORD_EXT = 100168;
1286   //public static final int GLU_NURBS_END = 100169;
1287   //public static final int GLU_NURBS_END_EXT = 100169;
1288   //public static final int GLU_NURBS_BEGIN_DATA = 100170;
1289   //public static final int GLU_NURBS_BEGIN_DATA_EXT = 100170;
1290   //public static final int GLU_NURBS_VERTEX_DATA = 100171;
1291   //public static final int GLU_NURBS_VERTEX_DATA_EXT = 100171;
1292   //public static final int GLU_NURBS_NORMAL_DATA = 100172;
1293   //public static final int GLU_NURBS_NORMAL_DATA_EXT = 100172;
1294   //public static final int GLU_NURBS_COLOR_DATA = 100173;
1295   //public static final int GLU_NURBS_COLOR_DATA_EXT = 100173;
1296   //public static final int GLU_NURBS_TEXTURE_COORD_DATA = 100174;
1297   //public static final int GLU_NURBS_TEX_COORD_DATA_EXT = 100174;
1298   //public static final int GLU_NURBS_END_DATA = 100175;
1299   //public static final int GLU_NURBS_END_DATA_EXT = 100175;
1300 
1301   // NurbsError
1302   //public static final int GLU_NURBS_ERROR1 = 100251;
1303   //public static final int GLU_NURBS_ERROR2 = 100252;
1304   //public static final int GLU_NURBS_ERROR3 = 100253;
1305   //public static final int GLU_NURBS_ERROR4 = 100254;
1306   //public static final int GLU_NURBS_ERROR5 = 100255;
1307   //public static final int GLU_NURBS_ERROR6 = 100256;
1308   //public static final int GLU_NURBS_ERROR7 = 100257;
1309   //public static final int GLU_NURBS_ERROR8 = 100258;
1310   //public static final int GLU_NURBS_ERROR9 = 100259;
1311   //public static final int GLU_NURBS_ERROR10 = 100260;
1312   //public static final int GLU_NURBS_ERROR11 = 100261;
1313   //public static final int GLU_NURBS_ERROR12 = 100262;
1314   //public static final int GLU_NURBS_ERROR13 = 100263;
1315   //public static final int GLU_NURBS_ERROR14 = 100264;
1316   //public static final int GLU_NURBS_ERROR15 = 100265;
1317   //public static final int GLU_NURBS_ERROR16 = 100266;
1318   //public static final int GLU_NURBS_ERROR17 = 100267;
1319   //public static final int GLU_NURBS_ERROR18 = 100268;
1320   //public static final int GLU_NURBS_ERROR19 = 100269;
1321   //public static final int GLU_NURBS_ERROR20 = 100270;
1322   //public static final int GLU_NURBS_ERROR21 = 100271;
1323   //public static final int GLU_NURBS_ERROR22 = 100272;
1324   //public static final int GLU_NURBS_ERROR23 = 100273;
1325   //public static final int GLU_NURBS_ERROR24 = 100274;
1326   //public static final int GLU_NURBS_ERROR25 = 100275;
1327   //public static final int GLU_NURBS_ERROR26 = 100276;
1328   //public static final int GLU_NURBS_ERROR27 = 100277;
1329   //public static final int GLU_NURBS_ERROR28 = 100278;
1330   //public static final int GLU_NURBS_ERROR29 = 100279;
1331   //public static final int GLU_NURBS_ERROR30 = 100280;
1332   //public static final int GLU_NURBS_ERROR31 = 100281;
1333   //public static final int GLU_NURBS_ERROR32 = 100282;
1334   //public static final int GLU_NURBS_ERROR33 = 100283;
1335   //public static final int GLU_NURBS_ERROR34 = 100284;
1336   //public static final int GLU_NURBS_ERROR35 = 100285;
1337   //public static final int GLU_NURBS_ERROR36 = 100286;
1338   //public static final int GLU_NURBS_ERROR37 = 100287;
1339 
1340   // NurbsProperty
1341   //public static final int GLU_AUTO_LOAD_MATRIX = 100200;
1342   //public static final int GLU_CULLING = 100201;
1343   //public static final int GLU_SAMPLING_TOLERANCE = 100203;
1344   //public static final int GLU_DISPLAY_MODE = 100204;
1345   //public static final int GLU_PARAMETRIC_TOLERANCE = 100202;
1346   //public static final int GLU_SAMPLING_METHOD = 100205;
1347   //public static final int GLU_U_STEP = 100206;
1348   //public static final int GLU_V_STEP = 100207;
1349   //public static final int GLU_NURBS_MODE = 100160;
1350   //public static final int GLU_NURBS_MODE_EXT = 100160;
1351   //public static final int GLU_NURBS_TESSELLATOR = 100161;
1352   //public static final int GLU_NURBS_TESSELLATOR_EXT = 100161;
1353   //public static final int GLU_NURBS_RENDERER = 100162;
1354   //public static final int GLU_NURBS_RENDERER_EXT = 100162;
1355 
1356   // NurbsSampling
1357   //public static final int GLU_OBJECT_PARAMETRIC_ERROR = 100208;
1358   //public static final int GLU_OBJECT_PARAMETRIC_ERROR_EXT = 100208;
1359   //public static final int GLU_OBJECT_PATH_LENGTH = 100209;
1360   //public static final int GLU_OBJECT_PATH_LENGTH_EXT = 100209;
1361   //public static final int GLU_PATH_LENGTH = 100215;
1362   //public static final int GLU_PARAMETRIC_ERROR = 100216;
1363   //public static final int GLU_DOMAIN_DISTANCE = 100217;
1364 
1365   // NurbsTrim
1366   //public static final int GLU_MAP1_TRIM_2 = 100210;
1367   //public static final int GLU_MAP1_TRIM_3 = 100211;
1368 
1369   // QuadricDrawStyle
1370   public static final int GLU_POINT = 100010;
1371   public static final int GLU_LINE = 100011;
1372   public static final int GLU_FILL = 100012;
1373   public static final int GLU_SILHOUETTE = 100013;
1374 
1375   // QuadricCallback
1376   // GLU_ERROR
1377 
1378   // QuadricNormal
1379   public static final int GLU_SMOOTH = 100000;
1380   public static final int GLU_FLAT = 100001;
1381   public static final int GLU_NONE = 100002;
1382 
1383   // QuadricOrientation
1384   public static final int GLU_OUTSIDE = 100020;
1385   public static final int GLU_INSIDE = 100021;
1386 
1387   // TessCallback
1388   public static final int GLU_TESS_BEGIN = 100100;
1389   public static final int GLU_BEGIN = 100100;
1390   public static final int GLU_TESS_VERTEX = 100101;
1391   public static final int GLU_VERTEX = 100101;
1392   public static final int GLU_TESS_END = 100102;
1393   public static final int GLU_END = 100102;
1394   public static final int GLU_TESS_ERROR = 100103;
1395   public static final int GLU_TESS_EDGE_FLAG = 100104;
1396   public static final int GLU_EDGE_FLAG = 100104;
1397   public static final int GLU_TESS_COMBINE = 100105;
1398   public static final int GLU_TESS_BEGIN_DATA = 100106;
1399   public static final int GLU_TESS_VERTEX_DATA = 100107;
1400   public static final int GLU_TESS_END_DATA = 100108;
1401   public static final int GLU_TESS_ERROR_DATA = 100109;
1402   public static final int GLU_TESS_EDGE_FLAG_DATA = 100110;
1403   public static final int GLU_TESS_COMBINE_DATA = 100111;
1404 
1405   // TessContour
1406   public static final int GLU_CW = 100120;
1407   public static final int GLU_CCW = 100121;
1408   public static final int GLU_INTERIOR = 100122;
1409   public static final int GLU_EXTERIOR = 100123;
1410   public static final int GLU_UNKNOWN = 100124;
1411 
1412   // TessProperty
1413   public static final int GLU_TESS_WINDING_RULE = 100140;
1414   public static final int GLU_TESS_BOUNDARY_ONLY = 100141;
1415   public static final int GLU_TESS_TOLERANCE = 100142;
1416 
1417   // TessError
1418   public static final int GLU_TESS_ERROR1 = 100151;
1419   public static final int GLU_TESS_ERROR2 = 100152;
1420   public static final int GLU_TESS_ERROR3 = 100153;
1421   public static final int GLU_TESS_ERROR4 = 100154;
1422   public static final int GLU_TESS_ERROR5 = 100155;
1423   public static final int GLU_TESS_ERROR6 = 100156;
1424   public static final int GLU_TESS_ERROR7 = 100157;
1425   public static final int GLU_TESS_ERROR8 = 100158;
1426   public static final int GLU_TESS_MISSING_BEGIN_POLYGON = 100151;
1427   public static final int GLU_TESS_MISSING_BEGIN_CONTOUR = 100152;
1428   public static final int GLU_TESS_MISSING_END_POLYGON = 100153;
1429   public static final int GLU_TESS_MISSING_END_CONTOUR = 100154;
1430   public static final int GLU_TESS_COORD_TOO_LARGE = 100155;
1431   public static final int GLU_TESS_NEED_COMBINE_CALLBACK = 100156;
1432 
1433   // TessWinding
1434   public static final int GLU_TESS_WINDING_ODD = 100130;
1435   public static final int GLU_TESS_WINDING_NONZERO = 100131;
1436   public static final int GLU_TESS_WINDING_POSITIVE = 100132;
1437   public static final int GLU_TESS_WINDING_NEGATIVE = 100133;
1438   public static final int GLU_TESS_WINDING_ABS_GEQ_TWO = 100134;
1439   public static final double GLU_TESS_MAX_COORD = 1.0e150;
1440 
copyToByteBuffer(java.nio.Buffer buf)1441   private java.nio.ByteBuffer copyToByteBuffer(java.nio.Buffer buf) {
1442     if (buf instanceof java.nio.ByteBuffer) {
1443       if (buf.position() == 0) {
1444         return (java.nio.ByteBuffer) buf;
1445       }
1446       return BufferUtil.copyByteBuffer((java.nio.ByteBuffer) buf);
1447     } else if (buf instanceof java.nio.ShortBuffer) {
1448       return BufferUtil.copyShortBufferAsByteBuffer((java.nio.ShortBuffer) buf);
1449     } else if (buf instanceof java.nio.IntBuffer) {
1450       return BufferUtil.copyIntBufferAsByteBuffer((java.nio.IntBuffer) buf);
1451     } else if (buf instanceof java.nio.FloatBuffer) {
1452       return BufferUtil.copyFloatBufferAsByteBuffer((java.nio.FloatBuffer) buf);
1453     } else {
1454       throw new IllegalArgumentException("Unsupported buffer type (must be one of byte, short, int, or float)");
1455     }
1456   }
1457 
gluScaleImageJava( int format, int widthin, int heightin, int typein, java.nio.Buffer datain, int widthout, int heightout, int typeout, java.nio.Buffer dataout )1458   private int gluScaleImageJava( int format, int widthin, int heightin,
1459                                  int typein, java.nio.Buffer datain, int widthout, int heightout,
1460                                  int typeout, java.nio.Buffer dataout ) {
1461     java.nio.ByteBuffer in = null;
1462     java.nio.ByteBuffer out = null;
1463     in = copyToByteBuffer(datain);
1464     if( dataout instanceof java.nio.ByteBuffer ) {
1465       out = (java.nio.ByteBuffer)dataout;
1466     } else if( dataout instanceof java.nio.ShortBuffer ) {
1467       out = BufferUtil.newByteBuffer(dataout.remaining() * BufferUtil.SIZEOF_SHORT);
1468     } else if ( dataout instanceof java.nio.IntBuffer ) {
1469       out = BufferUtil.newByteBuffer(dataout.remaining() * BufferUtil.SIZEOF_INT);
1470     } else if ( dataout instanceof java.nio.FloatBuffer ) {
1471       out = BufferUtil.newByteBuffer(dataout.remaining() * BufferUtil.SIZEOF_FLOAT);
1472     } else {
1473       throw new IllegalArgumentException("Unsupported destination buffer type (must be byte, short, int, or float)");
1474     }
1475     int errno = Mipmap.gluScaleImage( getCurrentGL(), format, widthin, heightin, typein, in,
1476               widthout, heightout, typeout, out );
1477     if( errno == 0 ) {
1478       out.rewind();
1479       if (out != dataout) {
1480         if( dataout instanceof java.nio.ShortBuffer ) {
1481           ((java.nio.ShortBuffer) dataout).put(out.asShortBuffer());
1482         } else if( dataout instanceof java.nio.IntBuffer ) {
1483           ((java.nio.IntBuffer) dataout).put(out.asIntBuffer());
1484         } else if( dataout instanceof java.nio.FloatBuffer ) {
1485           ((java.nio.FloatBuffer) dataout).put(out.asFloatBuffer());
1486         } else {
1487           throw new RuntimeException("Should not reach here");
1488         }
1489       }
1490     }
1491     return( errno );
1492   }
1493 
1494 
gluBuild1DMipmapLevelsJava( int target, int internalFormat, int width, int format, int type, int userLevel, int baseLevel, int maxLevel, java.nio.Buffer data )1495   private int gluBuild1DMipmapLevelsJava( int target, int internalFormat, int width,
1496                                           int format, int type, int userLevel, int baseLevel, int maxLevel,
1497                                           java.nio.Buffer data ) {
1498     java.nio.ByteBuffer buffer = copyToByteBuffer(data);
1499     return( Mipmap.gluBuild1DMipmapLevels( getCurrentGL(), target, internalFormat, width,
1500             format, type, userLevel, baseLevel, maxLevel, buffer ) );
1501   }
1502 
1503 
gluBuild1DMipmapsJava( int target, int internalFormat, int width, int format, int type, java.nio.Buffer data )1504   private int gluBuild1DMipmapsJava( int target, int internalFormat, int width,
1505                                      int format, int type, java.nio.Buffer data ) {
1506     java.nio.ByteBuffer buffer = copyToByteBuffer(data);
1507     return( Mipmap.gluBuild1DMipmaps( getCurrentGL(), target, internalFormat, width, format,
1508             type, buffer ) );
1509   }
1510 
1511 
gluBuild2DMipmapLevelsJava( int target, int internalFormat, int width, int height, int format, int type, int userLevel, int baseLevel, int maxLevel, java.nio.Buffer data )1512   private int gluBuild2DMipmapLevelsJava( int target, int internalFormat, int width,
1513                                           int height, int format, int type, int userLevel, int baseLevel,
1514                                           int maxLevel, java.nio.Buffer data ) {
1515     // While the code below handles other data types, it doesn't handle non-ByteBuffers
1516     data = copyToByteBuffer(data);
1517     return( Mipmap.gluBuild2DMipmapLevels( getCurrentGL(), target, internalFormat, width,
1518             height, format, type, userLevel, baseLevel, maxLevel, data ) );
1519   }
1520 
gluBuild2DMipmapsJava( int target, int internalFormat, int width, int height, int format, int type, java.nio.Buffer data )1521   private int gluBuild2DMipmapsJava( int target, int internalFormat, int width,
1522                                      int height, int format, int type, java.nio.Buffer data ) {
1523     // While the code below handles other data types, it doesn't handle non-ByteBuffers
1524     data = copyToByteBuffer(data);
1525     return( Mipmap.gluBuild2DMipmaps( getCurrentGL(), target, internalFormat, width, height,
1526             format, type, data) );
1527   }
1528 
gluBuild3DMipmapLevelsJava( int target, int internalFormat, int width, int height, int depth, int format, int type, int userLevel, int baseLevel, int maxLevel, java.nio.Buffer data)1529   private int gluBuild3DMipmapLevelsJava( int target, int internalFormat, int width,
1530                                           int height, int depth, int format, int type, int userLevel, int baseLevel,
1531                                           int maxLevel, java.nio.Buffer data) {
1532     java.nio.ByteBuffer buffer = copyToByteBuffer(data);
1533     return( Mipmap.gluBuild3DMipmapLevels( getCurrentGL(), target, internalFormat, width,
1534             height, depth, format, type, userLevel, baseLevel, maxLevel, buffer) );
1535   }
1536 
gluBuild3DMipmapsJava( int target, int internalFormat, int width, int height, int depth, int format, int type, java.nio.Buffer data )1537   private int gluBuild3DMipmapsJava( int target, int internalFormat, int width,
1538                                      int height, int depth, int format, int type, java.nio.Buffer data ) {
1539     java.nio.ByteBuffer buffer = copyToByteBuffer(data);
1540     return( Mipmap.gluBuild3DMipmaps( getCurrentGL(), target, internalFormat, width, height,
1541             depth, format, type, buffer ) );
1542   }
1543 
1544 
1545   //----------------------------------------------------------------------
1546   // Wrappers for mipmap and image scaling entry points which dispatch either
1547   // to the Java or C versions.
1548   //
1549 
1550   /** Interface to C language function: <br> <code> GLint gluBuild1DMipmapLevels(GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *  data); </code>    */
gluBuild1DMipmapLevels(int target, int internalFormat, int width, int format, int type, int level, int base, int max, java.nio.Buffer data)1551   public int gluBuild1DMipmapLevels(int target, int internalFormat, int width, int format, int type, int level, int base, int max, java.nio.Buffer data) {
1552     if (useJavaMipmapCode) {
1553       return gluBuild1DMipmapLevelsJava(target, internalFormat, width, format, type, level, base, max, data);
1554     } else {
1555       return gluBuild1DMipmapLevelsC(target, internalFormat, width, format, type, level, base, max, data);
1556     }
1557   }
1558 
1559   /** Interface to C language function: <br> <code> GLint gluBuild1DMipmaps(GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const void *  data); </code>    */
gluBuild1DMipmaps(int target, int internalFormat, int width, int format, int type, java.nio.Buffer data)1560   public int gluBuild1DMipmaps(int target, int internalFormat, int width, int format, int type, java.nio.Buffer data) {
1561     if (useJavaMipmapCode) {
1562       return gluBuild1DMipmapsJava(target, internalFormat, width, format, type, data);
1563     } else {
1564       return gluBuild1DMipmapsC(target, internalFormat, width, format, type, data);
1565     }
1566   }
1567 
1568   /** Interface to C language function: <br> <code> GLint gluBuild2DMipmapLevels(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *  data); </code>    */
gluBuild2DMipmapLevels(int target, int internalFormat, int width, int height, int format, int type, int level, int base, int max, java.nio.Buffer data)1569   public int gluBuild2DMipmapLevels(int target, int internalFormat, int width, int height, int format, int type, int level, int base, int max, java.nio.Buffer data) {
1570     if (useJavaMipmapCode) {
1571       return gluBuild2DMipmapLevelsJava(target, internalFormat, width, height, format, type, level, base, max, data);
1572     } else {
1573       return gluBuild2DMipmapLevelsC(target, internalFormat, width, height, format, type, level, base, max, data);
1574     }
1575   }
1576 
1577 
1578   /** Interface to C language function: <br> <code> GLint gluBuild2DMipmaps(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *  data); </code>    */
gluBuild2DMipmaps(int target, int internalFormat, int width, int height, int format, int type, java.nio.Buffer data)1579   public int gluBuild2DMipmaps(int target, int internalFormat, int width, int height, int format, int type, java.nio.Buffer data) {
1580     if (useJavaMipmapCode) {
1581       return gluBuild2DMipmapsJava(target, internalFormat, width, height, format, type, data);
1582     } else {
1583       return gluBuild2DMipmapsC(target, internalFormat, width, height, format, type, data);
1584     }
1585   }
1586 
1587 
1588   /** Interface to C language function: <br> <code> GLint gluBuild3DMipmapLevels(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *  data); </code>    */
gluBuild3DMipmapLevels(int target, int internalFormat, int width, int height, int depth, int format, int type, int level, int base, int max, java.nio.Buffer data)1589   public int gluBuild3DMipmapLevels(int target, int internalFormat, int width, int height, int depth, int format, int type, int level, int base, int max, java.nio.Buffer data) {
1590     if (useJavaMipmapCode) {
1591       return gluBuild3DMipmapLevelsJava(target, internalFormat, width, height, depth, format, type, level, base, max, data);
1592     } else {
1593       return gluBuild3DMipmapLevelsC(target, internalFormat, width, height, depth, format, type, level, base, max, data);
1594     }
1595   }
1596 
1597   /** Interface to C language function: <br> <code> GLint gluBuild3DMipmaps(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *  data); </code>    */
gluBuild3DMipmaps(int target, int internalFormat, int width, int height, int depth, int format, int type, java.nio.Buffer data)1598   public int gluBuild3DMipmaps(int target, int internalFormat, int width, int height, int depth, int format, int type, java.nio.Buffer data) {
1599     if (useJavaMipmapCode) {
1600       return gluBuild3DMipmapsJava(target, internalFormat, width, height, depth, format, type, data);
1601     } else {
1602       return gluBuild3DMipmapsC(target, internalFormat, width, height, depth, format, type, data);
1603     }
1604   }
1605 
1606 
1607   /** Interface to C language function: <br> <code> GLint gluScaleImage(GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *  dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid *  dataOut); </code>    */
gluScaleImage(int format, int wIn, int hIn, int typeIn, java.nio.Buffer dataIn, int wOut, int hOut, int typeOut, java.nio.Buffer dataOut)1608   public int gluScaleImage(int format, int wIn, int hIn, int typeIn, java.nio.Buffer dataIn, int wOut, int hOut, int typeOut, java.nio.Buffer dataOut) {
1609     if (useJavaMipmapCode) {
1610       return gluScaleImageJava(format, wIn, hIn, typeIn, dataIn, wOut, hOut, typeOut, dataOut);
1611     } else {
1612       return gluScaleImageC(format, wIn, hIn, typeIn, dataIn, wOut, hOut, typeOut, dataOut);
1613     }
1614   }
1615 
1616   //----------------------------------------------------------------------
1617   // NURBS functionality
1618   //
1619 
1620   /**
1621    * Sets a property on a NURBS object. (NOTE: this function is not currently implemented.)
1622    *
1623    * @param r
1624    *            GLUnurbs object holding NURBS to which a property should be
1625    *            set
1626    * @param property
1627    *            property id
1628    * @param value
1629    *            property value
1630    */
gluNurbsProperty(GLUnurbs r, int property, float value)1631   public void gluNurbsProperty(GLUnurbs r, int property, float value) {
1632     // TODO glunurbsproperty
1633     float nurbsValue;
1634     switch (property) {
1635     default:
1636       //				System.out.println("TODO gluwnurbs.glunurbsproperty");
1637       break;
1638     }
1639   }
1640 
1641   /**
1642    * Creates a new GLUnurbs object.
1643    *
1644    * @return GLUnurbs object
1645    */
gluNewNurbsRenderer()1646   public GLUnurbs gluNewNurbsRenderer() {
1647     // DONE
1648     return new GLUnurbsImpl();
1649   }
1650 
1651   /**
1652    * Begins a curve definition.
1653    *
1654    * @param r
1655    *            GLUnurbs object to specify curve to
1656    */
gluBeginCurve(GLUnurbs r)1657   public void gluBeginCurve(GLUnurbs r) {
1658     // DONE
1659     ((GLUnurbsImpl) r).bgncurve();
1660   }
1661 
1662   /**
1663    * Begins a surface definition.
1664    *
1665    * @param r
1666    *            GLUnurbs object to specify surface to
1667    */
gluBeginSurface(GLUnurbs r)1668   public void gluBeginSurface(GLUnurbs r) {
1669     // DONE
1670     ((GLUnurbsImpl) r).bgnsurface();
1671   }
1672 
1673   /**
1674    * Ends a surface.
1675    *
1676    * @param r
1677    *            GLUnurbs object holding surface
1678    */
gluEndSurface(GLUnurbs r)1679   public void gluEndSurface(GLUnurbs r) {
1680     // DONE
1681     ((GLUnurbsImpl) r).endsurface();
1682   }
1683 
1684   /**
1685    * Makes a NURBS surface.
1686    *
1687    * @param r
1688    *            GLUnurbs object holding the surface
1689    * @param sknot_count
1690    *            number of knots in s direction
1691    * @param sknot
1692    *            knots in s direction
1693    * @param tknot_count
1694    *            number of knots in t direction
1695    * @param tknot
1696    *            knots in t direction
1697    * @param s_stride
1698    *            number of control points coordinates in s direction
1699    * @param t_stride
1700    *            number of control points coordinates in t direction
1701    * @param ctlarray
1702    *            control points
1703    * @param sorder
1704    *            order of surface in s direction
1705    * @param torder
1706    *            order of surface in t direction
1707    * @param type
1708    *            surface type
1709    */
gluNurbsSurface(GLUnurbs r, int sknot_count, float[] sknot, int tknot_count, float[] tknot, int s_stride, int t_stride, float[] ctlarray, int sorder, int torder, int type)1710   public void gluNurbsSurface(GLUnurbs r, int sknot_count, float[] sknot,
1711                               int tknot_count, float[] tknot, int s_stride, int t_stride,
1712                               float[] ctlarray, int sorder, int torder, int type) {
1713     // DONE
1714     ((GLUnurbsImpl) r).nurbssurface(sknot_count, sknot, tknot_count, tknot, s_stride,
1715                                     t_stride, ctlarray, sorder, torder, type);
1716   }
1717 
1718   /**
1719    * Make a NURBS curve.
1720    *
1721    * @param r
1722    *            GLUnurbs object holding the curve
1723    * @param nknots
1724    *            number of knots
1725    * @param knot
1726    *            knot vector
1727    * @param stride
1728    *            number of control point coordinates
1729    * @param ctlarray
1730    *            control points
1731    * @param order
1732    *            order of the curve
1733    * @param type
1734    *            curve type
1735    */
gluNurbsCurve(GLUnurbs r, int nknots, float[] knot, int stride, float[] ctlarray, int order, int type)1736   public void gluNurbsCurve(GLUnurbs r, int nknots, float[] knot, int stride,
1737                             float[] ctlarray, int order, int type) {
1738     int realType;
1739     switch (type) {
1740       // TODO GLU_MAP1_TRIM_2 etc.
1741     default:
1742       realType = type;
1743       break;
1744     }
1745     ((GLUnurbsImpl) r).nurbscurve(nknots, knot, stride, ctlarray, order, realType);
1746   }
1747 
1748   /**
1749    * Ends a curve definition.
1750    *
1751    * @param r
1752    *            GLUnurbs object holding the curve
1753    */
gluEndCurve(GLUnurbs r)1754   public void gluEndCurve(GLUnurbs r) {
1755     //DONE
1756     ((GLUnurbsImpl) r).endcurve();
1757   }
1758 
1759   //----------------------------------------------------------------------
1760   // GLUProcAddressTable handling
1761   //
1762 
1763   private static GLUProcAddressTable gluProcAddressTable;
1764   private static volatile boolean gluLibraryLoaded;
1765 
getGLUProcAddressTable()1766   private static GLUProcAddressTable getGLUProcAddressTable() {
1767     if (!gluLibraryLoaded) {
1768       loadGLULibrary();
1769     }
1770     if (gluProcAddressTable == null) {
1771       GLUProcAddressTable tmp = new GLUProcAddressTable();
1772       ProcAddressHelper.resetProcAddressTable(tmp, GLDrawableFactoryImpl.getFactoryImpl());
1773       gluProcAddressTable = tmp;
1774     }
1775     return gluProcAddressTable;
1776   }
1777 
loadGLULibrary()1778   private static synchronized void loadGLULibrary() {
1779     if (!gluLibraryLoaded) {
1780       GLDrawableFactoryImpl.getFactoryImpl().loadGLULibrary();
1781       gluLibraryLoaded = true;
1782     }
1783   }
1784   // ---- End CustomJavaCode .cfg declarations
1785 
1786 } // end of class GLU
1787