4package com.jogamp.opengl.glu;
6import jogamp.opengl.glu.error.Error;
7import jogamp.opengl.glu.registry.Registry;
8import com.jogamp.opengl.*;
9import com.jogamp.opengl.glu.*;
10import com.jogamp.opengl.util.glsl.ShaderState;
11import jogamp.opengl.*;
12import jogamp.opengl.glu.*;
13import jogamp.opengl.glu.tessellator.GLUtessellatorImpl;
14import jogamp.opengl.ProjectFloat;
15import com.jogamp.common.util.ReflectionUtil;
16import java.lang.reflect.*;
17import com.jogamp.gluegen.runtime.*;
18import com.jogamp.common.os.*;
19import com.jogamp.common.nio.*;
21import com.jogamp.common.util.*;
24import java.util.HashMap;
25import java.nio.charset.Charset;
26import java.nio.charset.StandardCharsets;
124 private static final Class gl2Class;
125 private static final Class gl2es1Class;
128 Class _gl2Class=
null;
129 Class _gl2es1Class=
null;
131 final ClassLoader cl =
GLU.class.getClassLoader();
132 _gl2Class = Class.forName(
"com.jogamp.opengl.glu.gl2.GLUgl2",
false, cl);
133 _gl2es1Class = Class.forName(
"com.jogamp.opengl.glu.gl2es1.GLUgl2es1",
false, cl);
134 }
catch (Throwable t) {}
135 gl2Class = _gl2Class;
136 gl2es1Class = _gl2es1Class;
158 if(gl.isGL2() &&
null!=gl2Class) {
160 }
else if(gl.isGL2ES1() &&
null!=gl2es1Class) {
168 return (
GLU) c.newInstance();
169 }
catch (Exception e) {
176 project =
new ProjectFloat();
181 if (curContext ==
null) {
182 throw new GLException(
"No OpenGL context current on this thread");
184 return curContext.
getGL();
188 return Error.gluErrorString(errorCode);
199 return Registry.gluCheckExtension(extName, extString);
203 return Registry.gluGetString(name);
219 throw new GLException(
"GLUtessellator not available (GLUtessellatorImpl)");
239 return GLUtessellatorImpl.gluNewTess();
257 GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
258 tess.gluDeleteTess();
342 GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
343 tess.gluTessProperty(which, value);
371 GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
372 tess.gluGetTessProperty(which, value, value_offset);
413 GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
414 tess.gluTessNormal(x, y, z);
699 GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
700 tess.gluTessCallback(which, aCallback);
740 GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
741 tess.gluTessVertex(coords, coords_offset, data);
791 GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
792 tess.gluTessBeginPolygon(data);
826 GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
827 tess.gluTessBeginContour();
861 GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
862 tess.gluTessEndContour();
902 GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
903 tess.gluTessEndPolygon();
939 GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
940 tess.gluBeginPolygon();
1013 GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
1014 tess.gluNextContour(type);
1049 GLUtessellatorImpl tess = (GLUtessellatorImpl) tessellator;
1050 tess.gluEndPolygon();
1064 "GLU_EXT_object_space_tess ";
1272 throw new GLException(
"GLUquadric not available (GLUquadricImpl)");
1280 ((GLUquadricImpl) quad).drawCylinder(
getCurrentGL(), (float) base, (
float) top, (float) height, slices, stacks);
1291 ((GLUquadricImpl) quad).drawDisk(
getCurrentGL(), (float) inner, (
float) outer, slices, loops);
1310 throw new GLException(
"GLUquadric GLSL implementation not supported for profile: "+gl);
1313 return new GLUquadricImpl(gl, useGLSL, st, shaderProgram);
1319 ((GLUquadricImpl) quad).drawPartialDisk(
getCurrentGL(), (float) inner, (
float) outer, slices, loops, (float) start, (
float) sweep);
1325 ((GLUquadricImpl) quad).setDrawStyle(draw);
1331 ((GLUquadricImpl) quad).setNormals(normal);
1337 ((GLUquadricImpl) quad).setOrientation(orientation);
1343 ((GLUquadricImpl) quad).setTextureFlag(texture);
1349 ((GLUquadricImpl) quad).drawSphere(
getCurrentGL(), (float) radius, slices, stacks);
1356 private final ProjectFloat project;
1358 public void gluOrtho2D(
float left,
float right,
float bottom,
float top) {
1359 project.gluOrtho2D(
getCurrentGL().getGL2ES1(), left, right, bottom, top);
1363 project.gluPerspective(
getCurrentGL().getGL2ES1(), fovy, aspect, zNear, zFar);
1366 public void gluLookAt(
float eyeX,
float eyeY,
float eyeZ,
float centerX,
float centerY,
float centerZ,
float upX,
float upY,
float upZ) {
1367 project.gluLookAt(
getCurrentGL().getGL2ES1(), eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ);
1373 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) {
1374 return project.gluProject(objX, objY, objZ, model, model_offset, proj, proj_offset, view, view_offset, winPos, winPos_offset);
1380 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) {
1381 return project.gluProject(objX, objY, objZ, model, proj, view, winPos);
1387 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) {
1388 return project.gluUnProject(winX, winY, winZ, model, model_offset, proj, proj_offset, view, view_offset, objPos, objPos_offset);
1394 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) {
1395 return project.gluUnProject(winX, winY, winZ, model, proj, view, objPos);
1401 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) {
1402 return project.gluUnProject4(winX, winY, winZ, clipW, model, model_offset, proj, proj_offset, view, view_offset, nearVal, farVal, objPos, objPos_offset);
1408 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) {
1409 return project.gluUnProject4(winX, winY, winZ, clipW, model, proj, view, nearVal, farVal, objPos);
1412 public void gluPickMatrix(
float x,
float y,
float delX,
float delY,
int[] viewport,
int viewport_offset) {
1413 project.gluPickMatrix(
getCurrentGL().getGL2ES1(), x, y, delX, delY, viewport, viewport_offset);
1416 public void gluPickMatrix(
float x,
float y,
float delX,
float delY, java.nio.IntBuffer viewport) {
1417 project.gluPickMatrix(
getCurrentGL().getGL2ES1(), x, y, delX, delY, viewport);
1420 public void gluOrtho2D(
double left,
double right,
double bottom,
double top) {
1421 project.gluOrtho2D(
getCurrentGL().getGL2ES1(), (
float)left, (
float)right, (
float)bottom, (
float)top);
1425 project.gluPerspective(
getCurrentGL().getGL2ES1(), (
float)fovy, (
float)aspect, (
float)zNear, (
float)zFar);
1428 public void gluLookAt(
double eyeX,
double eyeY,
double eyeZ,
double centerX,
double centerY,
double centerZ,
double upX,
double upY,
double upZ) {
1429 project.gluLookAt(
getCurrentGL().getGL2ES1(), (
float)eyeX, (
float)eyeY, (
float)eyeZ, (
float)centerX, (
float)centerY, (
float)centerZ, (
float)upX, (
float)upY, (
float)upZ);
1435 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) {
1436 float[] f_model = Buffers.getFloatArray(model, model_offset,
null, 0, -1);
1437 float[] f_proj = Buffers.getFloatArray(proj, proj_offset,
null, 0, -1);
1438 float[] f_winPos = Buffers.getFloatArray(winPos, winPos_offset,
null, 0, -1);
1439 boolean res = project.gluProject((
float)objX, (
float)objY, (
float)objZ, f_model, 0, f_proj, 0, view, view_offset, f_winPos, 0);
1441 Buffers.getDoubleArray(f_model, 0, model, model_offset, -1);
1442 Buffers.getDoubleArray(f_proj, 0, proj, proj_offset, -1);
1443 Buffers.getDoubleArray(f_winPos, 0, winPos, winPos_offset, -1);
1451 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) {
1452 float[] f_model = Buffers.getFloatArray(model, model_offset,
null, 0, -1);
1453 float[] f_proj = Buffers.getFloatArray(proj, proj_offset,
null, 0, -1);
1454 float[] f_objPos = Buffers.getFloatArray(objPos, objPos_offset,
null, 0, -1);
1455 boolean res = project.gluUnProject((
float)winX, (
float)winY, (
float)winZ, f_model, 0, f_proj, 0, view, view_offset, f_objPos, 0);
1457 Buffers.getDoubleArray(f_model, 0, model, model_offset, -1);
1458 Buffers.getDoubleArray(f_proj, 0, proj, proj_offset, -1);
1459 Buffers.getDoubleArray(f_objPos, 0, objPos, objPos_offset, -1);
1467 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) {
1468 float[] f_model = Buffers.getFloatArray(model, model_offset,
null, 0, -1);
1469 float[] f_proj = Buffers.getFloatArray(proj, proj_offset,
null, 0, -1);
1470 float[] f_objPos = Buffers.getFloatArray(objPos, objPos_offset,
null, 0, -1);
1471 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);
1473 Buffers.getDoubleArray(f_model, 0, model, model_offset, -1);
1474 Buffers.getDoubleArray(f_proj, 0, proj, proj_offset, -1);
1475 Buffers.getDoubleArray(f_objPos, 0, objPos, objPos_offset, -1);
1480 public void gluPickMatrix(
double x,
double y,
double delX,
double delY,
int[] viewport,
int viewport_offset) {
1481 project.gluPickMatrix(
getCurrentGL().getGL2ES1(), (
float)x, (
float)y, (
float)delX, (
float)delY, viewport, viewport_offset);
1484 public void gluPickMatrix(
double x,
double y,
double delX,
double delY, IntBuffer viewport) {
1485 project.gluPickMatrix(
getCurrentGL().getGL2ES1(), (
float)x, (
float)y, (
float)delX, (
float)delY, viewport);
1492 int typein, java.nio.Buffer datain,
int widthout,
int heightout,
1493 int typeout, java.nio.Buffer dataout ) {
1501 int format,
int type,
int userLevel,
int baseLevel,
int maxLevel,
1502 java.nio.Buffer data ) {
1509 int format,
int type, java.nio.Buffer data ) {
1517 int height,
int format,
int type,
int userLevel,
int baseLevel,
1518 int maxLevel, java.nio.Buffer data ) {
1526 int height,
int format,
int type, java.nio.Buffer data ) {
1534 int height,
int depth,
int format,
int type,
int userLevel,
int baseLevel,
1535 int maxLevel, java.nio.Buffer data) {
1543 int height,
int depth,
int format,
int type, java.nio.Buffer data ) {
Abstraction for an OpenGL rendering context.
static GLContext getCurrent()
Returns this thread current context.
abstract GL getGL()
Returns the GL pipeline object for this GLContext.
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
Provides access to the OpenGL Utility Library (GLU).
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)
Interface to C language function: GLint gluUnProject4(GLdouble winX, GLdouble winY,...
static boolean availableGLUquadricImpl
static final void gluEndPolygon(GLUtessellator tessellator)
static final int GLU_TESS_NEED_COMBINE_CALLBACK
int gluBuild2DMipmaps(int target, int internalFormat, int width, int height, int format, int type, java.nio.Buffer data)
Optional, throws GLException if not available in profile.
static final int GLU_EDGE_FLAG
static final void gluGetTessProperty(GLUtessellator tessellator, int which, double[] value, int value_offset)
static final int GLU_TESS_ERROR
static final int GLU_TESS_COORD_TOO_LARGE
static final int GLU_FILL
static final void gluTessBeginPolygon(GLUtessellator tessellator, Object data)
static final int GLU_TESS_ERROR4
int gluBuild1DMipmapLevels(int target, int internalFormat, int width, int format, int type, int userLevel, int baseLevel, int maxLevel, java.nio.Buffer data)
Optional, throws GLException if not available in profile.
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)
Interface to C language function: GLint gluProject(GLdouble objX, GLdouble objY,...
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)
Interface to C language function: GLint gluUnProject(GLdouble winX, GLdouble winY,...
final boolean gluCheckExtension(java.lang.String extName, java.lang.String extString)
static final int GLU_SMOOTH
static final GL getCurrentGL()
static final int GLU_OUTSIDE
boolean gluUnProject(float winX, float winY, float winZ, java.nio.FloatBuffer model, java.nio.FloatBuffer proj, java.nio.IntBuffer view, java.nio.FloatBuffer objPos)
Interface to C language function: GLint gluUnProject(GLdouble winX, GLdouble winY,...
static final int GLU_TESS_WINDING_RULE
static final int GLU_TRUE
static final GLUtessellator gluNewTess()
void gluOrtho2D(double left, double right, double bottom, double top)
final GLUquadric gluNewQuadric(boolean useGLSL, ShaderState st)
static final void gluNextContour(GLUtessellator tessellator, int type)
void gluPickMatrix(float x, float y, float delX, float delY, java.nio.IntBuffer viewport)
static final int GLU_TESS_VERTEX
static final int GLU_ERROR
static final int GLU_TESS_ERROR3
static volatile Object syncObject
final GLUquadric gluNewQuadric(boolean useGLSL, int shaderProgram)
static final int GLU_TESS_ERROR_DATA
static final int GLU_VERTEX
static boolean checkedGLUquadricImpl
static final int GLU_TESS_ERROR8
final void gluQuadricNormals(GLUquadric quad, int normal)
Option (throws GLException if not available in profile).
static final int GLU_EXTERIOR
static final int GLU_INSIDE
final void gluQuadricOrientation(GLUquadric quad, int orientation)
Option (throws GLException if not available in profile).
final GLUquadric gluNewQuadric()
Option (throws GLException if not available in profile).
static final int GLU_TESS_ERROR6
static final int GLU_TESS_WINDING_NEGATIVE
void gluPickMatrix(float x, float y, float delX, float delY, int[] viewport, int viewport_offset)
final String gluGetString(int name)
void gluPickMatrix(double x, double y, double delX, double delY, IntBuffer viewport)
static final int GLU_TESS_EDGE_FLAG_DATA
static final void gluTessEndPolygon(GLUtessellator tessellator)
static final int GLU_TESS_AVOID_DEGENERATE_TRIANGLES
static final int GLU_TESS_BEGIN
static final int GLU_TESS_VERTEX_DATA
final void gluQuadricTexture(GLUquadric quad, boolean texture)
Option (throws GLException if not available in profile).
static final void gluTessVertex(GLUtessellator tessellator, double[] coords, int coords_offset, Object data)
void gluPerspective(double fovy, double aspect, double zNear, double zFar)
static final int GLU_TESS_ERROR2
static final String versionString
static final int GLU_INVALID_ENUM
static final void gluTessCallback(GLUtessellator tessellator, int which, GLUtessellatorCallback aCallback)
static final int GLU_TESS_ERROR1
static final int GLU_FLAT
static final int GLU_EXTENSIONS
final void gluCylinder(GLUquadric quad, double base, double top, double height, int slices, int stacks)
Option (throws GLException if not available in profile).
void gluPickMatrix(double x, double y, double delX, double delY, int[] viewport, int viewport_offset)
boolean gluProject(float objX, float objY, float objZ, java.nio.FloatBuffer model, java.nio.FloatBuffer proj, java.nio.IntBuffer view, java.nio.FloatBuffer winPos)
Interface to C language function: GLint gluProject(GLdouble objX, GLdouble objY,...
static final int GLU_INTERIOR
static final void gluDeleteTess(GLUtessellator tessellator)
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)
Interface to C language function: GLint gluUnProject(GLdouble winX, GLdouble winY,...
static final int GLU_TESS_WINDING_ODD
static final int GLU_TESS_WINDING_POSITIVE
int gluBuild3DMipmaps(int target, int internalFormat, int width, int height, int depth, int format, int type, java.nio.Buffer data)
Optional, throws GLException if not available in profile.
static final int GLU_TESS_BEGIN_DATA
int gluBuild2DMipmapLevels(int target, int internalFormat, int width, int height, int format, int type, int userLevel, int baseLevel, int maxLevel, java.nio.Buffer data)
Optional, throws GLException if not available in profile.
static final void gluTessBeginContour(GLUtessellator tessellator)
final void gluPartialDisk(GLUquadric quad, double inner, double outer, int slices, int loops, double start, double sweep)
Option (throws GLException if not available in profile).
static final int GLU_FALSE
static final int GLU_TESS_WINDING_NONZERO
static boolean availableGLUtessellatorImpl
static final int GLU_TESS_ERROR5
static final int GLU_TESS_MISSING_END_POLYGON
static final int GLU_TESS_ERROR7
static final int GLU_TESS_MISSING_BEGIN_CONTOUR
static final int GLU_OUT_OF_MEMORY
static final int GLU_UNKNOWN
static final int GLU_TESS_TOLERANCE
static final int GLU_INVALID_OPERATION
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)
Interface to C language function: GLint gluProject(GLdouble objX, GLdouble objY,...
final void gluQuadricDrawStyle(GLUquadric quad, int draw)
Option (throws GLException if not available in profile).
int gluScaleImage(int format, int widthin, int heightin, int typein, java.nio.Buffer datain, int widthout, int heightout, int typeout, java.nio.Buffer dataout)
Optional, throws GLException if not available in profile.
static final void gluTessEndContour(GLUtessellator tessellator)
void gluLookAt(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ)
final void gluSphere(GLUquadric quad, double radius, int slices, int stacks)
Option (throws GLException if not available in profile).
static final void gluBeginPolygon(GLUtessellator tessellator)
static final GLU createGLU()
Instantiates a GLU implementation object in respect to the given GL profile of this thread current GL...
static final int GLU_LINE
void gluLookAt(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ)
static final int GLU_TESS_WINDING_ABS_GEQ_TWO
static final void validateGLUtessellatorImpl()
static final void validateGLUquadricImpl()
Optional, throws GLException if not available in profile.
static boolean checkedGLUtessellatorImpl
static final int GLU_TESS_END
final void gluDisk(GLUquadric quad, double inner, double outer, int slices, int loops)
Option (throws GLException if not available in profile).
static final int GLU_TESS_BOUNDARY_ONLY
final String gluErrorString(int errorCode)
static final void gluTessNormal(GLUtessellator tessellator, double x, double y, double z)
int 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)
Optional, throws GLException if not available in profile.
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)
Interface to C language function: GLint gluUnProject4(GLdouble winX, GLdouble winY,...
static final int GLU_TESS_END_DATA
static final int GLU_POINT
static final int GLU_TESS_COMBINE_DATA
static final int GLU_TESS_EDGE_FLAG
static final String extensionString
static final int GLU_INVALID_VALUE
static final int GLU_TESS_MISSING_BEGIN_POLYGON
void gluPerspective(float fovy, float aspect, float zNear, float zFar)
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)
Interface to C language function: GLint gluUnProject4(GLdouble winX, GLdouble winY,...
final void gluDeleteQuadric(GLUquadric quad)
Option (throws GLException if not available in profile).
static final int GLU_SILHOUETTE
static final int GLU_TESS_COMBINE
static final int GLU_TESS_MISSING_END_CONTOUR
static final void gluTessProperty(GLUtessellator tessellator, int which, double value)
static final double GLU_TESS_MAX_COORD
int gluBuild1DMipmaps(int target, int internalFormat, int width, int format, int type, java.nio.Buffer data)
Optional, throws GLException if not available in profile.
static final int GLU_VERSION
void gluOrtho2D(float left, float right, float bottom, float top)
boolean isFunctionAvailable(String gluFunctionName)
Returns true if the specified GLU core- or extension-function can be successfully used through this G...
static final GLU createGLU(GL gl)
Instantiates a GLU implementation object in respect to the given GL profile of the given GL.
static final int GLU_NONE
static final int GLU_BEGIN
ShaderState allows to sharing data between shader programs, while updating the attribute and uniform ...
boolean isGL2ES2()
Indicates whether this GL object conforms to a GL2ES2 compatible profile.
Wrapper for a GLU quadric object.
GLUtessellatorCallback interface provides methods that the user will override to define the callbacks...
The GLUtessellator object is used to hold the data, such as the vertices, edges and callback objects,...