[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view AbstractView.java,1.4,1.5 View3D.java,
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2005-08-16 12:03:44
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25498/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java View3D.java Log Message: Changed back to GLCanvas since GLJPanel is not accelerated.. Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AbstractView.java 15 Aug 2005 12:55:52 -0000 1.4 --- AbstractView.java 16 Aug 2005 12:03:26 -0000 1.5 *************** *** 110,113 **** --- 110,116 ---- protected GLView glv = null; + /** The frames per second counter */ + protected int fps = 0; + /** * The constructor *************** *** 145,148 **** --- 148,152 ---- */ public void display(GLDrawable gld) { + long before = System.currentTimeMillis(); gl = gld.getGL(); glu = gld.getGLU(); *************** *** 159,162 **** --- 163,172 ---- gl.glLineWidth(1.0f); drawAll(gld); + long after = System.currentTimeMillis(); + long ellapsed = after - before; + //StringBuffer buffer = new StringBuffer(); + //buffer.append("ellapsed: "); + //buffer.append(ellapsed); + //log.info(buffer); } *************** *** 194,197 **** --- 204,208 ---- */ protected void drawAll(GLDrawable gld) { + Set edges = EdgeFacade.getInstance().findAll(); gl = gld.getGL(); *************** *** 309,313 **** gl.glPushName(name); if (to != null && from != null) { ! gl.glBegin(GL.GL_LINES); gl.glVertex3d(to.getX(), to.getY(), to.getZ()); gl.glVertex3d(from.getX(), from.getY(), from.getZ()); --- 320,324 ---- gl.glPushName(name); if (to != null && from != null) { ! gl.glBegin(GL.GL_LINE_STRIP); gl.glVertex3d(to.getX(), to.getY(), to.getZ()); gl.glVertex3d(from.getX(), from.getY(), from.getZ()); *************** *** 318,321 **** --- 329,366 ---- /** + * Draw all edges + * @param gld The GLDrawable + */ + private void drawEdges(GLDrawable gld) { + Set edges = EdgeFacade.getInstance().findAll(); + GL gl = gld.getGL(); + GLU glu = gld.getGLU(); + + Iterator it = edges.iterator(); + gl.glColor3dv(STD_LINE_COLOR); + while (it.hasNext()) { + Edge e = (Edge)it.next(); + drawEdge(e); + } + } + /** + * Draw all surfaces + * @param gld The GLDrawable + */ + private void drawSurfaces(GLDrawable gld) { + Set surfaces = SurfaceFacade.getInstance().findAll(); + GL gl = gld.getGL(); + GLU glu = gld.getGLU(); + + Iterator it = surfaces.iterator(); + gl.glColor3dv(STD_LINE_COLOR); + while (it.hasNext()) { + Surface s = (Surface)it.next(); + gl.glPushName(s.getId().intValue()); + drawSurface(s); + gl.glPopName(); + } + } + /** * Change the rotation about the x axis. Only usable in 3D * @param change The change in R+ (is divided with the window height) Index: View3D.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View3D.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** View3D.java 15 Aug 2005 13:00:46 -0000 1.3 --- View3D.java 16 Aug 2005 12:03:26 -0000 1.4 *************** *** 77,81 **** //Set the PickMatrix if we are trying to pick something if (picking > 0) { ! glu.gluPickMatrix(x, viewport[3] - y, 2, 2, viewport); } double aspect = width / height; --- 77,82 ---- //Set the PickMatrix if we are trying to pick something if (picking > 0) { ! glu.gluPickMatrix(x, viewport[3] - y, 7, 7, viewport); ! picking--; } double aspect = width / height; *************** *** 229,243 **** int[] mode = new int[1]; int[] viewport = new int[] {0, 0, (int)width, (int)height}; ! gl.glSelectBuffer(1024, selectBuffer); gl.glRenderMode(GL.GL_SELECT); //drawing scene in selection mode ! picking = 1; //indicating that I am trying to pick(used in camera) ! gl.glMatrixMode(GL.GL_MODELVIEW); ! gl.glPushMatrix(); ! gl.glLoadIdentity(); gl.glClear(GL.GL_COLOR_BUFFER_BIT); ! gl.glViewport(0, 0, (int)width, (int)height); camera(drawable); grid(); --- 230,241 ---- int[] mode = new int[1]; int[] viewport = new int[] {0, 0, (int)width, (int)height}; ! gl.glViewport(0, 0, (int)width, (int)height); gl.glSelectBuffer(1024, selectBuffer); gl.glRenderMode(GL.GL_SELECT); //drawing scene in selection mode ! picking = 60; //indicating that I am trying to pick(used in camera) gl.glClear(GL.GL_COLOR_BUFFER_BIT); ! camera(drawable); grid(); *************** *** 246,251 **** gl.glLineWidth(1.0f); drawAll(drawable); ! gl.glPopMatrix(); ! picking = 0; //end drawing scene --- 244,249 ---- gl.glLineWidth(1.0f); drawAll(drawable); ! ! //picking = 0; //end drawing scene *************** *** 257,261 **** hits = gl.glRenderMode(GL.GL_RENDER); ! //log.info("x,y = " + x + "," + y + " hits = " + hits + ";SB = " + selectBuffer.get(0)); //Processing hits --- 255,259 ---- hits = gl.glRenderMode(GL.GL_RENDER); ! log.info("x,y = " + x + "," + y + " hits = " + hits + ";SB = " + selectBuffer.get(0)); //Processing hits |