@Override public void scale(double sx, double sy) { gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glScaled(sx, sy, 1); }
public static void glScaled( double x, double y, double z) { gl().glScaled( x, y, z); }
gl.glScaled(this.scaleFactor, this.scaleFactor, this.scaleFactor);
/** * Method gluPickMatrix * * @param x * @param y * @param deltaX * @param deltaY * @param viewport */ public void gluPickMatrix(final GL2 gl, final double x, final double y, final double deltaX, final double deltaY, final IntBuffer viewport) { if (deltaX <= 0 || deltaY <= 0) { return; } /* Translate and scale the picked region to the entire window */ final int vPos = viewport.position(); gl.glTranslated((viewport.get(2+vPos) - 2 * (x - viewport.get(0+vPos))) / deltaX, (viewport.get(3+vPos) - 2 * (y - viewport.get(1+vPos))) / deltaY, 0); gl.glScaled(viewport.get(2) / deltaX, viewport.get(3) / deltaY, 1.0); }
/** * Method gluPickMatrix * * @param x * @param y * @param deltaX * @param deltaY * @param viewport * @param viewport_offset */ public void gluPickMatrix(final GL2 gl, final double x, final double y, final double deltaX, final double deltaY, final int[] viewport, final int viewport_offset) { if (deltaX <= 0 || deltaY <= 0) { return; } /* Translate and scale the picked region to the entire window */ gl.glTranslated((viewport[2+viewport_offset] - 2 * (x - viewport[0+viewport_offset])) / deltaX, (viewport[3+viewport_offset] - 2 * (y - viewport[1+viewport_offset])) / deltaY, 0); gl.glScaled(viewport[2+viewport_offset] / deltaX, viewport[3+viewport_offset] / deltaY, 1.0); } }
@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(); } }
public void draw(GL2 gl, Camera camera, LOD pLod) { Model model2 = modelLod.get(pLod); if (model2 != null) { Integer dl = getDisplayList(model2); if (dl == null) { dl = createDisplayList(gl, model2); } 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); gl.glCallList(dl); 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(), 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(); } }
/** * Bind texture. * * @param gl * context * @param texture * the texture */ public void bindTexture(GL2 gl, Texture texture) { // switch to texture mode and push a new matrix on the stack gl.glMatrixMode(GL.GL_TEXTURE); gl.glPushMatrix(); // check to see if the texture needs flipping if (texture.getMustFlipVertically()) { gl.glScaled(1, -1, 1); gl.glTranslated(0, -1, 0); } // switch to modelview matrix and push a new matrix on the stack gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glPushMatrix(); // This is required to repeat textures gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT); // enable, bind texture.enable(gl); texture.bind(gl); }
@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(); } }
gl2.glColor3f(0.9f,0.9f,0.9f); gl2.glLineWidth(1); gl2.glScaled(settings.getPaperMargin(),settings.getPaperMargin(),1); gl2.glBegin(GL2.GL_LINE_LOOP); gl2.glVertex2d(settings.getPaperLeft() , settings.getPaperTop());
gl.glScaled(scale.x * height, scale.y * height, scale.z * height);
gl.glScaled(0.5*scale, 0.5*scale, 0.5*scale); } else {