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