public static void rect(GL2 gl, float x, float y, float w, float h) { gl.glBegin(GL2.GL_QUADS); gl.glVertex2f(x, y); gl.glVertex2f(x + w, y); gl.glVertex2f(x + w, y + h); gl.glVertex2f(x, y + h); gl.glEnd(); }
public void drawSquare(GL2 gl, float x, float y, float w, float h) { gl.glBegin(GL_QUADS); { gl.glTexCoord2f(0, 0); gl.glVertex2f(x, y); gl.glTexCoord2f(1, 0); gl.glVertex2f(x + w, y); gl.glTexCoord2f(1, 1); gl.glVertex2f(x + w, y + h); gl.glTexCoord2f(0, 1); gl.glVertex2f(x, y + h); } gl.glEnd(); }
@Override protected void updateGeometry(GL2 gl) { float width = scene.view.obstacle.edgeWidth; if (scene.view.renderer.fixedWidthEdges) width /= camera.getScale(); for (int i = 0; i < scene.cspace.obstacle.e.length; i++) new ArcGeometry(scene.cspace.obstacle.e[i]).draw(gl, width, scene.view.obstacle.edgeDetail); if (scene.view.obstacle.originVisible) { gl.glBegin(GL2.GL_LINES); gl.glVertex2f(-0.1f, 0); gl.glVertex2f(0.1f, 0); gl.glVertex2f(0, -0.1f); gl.glVertex2f(0, 0.1f); gl.glEnd(); } }
public void renderSelection(GL2 g) { if ((Globals.tab == Tab.labels || Globals.tab == Tab.height)) { g.glDisable(GL2.GL_ALPHA_TEST); g.glEnable(GL2.GL_BLEND); g.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA); double color = System.currentTimeMillis(); color %= 2000d; color -= 1000d; color = Math.abs(color); color /= 1000d; g.glColor4d(1, 1, 0, 0.1d + 0.2d * color); g.glBegin(GL2.GL_QUADS); g.glVertex2f(0, 0); g.glVertex2f(0, 4); g.glVertex2f(4, 4); g.glVertex2f(4, 0); g.glEnd(); g.glColor4f(1, 1, 1, 1); g.glDisable(GL2.GL_BLEND); g.glEnable(GL2.GL_ALPHA_TEST); } }
@Override public void draw(IBNAView view, ICoordinateMapper cm, GL2 gl, Rectangle clip, IResources r) { if (Boolean.TRUE.equals(t.get(IHasSelected.SELECTED_KEY))) { List<Point> localPoints = BNAUtils.worldToLocal(cm, t.getPoints()); gl.glLineWidth(1f); gl.glColor3f(1f, 1f, 1f); gl.glBegin(GL2.GL_LINE_STRIP); for (Point p : localPoints) { gl.glVertex2f(p.x + 0.5f, p.y + 0.5f); } gl.glEnd(); gl.glColor3f(0f, 0f, 0f); gl.glLineStipple(1, (short) (0x0f0f0f0f >> t.getRotatingOffset() % 8)); gl.glBegin(GL2.GL_LINE_STRIP); for (Point p : localPoints) { gl.glVertex2f(p.x + 0.5f, p.y + 0.5f); } gl.glEnd(); } }
public void renderObj(GL2 gl) { gl.glPushMatrix(); gl.glEnable(GL2.GL_TEXTURE_2D); gl.glTexParameterf(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_NEAREST); gl.glTexParameterf(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST); texture.enable(gl); texture.bind(gl); gl.glDisable(GL2.GL_DEPTH_TEST); gl.glColor4d(1, 1, 1, transparancy); gl.glScalef(canvas.orthoCoordWidth / 2, canvas.orthoCoordWidth / 2 / canvas.aspectRatio, 1); gl.glBegin(GL2.GL_QUADS); gl.glTexCoord2f(0, 0); gl.glVertex2f(-1, -1); gl.glTexCoord2f(1, 0); gl.glVertex2f(1, -1); gl.glTexCoord2f(1, 1); gl.glVertex2f(1, 1); gl.glTexCoord2f(0, 1); gl.glVertex2f(-1, 1); gl.glEnd(); gl.glEnable(GL2.GL_DEPTH_TEST); gl.glDisable(GL2.GL_TEXTURE_2D); gl.glPopMatrix(); }
@Override protected void render(final GL2 gl, GLAutoDrawable drawable) { gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL2.GL_LINE); gl.glBegin(GL.GL_TRIANGLES); gl.glEdgeFlag(this.drawInsignificantEdges); gl.glVertex2f(-20, 0); gl.glEdgeFlag(true); gl.glVertex2f(20, 0); gl.glVertex2f(0, 40); gl.glVertex2f(-20, 0); gl.glVertex2f(-60, -20); gl.glEdgeFlag(this.drawInsignificantEdges); gl.glVertex2f(-20, -40); gl.glEdgeFlag(true); gl.glVertex2f(-20, -40); gl.glVertex2f(0, -80); gl.glEdgeFlag(this.drawInsignificantEdges); gl.glVertex2f(20, -40); gl.glEdgeFlag(true); gl.glVertex2f(20, -40); gl.glVertex2f(60, -20); gl.glEdgeFlag(this.drawInsignificantEdges); gl.glVertex2f(20, 0); gl.glEdgeFlag(true); gl.glEdgeFlag(this.drawInsignificantEdges); gl.glVertex2f(-20, 0); gl.glVertex2f(-20, -40); gl.glVertex2f(20, 0); gl.glVertex2f(-20, -40); gl.glVertex2f(20, -40); gl.glVertex2f(20, 0); gl.glEdgeFlag(true); gl.glEnd(); }