29package com.jogamp.opengl.test.junit.math;
31import com.jogamp.junit.util.JunitTracer;
32import com.jogamp.opengl.glu.GLU;
34import org.junit.Assert;
36import org.junit.FixMethodOrder;
37import org.junit.runners.MethodSorters;
39@FixMethodOrder(MethodSorters.NAME_ASCENDING)
45 final int[] pickedPoint =
new int[]{400,300};
46 final float pickedPointDepth = 0;
47 final float[] sceneModelViewValues =
new float[]{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1};
48 final float[] projectionValues =
new float[]{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1};
49 final int[] viewport =
new int[]{0,0,800,600};
50 final float[] objCoords =
new float[]{Float.NaN,Float.NaN,Float.NaN};
51 glu.
gluUnProject(pickedPoint[0], pickedPoint[1], pickedPointDepth, sceneModelViewValues, 0, projectionValues, 0, viewport, 0, objCoords, 0);
52 Assert.assertTrue(!Double.isNaN(objCoords[0])&&!Double.isNaN(objCoords[1])&&!Double.isNaN(objCoords[2]));
57 final float[] mv =
new float[] { 1, 0, 0, 0,
62 final float[] p =
new float[] { 2.3464675f, 0, 0, 0,
67 final int[] v =
new int[] { 0, 0, 1000, 1000 };
69 final float[] s =
new float[] { 250, 250, 0.5f };
71 final float[] expected =
new float[] { -4.2612f, -4.1417f, -19.9980f };
72 final float[] result =
new float[] { 0, 0, 0 };
75 glu.
gluUnProject(s[0], s[1], s[2], mv, 0, p, 0, v, 0, result, 0);
77 Assert.assertArrayEquals(expected, result, 0.0001f);
82 final float[] mv =
new float[] { 1, 0, 0, 0,
87 final float[] p =
new float[] { 2.3464675f, 0, 0, 0,
92 final int[] v =
new int[] { 0, 0, 1000, 1000 };
94 final float[] s =
new float[] { 250, 250, 0.5f };
95 final float[] expected =
new float[] { -4.2612f, -4.1417f, 180.002f };
96 final float[] result =
new float[] { 0, 0, 0 };
99 glu.
gluUnProject(s[0], s[1], s[2], mv, 0, p, 0, v, 0, result, 0);
101 Assert.assertArrayEquals(expected, result, 0.0001f);
104 public static void main(
final String args[]) {
Provides access to the OpenGL Utility Library (GLU).
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 void main(final String args[])