gl.glTranslated(-this.eye.x - this.center.x, -this.eye.y - this.center.y, -this.eye.z - this.center.z); } else { gl.glTranslated(-this.center.x, -this.center.y, 0);
public static void glTranslated( double x, double y, double z) { gl().glTranslated( x, y, z); }
/** * set up the correct modelview so the robot appears where it hsould. * * @param gl2 */ private void paintCamera(GL2 gl2) { gl2.glMatrixMode(GL2.GL_MODELVIEW); gl2.glLoadIdentity(); gl2.glTranslated(-cameraOffsetX, cameraOffsetY, -cameraZoom); }
private void drawActiveSpot(GL2 gl, Point3d activeSpot, boolean isHighlightedEditor, EditorType editorType, double distanceRatio) { gl.glPushMatrix(); gl.glTranslated(activeSpot.x, activeSpot.y, activeSpot.z); EditorMode highlight = EditorMode.HIGHLIGHT_2; if (isHighlightedEditor) { highlight = EditorMode.HIGHLIGHT_1; } double camDistanceRatio = distanceRatio * Editor.SELECTION_ETITOR_CAMERA_RATIO; activeSpotDrawer.drawEditor(gl, camDistanceRatio, editorType, highlight); gl.glPopMatrix(); }
private static void drawArrow(GL2 gl, GLU glu, GLUquadric quadratic, double editorRadius) { double length = 2d * editorRadius; double arrowheadLength = 1d * editorRadius; double baseRadius = 0.1d * editorRadius; double arrowheadRadius = 0.6d * editorRadius; gl.glPushMatrix(); gl.glTranslated(0, -length / 2d, 0); ArrowDrawUtil.drawArrow(gl, glu, quadratic, length, arrowheadLength, baseRadius, arrowheadRadius, NUMBER_OF_SECTIONS); gl.glPopMatrix(); } }
private static void drawArrowhead(GL2 gl, GLU glu, GLUquadric quadratic, double editorRadius) { double length = 2d * editorRadius; gl.glPushMatrix(); gl.glTranslated(0, -editorRadius, 0); ArrowDrawUtil.drawArrowheadSimple(gl, glu, quadratic, length, editorRadius, NUMBER_OF_SECTIONS); gl.glPopMatrix(); }
public void drawCylinder(double baseRadius, double topRadius, double height, double x, double y, double z) { final int slices = DEFAULT_RESOLUTION; final int stacks = DEFAULT_RESOLUTION; gl.glPushMatrix(); // Draw sphere (possible styles: FILL, LINE, POINT). //gl.glColor3f(0.3f, 0.5f, 1f); gl.glTranslated(x, y, z); GLUquadric cylinder = generateQuadric(glu); glu.gluCylinder(cylinder, baseRadius, topRadius, height, slices, stacks); glu.gluDeleteQuadric(cylinder); gl.glPopMatrix(); }
@Override protected void paintMotors(GL2 gl2,MakelangeloRobotSettings settings) { double top = settings.getLimitTop(); double bottom = settings.getLimitBottom(); double right = settings.getLimitRight(); double left = settings.getLimitLeft(); gl2.glPushMatrix(); gl2.glTranslated(left , top , 0); gl2.glRotated(270, 0, 0, 1); paintOneMotor(gl2); gl2.glPopMatrix(); gl2.glPushMatrix(); gl2.glTranslated(right, top , 0); gl2.glRotated(180, 0, 0, 1); paintOneMotor(gl2); gl2.glPopMatrix(); gl2.glPushMatrix(); gl2.glTranslated(right, bottom, 0); gl2.glRotated( 90, 0, 0, 1); paintOneMotor(gl2); gl2.glPopMatrix(); gl2.glPushMatrix(); gl2.glTranslated(left , bottom, 0); gl2.glRotated( 0, 0, 0, 1); paintOneMotor(gl2); gl2.glPopMatrix(); }
public void aimCamera(Vector3 cameraPoint, double angleX, double angleY, double angleZ) { gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity(); gl.glRotated(360-angleX, 1, 0, 0); gl.glRotated(360-angleY, 0, 1, 0); gl.glRotated(360-angleZ, 0, 0, 1); gl.glTranslated(-cameraPoint.x, -cameraPoint.y, -cameraPoint.z); }
public void drawSphere(double radius, double x, double y, double z, int resolution) { final int slices = resolution; final int stacks = resolution; gl.glPushMatrix(); // Draw sphere (possible styles: FILL, LINE, POINT). //gl.glColor3f(0.3f, 0.5f, 1f); gl.glTranslated(x, y, z); GLUquadric sphere = generateQuadric(glu); glu.gluSphere(sphere, radius, slices, stacks); glu.gluDeleteQuadric(sphere); gl.glPopMatrix(); }
@Override public void draw(GL2 pGl, Camera camera) { pGl.glPushMatrix(); pGl.glTranslated(getGlobalX(), 0, -getGlobalY()); try { modelRender.render(pGl, model); } finally { pGl.glPopMatrix(); } }
public void drawSphere(double radius, double x, double y, double z, int resolution, Color color) { final int slices = resolution; final int stacks = resolution; gl.glPushMatrix(); glSetColor(color); gl.glTranslated(x, y, z); GLUquadric sphere = generateQuadric(glu); glu.gluSphere(sphere, radius, slices, stacks); glu.gluDeleteQuadric(sphere); gl.glPopMatrix(); }
public void drawSquare(double size) { double halfSize = size/2; gl.glTranslated(0,0, halfSize); gl.glBegin(GL.GL_TRIANGLE_FAN); gl.glVertex2d(-halfSize,-halfSize); // Draw the square (before the gl.glVertex2d(halfSize,-halfSize); // the translation is applied) gl.glVertex2d(halfSize,halfSize); // on the xy-plane, with its gl.glVertex2d(-halfSize,halfSize); // at (0,0,0). gl.glEnd(); }
@Override public void draw(GL2 gl, Camera camera, LOD pLod) { Model model2 = modelLod.get(pLod); if (model2 != null) { gl.glEnable(GLLightingFunc.GL_NORMALIZE); for (Point2d hook : hookPoints) { gl.glPushMatrix(); gl.glTranslated(getGlobalX() + hook.x, 0, -(getGlobalY() + hook.y)); gl.glScaled(scale.x, scale.y, scale.z); modelRender.render(gl, model2); gl.glPopMatrix(); } gl.glDisable(GLLightingFunc.GL_NORMALIZE); } }
@Override public void draw(GL2 gl, Camera camera, LOD pLod) { Model model2 = modelLod.get(pLod); if (model2 != null) { gl.glPushMatrix(); gl.glTranslated(getGlobalX(), minHeight, -getGlobalY()); gl.glEnable(GLLightingFunc.GL_NORMALIZE); gl.glScaled(scale.x, scale.y, scale.z); modelRender.render(gl, model2); gl.glDisable(GLLightingFunc.GL_NORMALIZE); // rotate in the opposite direction to the camera gl.glPopMatrix(); } }
@Override public void draw(GL2 gl, Camera pCamera, boolean selected) { // XXX move draw debug do new method gl.glPushMatrix(); Point3d position = getPosition(); gl.glTranslated(position.x, position.y, position.z); modelRender.render(gl, model); if (debug != null && debug.getEdges() != null) { drawEdges(gl, debug.getEdges()); } gl.glPopMatrix(); }
public void aimCamera(AimPoint aim) { gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity(); gl.glRotated(360-aim.getAngleX(), 1, 0, 0); gl.glRotated(360-aim.getAngleY(), 0, 1, 0); gl.glRotated(360-aim.getAngleZ(), 0, 0, 1); gl.glTranslated(-aim.x, -aim.y, -aim.z); }
private void drawEdges(GL2 gl, List<LineSegment3d> edges) { // Lift up a little to avoid z-buffer problems gl.glTranslated(0, 0.1, 0); gl.glLineWidth(6); gl.glColor3fv(ROOF_EDGES_COLOR, 0); for (LineSegment3d line : edges) { gl.glBegin(GL.GL_LINES); Point3d begin = line.getBegin(); Point3d end = line.getEnd(); gl.glVertex3d(begin.x, begin.y, begin.z); gl.glVertex3d(end.x, end.y, end.z); gl.glEnd(); } }
public void drawSphere(AimPoint point, double radius) { GLUquadric sphere = glu.gluNewQuadric(); glu.gluQuadricDrawStyle(sphere, GLU.GLU_FILL); glu.gluQuadricTexture(sphere, true); glu.gluQuadricNormals(sphere, GLU.GLU_SMOOTH); // draw a sphere gl.glPushMatrix(); gl.glTranslated(point.x, point.y, point.z); gl.glRotated(point.getAngleY(), 0, 1, 0); gl.glRotated(point.getAngleX(), 1, 0, 0); glu.gluSphere(sphere, radius, 32, 32); gl.glPopMatrix(); }
@Override protected void paintCalibrationPoint(GL2 gl2, MakelangeloRobotSettings settings) { gl2.glPushMatrix(); gl2.glTranslated(settings.getHomeX(), settings.getHomeY(), 0); gl2.glColor3f(0.8f, 0.8f, 0.8f); gl2.glBegin(GL2.GL_LINES); gl2.glVertex2f(-0.25f, 0.0f); gl2.glVertex2f(0.25f, 0.0f); gl2.glVertex2f(0.0f, -0.25f); gl2.glVertex2f(0.0f, 0.25f); gl2.glEnd(); gl2.glPopMatrix(); }