TextureCoords tc = texture.getImageTexCoords(); gl.glTexCoord2f(tc.left(), tc.top()); gl.glVertex2d(left, top); gl.glTexCoord2f(tc.right(), tc.top()); gl.glVertex2d(left + width, top); gl.glTexCoord2f(tc.right(), tc.bottom()); gl.glVertex2d(left + width, top + height); gl.glTexCoord2f(tc.left(), tc.bottom()); gl.glVertex2d(left, top + height);
protected void applyTexture(Texture texture) { int width = texture.getWidth(); int height = texture.getHeight(); TextureCoords coords = texture.getImageTexCoords(); applyTexture(texture, 0, 0, width, height, coords.left(), coords.top(), coords.right(), coords.bottom()); }
protected void applyTexture(Texture texture) { int width = texture.getWidth(); int height = texture.getHeight(); TextureCoords coords = texture.getImageTexCoords(); applyTexture(texture, 0, 0, width, height, coords.left(), coords.top(), coords.right(), coords.bottom()); }
gl.getGL2().glTexCoord2f(coords.left(), coords.bottom()); gl.getGL2().glVertex3f(axisValue, mapping.get(0).x, mapping.get(0).y); gl.getGL2().glTexCoord2f(coords.right(), coords.bottom()); gl.getGL2().glVertex3f(axisValue, mapping.get(1).x, mapping.get(1).y); gl.getGL2().glTexCoord2f(coords.right(), coords.top()); gl.getGL2().glVertex3f(axisValue, mapping.get(3).x, mapping.get(3).y); } else if (orientation == PlaneAxis.Y) { gl.getGL2().glTexCoord2f(coords.left(), coords.bottom()); gl.getGL2().glVertex3f(mapping.get(0).x, axisValue, mapping.get(0).y); gl.getGL2().glTexCoord2f(coords.right(), coords.bottom()); gl.getGL2().glVertex3f(mapping.get(1).x, axisValue, mapping.get(1).y); gl.getGL2().glTexCoord2f(coords.right(), coords.top()); gl.getGL2().glVertex3f(mapping.get(3).x, axisValue, mapping.get(3).y); } else if (orientation == PlaneAxis.Z) { gl.getGL2().glTexCoord2f(coords.left(), coords.bottom()); gl.getGL2().glVertex3f(planePosition.x + mapping.get(0).x, planePosition.y + mapping.get(0).y, axisValue); gl.getGL2().glTexCoord2f(coords.right(), coords.bottom()); gl.getGL2().glVertex3f(planePosition.x + mapping.get(1).x, planePosition.y + mapping.get(1).y, axisValue); gl.getGL2().glTexCoord2f(coords.right(), coords.top()); GLES2CompatUtils.glTexCoord2f(coords.left(), coords.bottom()); GLES2CompatUtils.glVertex3f(axisValue, mapping.get(0).x, mapping.get(0).y); GLES2CompatUtils.glTexCoord2f(coords.right(), coords.bottom()); GLES2CompatUtils.glVertex3f(axisValue, mapping.get(1).x, mapping.get(1).y); GLES2CompatUtils.glTexCoord2f(coords.right(), coords.top()); GLES2CompatUtils.glVertex3f(axisValue, mapping.get(3).x, mapping.get(3).y);
final float tcSy; if( tex.getMustFlipVertically() ) { tcSy = 1f / ( tc.bottom() - tc.top() ); colorTexBBox[1] = box.getMaxY() * tcSy; colorTexBBox[3] = box.getMinY() * tcSy; } else { tcSy = 1f / ( tc.top() - tc.bottom() ); colorTexBBox[1] = box.getMinY() * tcSy; colorTexBBox[3] = box.getMaxY() * tcSy;
final float tcSy; if( tex.getMustFlipVertically() ) { tcSy = 1f / ( tc.bottom() - tc.top() ); colorTexBBox[1] = box.getMaxY() * tcSy; colorTexBBox[3] = box.getMinY() * tcSy; } else { tcSy = 1f / ( tc.top() - tc.bottom() ); colorTexBBox[1] = box.getMinY() * tcSy; colorTexBBox[3] = box.getMaxY() * tcSy;
colorTexBBox[2] = box.getMaxX() * tcSx; if( tex.getMustFlipVertically() ) { final float tcSy = 1f / ( tc.bottom() - tc.top() ); colorTexBBox[1] = box.getMaxY() * tcSy; colorTexBBox[3] = box.getMinY() * tcSy; } else { final float tcSy = 1f / ( tc.top() - tc.bottom() ); colorTexBBox[1] = box.getMinY() * tcSy; colorTexBBox[3] = box.getMaxY() * tcSy;
colorTexBBox[2] = box.getMaxX() * tcSx; if( tex.getMustFlipVertically() ) { final float tcSy = 1f / ( tc.bottom() - tc.top() ); colorTexBBox[1] = box.getMaxY() * tcSy; colorTexBBox[3] = box.getMinY() * tcSy; } else { final float tcSy = 1f / ( tc.top() - tc.bottom() ); colorTexBBox[1] = box.getMinY() * tcSy; colorTexBBox[3] = box.getMaxY() * tcSy;
colorTexBBox[2] = box.getMaxX() * tcSx; if( tex.getMustFlipVertically() ) { final float tcSy = 1f / ( tc.bottom() - tc.top() ); colorTexBBox[1] = box.getMaxY() * tcSy; colorTexBBox[3] = box.getMinY() * tcSy; } else { final float tcSy = 1f / ( tc.top() - tc.bottom() ); colorTexBBox[1] = box.getMinY() * tcSy; colorTexBBox[3] = box.getMaxY() * tcSy;
colorTexBBox[2] = box.getMaxX() * tcSx; if( tex.getMustFlipVertically() ) { final float tcSy = 1f / ( tc.bottom() - tc.top() ); colorTexBBox[1] = box.getMaxY() * tcSy; colorTexBBox[3] = box.getMinY() * tcSy; } else { final float tcSy = 1f / ( tc.top() - tc.bottom() ); colorTexBBox[1] = box.getMinY() * tcSy; colorTexBBox[3] = box.getMaxY() * tcSy;
final float yScale = wholeImageTexCoords.bottom();
private void renderFace(GL2 gl, Texture t) { TextureCoords tc = t.getImageTexCoords(); float tx1 = tc.left(); float ty1 = tc.top(); float tx2 = tc.right(); float ty2 = tc.bottom(); t.enable(gl); t.bind(gl); if (button==4) gl.glColor4f(0.8f, 0.2f, 0.2f, alpha); else gl.glColor4f(alpha, alpha, alpha, alpha); gl.glBegin(GL2.GL_QUADS); gl.glTexCoord2f(tx1, ty1); gl.glVertex2f(currentRect.x, currentRect.y); gl.glTexCoord2f(tx2, ty1); gl.glVertex2f(currentRect.x, currentRect.y + currentRect.height); gl.glTexCoord2f(tx2, ty2); gl.glVertex2f(currentRect.x + currentRect.width, currentRect.y + currentRect.height); gl.glTexCoord2f(tx1, ty2); gl.glVertex2f(currentRect.x + currentRect.width, currentRect.y); gl.glEnd(); t.disable(gl); }
public void drawLink() { GL2 gl = GLContext.getCurrentGL().getGL2(); if (drawLinkAsLine) { gl.glLineWidth(1); gl.glBegin(GL2.GL_LINES); gl.glVertex2f(quad[0].x, quad[0].y); gl.glVertex2f(quad[1].x, quad[1].y); gl.glEnd(); } else { linkWidthCalculator.setLaneWidth(OTFClientControl.getInstance().getOTFVisConfig().getEffectiveLaneWidth()); linkWidthCalculator.setLinkWidthForVis(OTFClientControl.getInstance().getOTFVisConfig().getLinkWidth()); float width = (float) linkWidthCalculator.calculateLinkWidth(this.nrLanes); final Point2D.Float ortho = calcOrtho(this.quad[0].x, this.quad[0].y, this.quad[1].x, this.quad[1].y, width); // (yy this is where the width of the links for drawing is set) this.quad[2] = new Point2D.Float(this.quad[0].x + ortho.x, this.quad[0].y + ortho.y); this.quad[3] = new Point2D.Float(this.quad[1].x + ortho.x, this.quad[1].y + ortho.y); //Draw quad TextureCoords co = new TextureCoords(0,0,1,1); gl.glBegin(GL2.GL_QUADS); gl.glTexCoord2f(co.right(),co.bottom()); gl.glVertex3f(quad[0].x, quad[0].y, 0); gl.glTexCoord2f(co.right(),co.top()); gl.glVertex3f(quad[1].x, quad[1].y, 0); gl.glTexCoord2f(co.left(), co.top()); gl.glVertex3f(quad[3].x, quad[3].y, 0); gl.glTexCoord2f(co.left(),co.bottom()); gl.glVertex3f(quad[2].x, quad[2].y, 0); gl.glEnd(); } }
float texLeft = textureCoords.left( ); float texRight = textureCoords.right( ); float texBottom = textureCoords.bottom( );
final float ty1 = tc.top(); final float tx2 = tc.right(); final float ty2 = tc.bottom();