Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7635/src/net/sourceforge/bprocessor/gl/view
Modified Files:
AbstractView.java View3D.java Transformation.java
Log Message:
Projecting from model coordinates to screen coordinates is working
Index: AbstractView.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** AbstractView.java 26 Aug 2005 14:48:15 -0000 1.12
--- AbstractView.java 30 Aug 2005 08:22:35 -0000 1.13
***************
*** 113,117 ****
/** The viewport used for rendering the scene */
! protected int[] viewport = new int[4];
/** The x-coordinate of last selection */
--- 113,117 ----
/** The viewport used for rendering the scene */
! protected int[] screenport = new int[4];
/** The x-coordinate of last selection */
Index: View3D.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View3D.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** View3D.java 26 Aug 2005 14:48:15 -0000 1.8
--- View3D.java 30 Aug 2005 08:22:35 -0000 1.9
***************
*** 76,84 ****
gl.glRotated(rotationZ, 0.0, 0.0, 1.0);
!
! gl.glGetDoublev(GL.GL_MODELVIEW_MATRIX, modelMatrix);
! gl.glGetDoublev(GL.GL_PROJECTION_MATRIX, projMatrix);
! gl.glGetIntegerv(GL.GL_VIEWPORT, viewport);
!
}
--- 76,84 ----
gl.glRotated(rotationZ, 0.0, 0.0, 1.0);
! if (picking == 0) {
! gl.glGetDoublev(GL.GL_MODELVIEW_MATRIX, modelMatrix);
! gl.glGetDoublev(GL.GL_PROJECTION_MATRIX, projMatrix);
! gl.glGetIntegerv(GL.GL_VIEWPORT, screenport);
! }
}
***************
*** 172,176 ****
*/
public Transformation transformation() {
! return new Transformation(glu, modelMatrix, projMatrix, viewport);
}
--- 172,176 ----
*/
public Transformation transformation() {
! return new Transformation(glu, modelMatrix, projMatrix, screenport);
}
Index: Transformation.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Transformation.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Transformation.java 26 Aug 2005 14:48:15 -0000 1.1
--- Transformation.java 30 Aug 2005 08:22:35 -0000 1.2
***************
*** 106,110 ****
double z = vertex.getZ();
double[] view = new double[3];
! glu.gluProject(x, y, z, modelview, projection, viewport, view);
Vertex projection = new Vertex("projection of " + vertex.getName());
System.out.println("x = " + view[0]);
--- 106,113 ----
double z = vertex.getZ();
double[] view = new double[3];
! boolean success = glu.gluProject(x, y, z, modelview, projection, viewport, view);
! if (!success) {
! System.out.println("error projecting");
! }
Vertex projection = new Vertex("projection of " + vertex.getName());
System.out.println("x = " + view[0]);
|