当前位置: 首页>>代码示例>>Java>>正文


Java GL11.glTexCoord2d方法代码示例

本文整理汇总了Java中org.lwjgl.opengl.GL11.glTexCoord2d方法的典型用法代码示例。如果您正苦于以下问题:Java GL11.glTexCoord2d方法的具体用法?Java GL11.glTexCoord2d怎么用?Java GL11.glTexCoord2d使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.lwjgl.opengl.GL11的用法示例。


在下文中一共展示了GL11.glTexCoord2d方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawImage

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawImage(ResourceLocation resourceLocation, double x, double y, float width, float height, int color) {
    float red = (color >> 16 & 0xFF) / 255.0f;
    float green = (color >> 8 & 0xFF) / 255.0f;
    float blue = (color & 0xFF) / 255.0f;
    float alpha = (color >> 24 & 0xFF) / 255.0f;
    enableRender2D();
    Wrapper.getMinecraft().field_71446_o.func_110577_a(resourceLocation);
    GL11.glColor4f(red, green, blue, alpha);
    GL11.glBegin(7);
    GL11.glTexCoord2d(1.0, 1.0);
    GL11.glVertex2d(x, y);
    GL11.glTexCoord2d(1.0, 2.0);
    GL11.glVertex2d(x, y + height);
    GL11.glTexCoord2d(2.0, 2.0);
    GL11.glVertex2d(x + width, y + height);
    GL11.glTexCoord2d(2.0, 1.0);
    GL11.glVertex2d(x + width, y);
    GL11.glEnd();
    disableRender2D();
}
 
开发者ID:Ygore,项目名称:bit-client,代码行数:21,代码来源:RenderUtil.java

示例2: drawRailEndCaps

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
 * Draws the end caps of rails.
 * 
 * @param texPoint - Position to render the caps at.
 * @param vertices - Rail shape vertices, as returned by {@link openflextrack.api.IRailType#getRailVertices() getRailVertices()}.
 * @param texScale - {@link openflextrack.api.IRailType#getTextureScale() Texture scale} of the rail segment.
 * @param holographic - {@code true} if the track is a hologram.
 */
private static void drawRailEndCaps(float[] texPoint, Vec3f[][] vertices, float texScale, boolean holographic) {

	/* Backup face mode. */
	final int glFaceMode = GL11.glGetInteger(GL11.GL_FRONT_FACE);

	for (byte b = 1; b > -2; b-=2)
	{
		GL11.glPushMatrix();
		GL11.glScalef(texPoint[4], 1.0F, texPoint[3]);

		/* If we're rendering the second cap, invert front face mode and scale.
		 * This will mirror the cap without the need to render vertices in different order. */
		if (b == -1) {
			GL11.glScalef(-1, 1, -1);
			if (glFaceMode == GL11.GL_CCW) {
				GL11.glFrontFace(GL11.GL_CW);
			}
			else {
				GL11.glFrontFace(GL11.GL_CCW);
			}
		}

		/* Actually render face. */
		GL11.glBegin(GL11.GL_QUADS);
		{
			if (!holographic) {
				OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, texPoint[6]%65536, texPoint[6]/65536);
			}

			for (Vec3f[] verts : vertices)
			{
				/* The fourth vertex (index 3; bottom left of texture)
				 * defines x offset and minumum y value,
				 * and is the first point of the rectangle. */
				final float xOff = (verts[3].x-verts[0].x);
				final float yMin = verts[3].z;

				GL11.glTexCoord2d(0.0F, yMin + (verts[0].y-verts[3].y)*texScale);
				GL11.glVertex3d(verts[3].x, verts[3].y, verts[3].x);

				GL11.glTexCoord2d((verts[3].x-verts[2].x), yMin - (verts[3].y-verts[2].y)*texScale + (verts[1].y-verts[2].y)*texScale);
				GL11.glVertex3d(verts[2].x, verts[2].y, verts[2].x);

				GL11.glTexCoord2d(xOff + (verts[0].x-verts[1].x), yMin + (verts[0].y-verts[1].y)*texScale);
				GL11.glVertex3d(verts[1].x, verts[1].y, verts[1].x);

				GL11.glTexCoord2d(xOff, yMin);
				GL11.glVertex3d(verts[0].x, verts[0].y, verts[0].x);
			}
		}
		GL11.glEnd();
		GL11.glPopMatrix();
	}

	/* Reset face mode. */
	GL11.glFrontFace(glFaceMode);
}
 
开发者ID:DonBruce64,项目名称:OpenFlexiTrack,代码行数:66,代码来源:RenderRails.java

示例3: drawRailSegment

import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
 * Draws a rail segment with the given coordinates.
 * 
 * @param texPoints
 * @param w1 - X-coordinate of first vertex.
 * @param w2 - X-coordinate of second vertex.
 * @param h1 - Y-coordinate of first vertex.
 * @param h2 - Y-coordinate of second vertex.
 * @param t1 - Y-texture offset of first vertex.
 * @param texScale - {@link openflextrack.api.IRailType#getTextureScale() Texture scale} of the rail segment.
 * @param holographic - {@code true} if the track is holographic.
 */
private static void drawRailSegment(List<float[]> texPoints, float w1, float w2, float h1, float h2, float t1, float texScale, boolean holographic) {

	/* Backup face mode. */
	final int glFaceMode = GL11.glGetInteger(GL11.GL_FRONT_FACE);
	final float t2 = t1 + (Math.abs(w2-w1) + Math.abs(h2-h1)) * texScale;

	for (byte b = 1; b > -2; b-=2)
	{
		GL11.glPushMatrix();

		/* If we're rendering the second rail, invert front face mode and scale.
		 * This will mirror the rail without the need to render vertices in different order. */
		if (b == -1) {
			if (glFaceMode == GL11.GL_CCW) {
				GL11.glFrontFace(GL11.GL_CW);
			}
			else {
				GL11.glFrontFace(GL11.GL_CCW);
			}
		}

		/* Actually render the rail. */
		GL11.glBegin(GL11.GL_QUAD_STRIP);
		{
			for (float[] point : texPoints) {

				if (!holographic) {
					OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, point[6]%65536, point[6]/65536);
				}

				GL11.glTexCoord2d(point[5], t2);
				GL11.glNormal3f(0, 1, 0);
				GL11.glVertex3d(point[0] + b*w1*point[4], point[1] + h1, point[2] + b*w1*point[3]);

				GL11.glTexCoord2d(point[5], t1);
				GL11.glNormal3f(0, 1, 0);
				GL11.glVertex3d(point[0] + b*w2*point[4], point[1] + h2, point[2] + b*w2*point[3]);
			}
		}
		GL11.glEnd();
		GL11.glPopMatrix();
	}

	/* Reset face mode. */
	GL11.glFrontFace(glFaceMode);
}
 
开发者ID:DonBruce64,项目名称:OpenFlexiTrack,代码行数:59,代码来源:RenderRails.java


注:本文中的org.lwjgl.opengl.GL11.glTexCoord2d方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。