List of usage examples for org.lwjgl.opengl GL11 glTexCoord2d
public static native void glTexCoord2d(@NativeType("GLdouble") double s, @NativeType("GLdouble") double t);
From source file:cn.lambdalib.util.client.RenderUtils.java
License:MIT License
public static void addVertexLegacy(Vec3 vertex, double u, double v) { GL11.glTexCoord2d(u, v); GL11.glVertex3d(vertex.xCoord, vertex.yCoord, vertex.zCoord); }
From source file:com.bluepowermod.client.render.RenderHelper.java
License:Open Source License
/** * Adds a vertex with a texture./*from w ww .j a va2s . c om*/ * * @author Koen Beckers (K4Unl) * @param x * @param y * @param z * @param tx * @param ty */ public static void addVertexWithTexture(double x, double y, double z, double tx, double ty) { GL11.glTexCoord2d(tx, ty); GL11.glVertex3d(x, y, z); }
From source file:com.github.jtse.puzzle.ogl.Textures.java
License:Apache License
public static void renderImage(Texture texture, int x, int y, int z) { // Color.white.bind(); // texture.bind(); // or GL11.glBind(texture.getTextureID()); //GL11.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); GL11.glBindTexture(GL_TEXTURE_2D, texture.getTextureID()); // GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, // GL11.GL_MODULATE ); // when texture area is small, bilinear filter the closest mipmap // GL11.glTexParameterf( GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, // GL11.GL_LINEAR_MIPMAP_NEAREST ); // when texture area is large, bilinear filter the first mipmap // GL11.glTexParameterf( GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, // GL11.GL_LINEAR ); // GL11.glTexParameterf( GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, // GL11.GL_CLAMP ); // GL11.glTexParameterf( GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, // GL11.GL_CLAMP ); glBegin(GL11.GL_QUADS);/* w w w .j ava 2s. co m*/ GL11.glTexCoord2d(0.0d, 0.0d); GL11.glVertex3d(x, y, z); // It's 0.99 instead of 1.0 because 1.0 creates edge artifacts GL11.glTexCoord2d(0.99d, 0.0d); GL11.glVertex3d(x + texture.getTextureWidth(), y, z); GL11.glTexCoord2d(0.99d, 0.99d); GL11.glVertex3d(x + texture.getTextureWidth(), y + texture.getTextureHeight(), z); GL11.glTexCoord2d(0.0d, 0.99d); GL11.glVertex3d(x, y + texture.getTextureHeight(), z); glEnd(); }
From source file:de.kitsunealex.projectx.client.render.RenderTruncatedIcosahedron.java
License:Open Source License
private void renderShape(Vector3[] verts, boolean reverse) { Vector3 center = new Vector3(); for (int i = 0; i < verts.length; i++) { center.add(verts[i]);/*from www . j a v a 2 s .c om*/ } center.multiply(1D / verts.length); Vector3 prev = verts[0]; int start = reverse ? verts.length : 1; int end = reverse ? -1 : verts.length + 1; int step = reverse ? -1 : 1; for (int i = start; i != end; i += step) { GL11.glTexCoord2d(0.5D, 0.5D); GL11.glVertex3d(center.x, center.y, center.z); GL11.glTexCoord2d(0D, 0D); GL11.glVertex3d(prev.x, prev.y, prev.z); GL11.glTexCoord2d(1D, 0D); GL11.glVertex3d(verts[(i % verts.length)].x, verts[(i % verts.length)].y, verts[(i % verts.length)].z); prev = verts[(i % verts.length)]; } }
From source file:fi.conf.ae.gl.GLGraphicRoutines.java
License:LGPL
public static void draw2DRect(float x0, float y0, float x1, float y1, float z) { GL11.glBegin(GL11.GL_QUADS);//from w w w . j a va2 s . com GL11.glNormal3f(0, 0, 1); GL11.glTexCoord2d(0, 0); GL11.glVertex3d(x0, y0, z); GL11.glNormal3f(0, 0, 1); GL11.glTexCoord2d(0, 0.9999999); GL11.glVertex3d(x0, y1, z); GL11.glNormal3f(0, 0, 1); GL11.glTexCoord2d(0.9999999, 0.9999999); GL11.glVertex3d(x1, y1, z); GL11.glNormal3f(0, 0, 1); GL11.glTexCoord2d(0.9999999, 0); GL11.glVertex3d(x1, y0, z); GL11.glEnd(); }
From source file:fi.conf.ae.gl.GLGraphicRoutines.java
License:LGPL
public static void drawRepeatedBackgroundPlane(float rx, float ry, float tx, float ty) { initOrtho();// w w w . j a v a2 s. co m GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2d(tx, ty + ry); GL11.glVertex3d(0, GLValues.glHeight, -GLValues.glDepth); GL11.glTexCoord2d(tx + rx, ty + ry); GL11.glVertex3d(GLValues.glWidth, GLValues.glHeight, -GLValues.glDepth); GL11.glTexCoord2d(tx + rx, ty); GL11.glVertex3d(GLValues.glWidth, 0, -GLValues.glDepth); GL11.glTexCoord2d(tx, ty); GL11.glVertex3d(0, 0, -GLValues.glDepth); GL11.glEnd(); }
From source file:fi.conf.ae.gl.GLGraphicRoutines.java
License:LGPL
public static void drawCircle(float r, float d) { GL11.glBegin(GL11.GL_TRIANGLE_FAN);/*w w w . j av a 2 s.c om*/ for (float a = (float) ((2.0f * Math.PI) / d); a < 2 * Math.PI; a += (2.0f * Math.PI) / (float) d) { GL11.glNormal3f(0, 0, -1.0f); GL11.glTexCoord2d((Math.sin(a) + 1.0f) / 2.0f, (Math.cos(a) + 1.0f) / 2.0f); GL11.glVertex3d(Math.sin(a) * r, Math.cos(a) * r, 0); } GL11.glEnd(); }
From source file:fi.conf.ae.gl.GLGraphicRoutines.java
License:LGPL
public static void drawHexagon(float r) { GL11.glBegin(GL11.GL_TRIANGLE_FAN);//from www .j a va 2 s. co m for (float a = (float) ((2.0f * Math.PI) / 6.0f); a < 2 * Math.PI; a += (2.0f * Math.PI) / 6.0f) { GL11.glNormal3f(0, 0, -1.0f); GL11.glTexCoord2d((Math.sin(a) + 1.0f) / 2.0f, (Math.cos(a) + 1.0f) / 2.0f); GL11.glVertex3d(Math.sin(a) * r, Math.cos(a) * r, 0); } GL11.glEnd(); }
From source file:fi.conf.ae.gl.text.GLBitmapFontBlitter.java
License:LGPL
public static void drawString(String string, String textureIdentifier, float charWidth, float charHeight, Alignment align) {//from w ww .ja va2 s .com float hOverlap = 0.01f; float vOverlap = 0.0f; float xfix = 0; if (align.equals(Alignment.CENTERED)) { xfix = string.length() * charWidth * 0.5f; } else if (align.equals(Alignment.RIGHT)) { xfix = string.length() * charWidth - hOverlap; } GL11.glPushMatrix(); GL11.glTranslatef(0, -0.5f * charHeight, 0); GLTextureManager.getInstance().bindTexture(textureIdentifier); GL11.glBegin(GL11.GL_QUADS); for (int i = 0; i < string.length(); i++) { char c = string.charAt(i); float x1 = (c % 16f) / 16f; float x2 = x1 + 1f / 16f; float y1 = (c / 16) / 16f; float y2 = y1 + 1f / 16f; GL11.glTexCoord2d(x1 + hOverlap, y1 + vOverlap); GL11.glVertex3d(i * charWidth - xfix, 0, 0); GL11.glTexCoord2d(x1 + hOverlap, y2 - vOverlap); GL11.glVertex3d(i * charWidth - xfix, charHeight, 0); GL11.glTexCoord2d(x2 - hOverlap, y2 - vOverlap); GL11.glVertex3d(i * charWidth + charWidth - xfix, charHeight, 0); GL11.glTexCoord2d(x2 - hOverlap, y1 + vOverlap); GL11.glVertex3d(i * charWidth + charWidth - xfix, 0, 0); } GL11.glEnd(); GL11.glPopMatrix(); }
From source file:fi.conf.ae.gl.text.GLBitmapFontBlitter.java
License:LGPL
public static void drawScrollerString(String string, float charWidth, float charHeight, float freq, float amplitude, float phase, String font) { float overlap = 0.2f; float fix = 0; GL11.glPushMatrix();/*from w w w . j a va 2 s.c o m*/ GLTextureManager.getInstance().bindTexture(font); //GL11.glBindTexture(GL11.GL_TEXTURE_2D, fontTextureID); GL11.glEnable(GL11.GL_DEPTH_TEST); //GLRoutines.drawSprite(0f, 0f, 2f, 2f, 1f); GL11.glBegin(GL11.GL_QUADS); for (int i = 0; i < string.length(); i++) { char c = string.charAt(i); float s = (float) Math.sin(phase + freq * 2 * Math.PI * i / string.length()) * amplitude; float x1 = (c % 16f) / 16f; float x2 = (c % 16f) / 16f + 1f / 16f; float y1 = (c / 16) / 16f; float y2 = (c / 16) / 16f + 1f / 16f; //drawSprite(x1, y1, x2, y2, 0); //GL11.glColor3f((float)Math.random()*1.3f, (float)Math.random()*1.3f, (float)Math.random()*1.3f); GL11.glTexCoord2d(x1, y1); GL11.glVertex3d(i * charWidth - fix - overlap, s, 0); GL11.glTexCoord2d(x1, y2); GL11.glVertex3d(i * charWidth - fix - overlap, charHeight + s, 0); GL11.glTexCoord2d(x2, y2); GL11.glVertex3d(i * charWidth + charWidth - fix, charHeight + s, 0); GL11.glTexCoord2d(x2, y1); GL11.glVertex3d(i * charWidth + charWidth - fix, s, 0); } GL11.glEnd(); GL11.glPopMatrix(); }