Hi, the gluUnproject funktion does not create the right values, only 0.0.
i dont know why. Can somebody take a look at my code pls.
this is the part of the draw funktion:
public void draw(GLDrawable drawable){
GL gl = drawable.getGL();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glLoadIdentity();
double[] mvMatrix = new double[16];
double[] projection = new double[16];
int[] viewport = new int[4];
double[] objx = new double[1];
double[] objy = new double[1];
double[] objz = new double[1];
int realY;
gl.glGetDoublev(GL.GL_MODELVIEW, mvMatrix);
for (int i = 0; i < mvMatrix.length; i++){
System.out.println("mvmatrix: "+mvMatrix[i]);
}
gl.glGetDoublev(GL.GL_PROJECTION, projection);
gl.glGetIntegerv(GL.GL_VIEWPORT, viewport);
realY = viewport[3] - mouseY - 1 ;
glu.gluUnProject((double)mouseX, (double)realY, 0.0, mvMatrix, projection, viewport, objx, objy, objz);
System.out.println("this is it: "+objx[0]+","+objy[0]+","+objz[0]);
// drawing just a cube
this.geoobj.drawFromPrimitives();
gl.glFlush();
}
the Mousevalues comes from the mouselistener…