public static void glRotated( double angle, double x, double y, double z) { gl().glRotated( angle, x, y, z); }
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); }
@Override public void rotate(double theta, double x, double y) { gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glTranslatef((float) x, (float) y, 0); gl.glRotated(theta * RAD_TO_DEG, 0, 0, 1); gl.glTranslatef((float) -x, (float) -y, 0); }
/** * Draws arrowhead. Arrowhead starts at origin and it is directed at +Y * axis. * * @param gl * gl * @param glu * glu * @param quadratic * quadratic * @param length * length of arrowhead * @param radius * radius of arrowhead * @param section * number of section */ public static void drawArrowhead(GL2 gl, GLU glu, GLUquadric quadratic, double length, double radius, int section) { gl.glPushMatrix(); gl.glRotated(-90d, 1d, 0d, 0d); glu.gluCylinder(quadratic, radius, 0, length, section, 2); gl.glRotated(180d, 1d, 0d, 0d); glu.gluDisk(quadratic, 0, radius, section, 2); 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 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(); }
ArrowDrawUtil.drawArrow(gl, glu, quadratic, lenght, arrowLenght, baseRadius, arrowRadius, section); gl.glRotated(-90d, 0d, 0d, 1d); gl.glColor3fv(X_AXIS_COLOR_ARRAY, 0); ArrowDrawUtil.drawArrow(gl, glu, quadratic, lenght, arrowLenght, baseRadius, arrowRadius, section); gl.glRotated(90d, 1d, 0d, 0d); gl.glColor3fv(Z_AXIS_COLOR_ARRAY, 0); ArrowDrawUtil.drawArrow(gl, glu, quadratic, lenght, arrowLenght, baseRadius, arrowRadius, section);
public static void drawSphereSelection(GL2 gl, Selectable r) { for (Selection selection : r.getSelection()) { if (selection instanceof SphereSelection) { SphereSelection s = (SphereSelection) selection; gl.glPushMatrix(); Point3d p = s.getCenter(); double dx = p.x; double dy = p.y; double dz = p.z; gl.glLineWidth(1); gl.glTranslated(dx, dy, dz); DrawUtil.drawDotOuterY(gl, s.getRadius(), 24); gl.glRotated(90d, 1d, 0, 0); DrawUtil.drawDotOuterY(gl, s.getRadius(), 24); gl.glRotated(90d, 0, 0, 1d); DrawUtil.drawDotOuterY(gl, s.getRadius(), 24); gl.glPopMatrix(); } } } }
@Override public void draw(GL2 gl, Camera camera, LOD pLod) { // Model model2 = modelLod.get(pLod); if (model2 != null) { gl.glPushMatrix(); gl.glTranslated(getGlobalX(), 0, -getGlobalY()); drawDebug(gl, translate, 0); gl.glTranslated(translate.x, translate.y, translate.z); gl.glEnable(GLLightingFunc.GL_NORMALIZE); // XXX gl.glScaled(scale.x, scale.y, scale.z); gl.glRotated(rotateY, 0d, 1d, 0d); modelRenderer.render(gl, model2); gl.glDisable(GLLightingFunc.GL_NORMALIZE); gl.glPopMatrix(); } }
@Override public void draw(GL2 gl, Camera camera, LOD pLod) { Model model2 = modelLod.get(pLod); if (model2 != null) { gl.glPushMatrix(); // gl.glTranslated(this.getGlobalX(), 0, -this.getGlobalY()); gl.glEnable(GLLightingFunc.GL_NORMALIZE); // XXX for (ModelPoint modelPoint : modelPoints) { gl.glPushMatrix(); gl.glTranslated(modelPoint.getPoint().x, modelPoint.getPoint().y, modelPoint.getPoint().z); // double cos = modelPoint.getOffsetVector().x; // double sin = -modelPoint.getOffsetVector().y; double cos = -modelPoint.getOffsetVector().y; double sin = -modelPoint.getOffsetVector().x; gl.glMultMatrixd( // new double[] { cos, 0, sin, 0, // 0, 1, 0, 0, // -sin, 0, cos, 0, // 0, 0, 0, 1 }, 0); PointModel.drawDebug(gl, translate, modelPoint.getDirection()); gl.glTranslated(translate.x, translate.y, translate.z); gl.glScaled(scale.x, scale.y, scale.z); gl.glRotated(modelPoint.getDirection(), 0d, 1d, 0d); modelRenderer.render(gl, model2); gl.glPopMatrix(); } gl.glDisable(GLLightingFunc.GL_NORMALIZE); gl.glPopMatrix(); } }
gl.glRotated(180d, 0, 1, 0);