本文整理汇总了Java中org.lwjgl.opengl.GL11.glTexCoord2f方法的典型用法代码示例。如果您正苦于以下问题:Java GL11.glTexCoord2f方法的具体用法?Java GL11.glTexCoord2f怎么用?Java GL11.glTexCoord2f使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.opengl.GL11
的用法示例。
在下文中一共展示了GL11.glTexCoord2f方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderDefaultChar
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Render a single character with the default.png font at current (posX,posY) location...
*/
private float renderDefaultChar(int p_78266_1_, boolean p_78266_2_)
{
int i = p_78266_1_ % 16 * 8;
int j = p_78266_1_ / 16 * 8;
int k = p_78266_2_ ? 1 : 0;
this.bindTexture(this.locationFontTexture);
float f = this.charWidth[p_78266_1_];
float f1 = 7.99F;
GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
GL11.glTexCoord2f((float)i / 128.0F, (float)j / 128.0F);
GL11.glVertex3f(this.posX + (float)k, this.posY, 0.0F);
GL11.glTexCoord2f((float)i / 128.0F, ((float)j + 7.99F) / 128.0F);
GL11.glVertex3f(this.posX - (float)k, this.posY + 7.99F, 0.0F);
GL11.glTexCoord2f(((float)i + f1 - 1.0F) / 128.0F, (float)j / 128.0F);
GL11.glVertex3f(this.posX + f1 - 1.0F + (float)k, this.posY, 0.0F);
GL11.glTexCoord2f(((float)i + f1 - 1.0F) / 128.0F, ((float)j + 7.99F) / 128.0F);
GL11.glVertex3f(this.posX + f1 - 1.0F - (float)k, this.posY + 7.99F, 0.0F);
GL11.glEnd();
return f;
}
示例2: drawQuad
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
protected void drawQuad(float x, float y, float width, float height, float srcX, float srcY, float srcWidth, float srcHeight)
{
float renderSRCX = srcX / imgSize;
float renderSRCY = srcY / imgSize;
float renderSRCWidth = srcWidth / imgSize;
float renderSRCHeight = srcHeight / imgSize;
GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY);
GL11.glVertex2d(x + width, y);
GL11.glTexCoord2f(renderSRCX, renderSRCY);
GL11.glVertex2d(x, y);
GL11.glTexCoord2f(renderSRCX, renderSRCY + renderSRCHeight);
GL11.glVertex2d(x, y + height);
GL11.glTexCoord2f(renderSRCX, renderSRCY + renderSRCHeight);
GL11.glVertex2d(x, y + height);
GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY + renderSRCHeight);
GL11.glVertex2d(x + width, y + height);
GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY);
GL11.glVertex2d(x + width, y);
}
示例3: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Game loop render
*/
public void render() {
Color.white.bind();
texture.bind(); // or GL11.glBind(texture.getTextureID());
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(0,0);
GL11.glVertex2f(100,100);
GL11.glTexCoord2f(1,0);
GL11.glVertex2f(100+texture.getTextureWidth(),100);
GL11.glTexCoord2f(1,1);
GL11.glVertex2f(100+texture.getTextureWidth(),100+texture.getTextureHeight());
GL11.glTexCoord2f(0,1);
GL11.glVertex2f(100,100+texture.getTextureHeight());
GL11.glEnd();
font.drawString(150, 300, "HELLO LWJGL WORLD", Color.yellow);
}
示例4: renderDefaultChar
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Render a single character with the default.png font at current (posX,posY) location...
*/
private float renderDefaultChar(int p_78266_1_, boolean p_78266_2_)
{
float var3 = (float) (p_78266_1_ % 16 * 8);
float var4 = (float) (p_78266_1_ / 16 * 8);
float var5 = p_78266_2_ ? 1.0F : 0.0F;
this.renderEngine.bindTexture(this.locationFontTexture);
float var6 = 7.99F;
GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
GL11.glTexCoord2f(var3 / 128.0F, var4 / 128.0F);
GL11.glVertex3f(this.posX + var5, this.posY, 0.0F);
GL11.glTexCoord2f(var3 / 128.0F, (var4 + 7.99F) / 128.0F);
GL11.glVertex3f(this.posX - var5, this.posY + 7.99F, 0.0F);
GL11.glTexCoord2f((var3 + var6 - 1.0F) / 128.0F, var4 / 128.0F);
GL11.glVertex3f(this.posX + var6 - 1.0F + var5, this.posY, 0.0F);
GL11.glTexCoord2f((var3 + var6 - 1.0F) / 128.0F, (var4 + 7.99F) / 128.0F);
GL11.glVertex3f(this.posX + var6 - 1.0F - var5, this.posY + 7.99F, 0.0F);
GL11.glEnd();
return this.charWidth[p_78266_1_];
}
示例5: renderDefaultChar
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Render a single character with the default.png font at current (posX,posY) location...
*/
private float renderDefaultChar(int p_78266_1_, boolean p_78266_2_)
{
int i = p_78266_1_ % 16 * 8;
int j = p_78266_1_ / 16 * 8;
int k = p_78266_2_ ? 1 : 0;
this.renderEngine.bindTexture(this.locationFontTexture);
float f = this.charWidth[p_78266_1_];
float f1 = 7.99F;
GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
GL11.glTexCoord2f((float)i / 128.0F, (float)j / 128.0F);
GL11.glVertex3f(this.posX + (float)k, this.posY, 0.0F);
GL11.glTexCoord2f((float)i / 128.0F, ((float)j + 7.99F) / 128.0F);
GL11.glVertex3f(this.posX - (float)k, this.posY + 7.99F, 0.0F);
GL11.glTexCoord2f(((float)i + f1 - 1.0F) / 128.0F, (float)j / 128.0F);
GL11.glVertex3f(this.posX + f1 - 1.0F + (float)k, this.posY, 0.0F);
GL11.glTexCoord2f(((float)i + f1 - 1.0F) / 128.0F, ((float)j + 7.99F) / 128.0F);
GL11.glVertex3f(this.posX + f1 - 1.0F - (float)k, this.posY + 7.99F, 0.0F);
GL11.glEnd();
return f;
}
示例6: renderTieTop
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
private static final void renderTieTop(float width){
GL11.glTexCoord2f(tieTopMinU, tieTopMinV);
GL11.glNormal3f(0, 1, 0);
GL11.glVertex3f(-width/2, height, length/2);
GL11.glTexCoord2f(tieTopMaxU, tieTopMinV);
GL11.glNormal3f(0, 1, 0);
GL11.glVertex3f(width/2, height, length/2);
GL11.glTexCoord2f(tieTopMaxU, tieTopMaxV);
GL11.glNormal3f(0, 1, 0);
GL11.glVertex3f(width/2, height, -length/2);
GL11.glTexCoord2f(tieTopMinU, tieTopMaxV);
GL11.glNormal3f(0, 1, 0);
GL11.glVertex3f(-width/2, height, -length/2);
}
示例7: renderTieFront
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
private static final void renderTieFront(float width){
GL11.glTexCoord2f(tieSideMinU, tieSideMinV);
GL11.glNormal3f(0, 1, 0);
GL11.glVertex3f(-width/2, height, length/2);
GL11.glTexCoord2f(tieSideMinU, tieSideMaxV);
GL11.glNormal3f(0, 1, 0);
GL11.glVertex3f(-width/2, 0, length/2);
GL11.glTexCoord2f(tieSideMaxU, tieSideMaxV);
GL11.glNormal3f(0, 1, 0);
GL11.glVertex3f(width/2, 0, length/2);
GL11.glTexCoord2f(tieSideMaxU, tieSideMinV);
GL11.glNormal3f(0, 1, 0);
GL11.glVertex3f(width/2, height, length/2);
}
示例8: renderTieLeft
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
private static final void renderTieLeft(float width){
GL11.glTexCoord2f(tieEndMinU, tieEndMinV);
GL11.glNormal3f(0, 1, 0);
GL11.glVertex3f(-width/2, height, -length/2);
GL11.glTexCoord2f(tieEndMinU, tieEndMaxV);
GL11.glNormal3f(0, 1, 0);
GL11.glVertex3f(-width/2, 0, -length/2);
GL11.glTexCoord2f(tieEndMaxU, tieEndMaxV);
GL11.glNormal3f(0, 1, 0);
GL11.glVertex3f(-width/2, 0, length/2);
GL11.glTexCoord2f(tieEndMaxU, tieEndMinV);
GL11.glNormal3f(0, 1, 0);
GL11.glVertex3f(-width/2, height, length/2);
}
示例9: renderTieRight
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
private static final void renderTieRight(float width){
GL11.glTexCoord2f(tieEndMinU, tieEndMinV);
GL11.glNormal3f(0, 1, 0);
GL11.glVertex3f(width/2, height, length/2);
GL11.glTexCoord2f(tieEndMinU, tieEndMaxV);
GL11.glNormal3f(0, 1, 0);
GL11.glVertex3f(width/2, 0, length/2);
GL11.glTexCoord2f(tieEndMaxU, tieEndMaxV);
GL11.glNormal3f(0, 1, 0);
GL11.glVertex3f(width/2, 0, -length/2);
GL11.glTexCoord2f(tieEndMaxU, tieEndMinV);
GL11.glNormal3f(0, 1, 0);
GL11.glVertex3f(width/2, height, -length/2);
}
示例10: renderDefaultChar
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Render a single character with the default.png font at current (posX,posY) location...
*/
private float renderDefaultChar(int p_78266_1_, boolean p_78266_2_)
{
int i = p_78266_1_ % 16 * 8;
int j = p_78266_1_ / 16 * 8;
int k = p_78266_2_ ? 1 : 0;
this.renderEngine.bindTexture(this.locationFontTexture);
int l = this.charWidth[p_78266_1_];
float f = (float)l - 0.01F;
GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
GL11.glTexCoord2f((float)i / 128.0F, (float)j / 128.0F);
GL11.glVertex3f(this.posX + (float)k, this.posY, 0.0F);
GL11.glTexCoord2f((float)i / 128.0F, ((float)j + 7.99F) / 128.0F);
GL11.glVertex3f(this.posX - (float)k, this.posY + 7.99F, 0.0F);
GL11.glTexCoord2f(((float)i + f - 1.0F) / 128.0F, (float)j / 128.0F);
GL11.glVertex3f(this.posX + f - 1.0F + (float)k, this.posY, 0.0F);
GL11.glTexCoord2f(((float)i + f - 1.0F) / 128.0F, ((float)j + 7.99F) / 128.0F);
GL11.glVertex3f(this.posX + f - 1.0F - (float)k, this.posY + 7.99F, 0.0F);
GL11.glEnd();
return (float)l;
}
示例11: flushBuffer
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Flush the currently cached data down to the card
*/
private void flushBuffer() {
if (vertIndex == 0) {
return;
}
if (currentType == NONE) {
return;
}
if (vertIndex < TOLERANCE) {
GL11.glBegin(currentType);
for (int i=0;i<vertIndex;i++) {
GL11.glColor4f(cols[(i*4)+0], cols[(i*4)+1], cols[(i*4)+2], cols[(i*4)+3]);
GL11.glTexCoord2f(texs[(i*2)+0], texs[(i*2)+1]);
GL11.glVertex3f(verts[(i*3)+0], verts[(i*3)+1], verts[(i*3)+2]);
}
GL11.glEnd();
currentType = NONE;
return;
}
vertices.clear();
colors.clear();
textures.clear();
vertices.put(verts,0,vertIndex*3);
colors.put(cols,0,vertIndex*4);
textures.put(texs,0,vertIndex*2);
vertices.flip();
colors.flip();
textures.flip();
GL11.glVertexPointer(3,0,vertices);
GL11.glColorPointer(4,0,colors);
GL11.glTexCoordPointer(2,0,textures);
GL11.glDrawArrays(currentType, 0, vertIndex);
currentType = NONE;
}
示例12: drawChar
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Draws the character.
*
* @param character The character to be drawn.
* @param characterData The character texture set to be used.
*/
private void drawChar(char character, CharacterData[] characterData, float x, float y) {
// The char data that stores the character data.
CharacterData charData = characterData[character];
// Binds the character data texture.
charData.bind();
GL11.glPushMatrix();
// Enables blending.
GL11.glEnable(GL11.GL_BLEND);
// Sets the blending function.
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// Begins drawing the quad.
GL11.glBegin(GL11.GL_QUADS); {
// Maps out where the texture should be drawn.
GL11.glTexCoord2f(0, 0);
GL11.glVertex2d(x, y);
GL11.glTexCoord2f(0, 1);
GL11.glVertex2d(x, y + charData.height);
GL11.glTexCoord2f(1, 1);
GL11.glVertex2d(x + charData.width, y + charData.height);
GL11.glTexCoord2f(1, 0);
GL11.glVertex2d(x + charData.width, y);
}
// Ends the quad.
GL11.glEnd();
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
// Binds the opengl texture by the texture id.
GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
}
示例13: drawComposite
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawComposite()
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(0.0F, 0.0F);
GL11.glVertex3f(0.0F, 0.0F, 0.0F);
GL11.glTexCoord2f(1.0F, 0.0F);
GL11.glVertex3f(1.0F, 0.0F, 0.0F);
GL11.glTexCoord2f(1.0F, 1.0F);
GL11.glVertex3f(1.0F, 1.0F, 0.0F);
GL11.glTexCoord2f(0.0F, 1.0F);
GL11.glVertex3f(0.0F, 1.0F, 0.0F);
GL11.glEnd();
}
示例14: renderUnicodeChar
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Render a single Unicode character at current (posX,posY) location using one of the /font/glyph_XX.png files...
*/
private float renderUnicodeChar(char p_78277_1_, boolean p_78277_2_)
{
if (this.glyphWidth[p_78277_1_] == 0)
{
return 0.0F;
}
else
{
int i = p_78277_1_ / 256;
this.loadGlyphTexture(i);
int j = this.glyphWidth[p_78277_1_] >>> 4;
int k = this.glyphWidth[p_78277_1_] & 15;
float f = (float)j;
float f1 = (float)(k + 1);
float f2 = (float)(p_78277_1_ % 16 * 16) + f;
float f3 = (float)((p_78277_1_ & 255) / 16 * 16);
float f4 = f1 - f - 0.02F;
float f5 = p_78277_2_ ? 1.0F : 0.0F;
GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
GL11.glTexCoord2f(f2 / 256.0F, f3 / 256.0F);
GL11.glVertex3f(this.posX + f5, this.posY, 0.0F);
GL11.glTexCoord2f(f2 / 256.0F, (f3 + 15.98F) / 256.0F);
GL11.glVertex3f(this.posX - f5, this.posY + 7.99F, 0.0F);
GL11.glTexCoord2f((f2 + f4) / 256.0F, f3 / 256.0F);
GL11.glVertex3f(this.posX + f4 / 2.0F + f5, this.posY, 0.0F);
GL11.glTexCoord2f((f2 + f4) / 256.0F, (f3 + 15.98F) / 256.0F);
GL11.glVertex3f(this.posX + f4 / 2.0F - f5, this.posY + 7.99F, 0.0F);
GL11.glEnd();
return (f1 - f) / 2.0F + 1.0F;
}
}
示例15: renderUnicodeChar
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Render a single Unicode character at current (posX,posY) location using one of the /font/glyph_XX.png files...
*/
private float renderUnicodeChar(char p_78277_1_, boolean p_78277_2_)
{
if (this.glyphWidth[p_78277_1_] == 0)
{
return 0.0F;
}
else
{
int i = p_78277_1_ / 256;
this.loadGlyphTexture(i);
int j = this.glyphWidth[p_78277_1_] >>> 4;
int k = this.glyphWidth[p_78277_1_] & 15;
j = j & 15;
float f = (float)j;
float f1 = (float)(k + 1);
float f2 = (float)(p_78277_1_ % 16 * 16) + f;
float f3 = (float)((p_78277_1_ & 255) / 16 * 16);
float f4 = f1 - f - 0.02F;
float f5 = p_78277_2_ ? 1.0F : 0.0F;
GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
GL11.glTexCoord2f(f2 / 256.0F, f3 / 256.0F);
GL11.glVertex3f(this.posX + f5, this.posY, 0.0F);
GL11.glTexCoord2f(f2 / 256.0F, (f3 + 15.98F) / 256.0F);
GL11.glVertex3f(this.posX - f5, this.posY + 7.99F, 0.0F);
GL11.glTexCoord2f((f2 + f4) / 256.0F, f3 / 256.0F);
GL11.glVertex3f(this.posX + f4 / 2.0F + f5, this.posY, 0.0F);
GL11.glTexCoord2f((f2 + f4) / 256.0F, (f3 + 15.98F) / 256.0F);
GL11.glVertex3f(this.posX + f4 / 2.0F - f5, this.posY + 7.99F, 0.0F);
GL11.glEnd();
return (f1 - f) / 2.0F + 1.0F;
}
}