本文整理汇总了Java中org.lwjgl.opengl.GL11.glVertex2d方法的典型用法代码示例。如果您正苦于以下问题:Java GL11.glVertex2d方法的具体用法?Java GL11.glVertex2d怎么用?Java GL11.glVertex2d使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.opengl.GL11
的用法示例。
在下文中一共展示了GL11.glVertex2d方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawGradientRect
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawGradientRect(double x, double y, double x2, double y2, int col1, int col2) {
GL11.glEnable((int)3042);
GL11.glDisable((int)3553);
GL11.glBlendFunc((int)770, (int)771);
GL11.glEnable((int)2848);
GL11.glShadeModel((int)7425);
GL11.glPushMatrix();
GL11.glBegin((int)7);
RenderUtils.glColor(col1);
GL11.glVertex2d((double)x2, (double)y);
GL11.glVertex2d((double)x, (double)y);
RenderUtils.glColor(col2);
GL11.glVertex2d((double)x, (double)y2);
GL11.glVertex2d((double)x2, (double)y2);
GL11.glEnd();
GL11.glPopMatrix();
GL11.glEnable((int)3553);
GL11.glDisable((int)3042);
GL11.glDisable((int)2848);
GL11.glShadeModel((int)7424);
}
示例2: 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();
}
示例3: drawFullCircle
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawFullCircle(int cx, int cy, double r, int c) {
GL11.glScalef(0.5F, 0.5F, 0.5F);
r *= 2;
cx *= 2;
cy *= 2;
float f = (float) (c >> 24 & 0xff) / 255F;
float f1 = (float) (c >> 16 & 0xff) / 255F;
float f2 = (float) (c >> 8 & 0xff) / 255F;
float f3 = (float) (c & 0xff) / 255F;
GL11.glEnable(3042);
GL11.glDisable(3553);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glBlendFunc(770, 771);
GL11.glColor4f(f1, f2, f3, f);
GL11.glBegin(GL11.GL_TRIANGLE_FAN);
for (int i = 0; i <= 360; i++) {
double x = Math.sin((i * Math.PI / 180)) * r;
double y = Math.cos((i * Math.PI / 180)) * r;
GL11.glVertex2d(cx + x, cy + y);
}
GL11.glEnd();
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glEnable(3553);
GL11.glDisable(3042);
GL11.glScalef(2F, 2F, 2F);
}
示例4: drawGradientBorderedRect
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawGradientBorderedRect(double x, double y, double x2, double y2, float l1, int col1, int col2, int col3) {
GlStateManager.enableBlend();
GlStateManager.disableTexture2D();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GL11.glPushMatrix();
RenderUtils.glColor(col1);
GL11.glLineWidth((float)1.0f);
GL11.glBegin((int)1);
GL11.glVertex2d((double)x, (double)y);
GL11.glVertex2d((double)x, (double)y2);
GL11.glVertex2d((double)x2, (double)y2);
GL11.glVertex2d((double)x2, (double)y);
GL11.glVertex2d((double)x, (double)y);
GL11.glVertex2d((double)x2, (double)y);
GL11.glVertex2d((double)x, (double)y2);
GL11.glVertex2d((double)x2, (double)y2);
GL11.glEnd();
GL11.glPopMatrix();
RenderUtils.drawGradientRect(x, y, x2, y2, col2, col3);
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
}
示例5: drawRect
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawRect(float paramXStart, float paramYStart, float paramXEnd, float paramYEnd, int paramColor)
{
float alpha = (float)(paramColor >> 24 & 0xFF) / 255F;
float red = (float)(paramColor >> 16 & 0xFF) / 255F;
float green = (float)(paramColor >> 8 & 0xFF) / 255F;
float blue = (float)(paramColor & 0xFF) / 255F;
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glColor4f(red, green, blue, alpha);
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex2d(paramXEnd, paramYStart);
GL11.glVertex2d(paramXStart, paramYStart);
GL11.glVertex2d(paramXStart, paramYEnd);
GL11.glVertex2d(paramXEnd, paramYEnd);
GL11.glEnd();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glPopMatrix();
}
示例6: drawRect
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawRect(float g, float h, float i, float j, Color c) {
GL11.glEnable(3042);
GL11.glDisable(3553);
GL11.glBlendFunc(770, 771);
GL11.glEnable(2848);
GL11.glPushMatrix();
glColor(c);
GL11.glBegin(7);
GL11.glVertex2d(i, h);
GL11.glVertex2d(g, h);
GL11.glVertex2d(g, j);
GL11.glVertex2d(i, j);
GL11.glEnd();
GL11.glPopMatrix();
GL11.glEnable(3553);
GL11.glDisable(3042);
GL11.glDisable(2848);
}
示例7: 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);
}
示例8: drawFullCircle
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawFullCircle(int cx, int cy, double r, int c) {
r *= 2.0;
cx *= 2;
cy *= 2;
float f = (float)(c >> 24 & 255) / 255.0f;
float f1 = (float)(c >> 16 & 255) / 255.0f;
float f2 = (float)(c >> 8 & 255) / 255.0f;
float f3 = (float)(c & 255) / 255.0f;
RenderUtils.enableGL2D();
GL11.glScalef((float)0.5f, (float)0.5f, (float)0.5f);
GL11.glColor4f((float)f1, (float)f2, (float)f3, (float)f);
GL11.glBegin((int)6);
int i = 0;
while (i <= 360) {
double x = Math.sin((double)i * 3.141592653589793 / 180.0) * r;
double y = Math.cos((double)i * 3.141592653589793 / 180.0) * r;
GL11.glVertex2d((double)((double)cx + x), (double)((double)cy + y));
++i;
}
GL11.glEnd();
GL11.glScalef((float)2.0f, (float)2.0f, (float)2.0f);
RenderUtils.disableGL2D();
}
示例9: drawGradientBorderedRect
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawGradientBorderedRect(double x, double y, double x2, double y2, float l1, int col1, int col2, int col3)
{
float f = (float)(col1 >> 24 & 0xFF) / 255F;
float f1 = (float)(col1 >> 16 & 0xFF) / 255F;
float f2 = (float)(col1 >> 8 & 0xFF) / 255F;
float f3 = (float)(col1 & 0xFF) / 255F;
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPushMatrix();
GL11.glColor4f(f1, f2, f3, f);
GL11.glLineWidth(1F);
GL11.glBegin(GL11.GL_LINES);
GL11.glVertex2d(x, y);
GL11.glVertex2d(x, y2);
GL11.glVertex2d(x2, y2);
GL11.glVertex2d(x2, y);
GL11.glVertex2d(x, y);
GL11.glVertex2d(x2, y);
GL11.glVertex2d(x, y2);
GL11.glVertex2d(x2, y2);
GL11.glEnd();
GL11.glPopMatrix();
drawGradientRect(x, y, x2, y2, col2, col3);
GL11.glEnable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
示例10: drawRect
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawRect(float x, float y, float width, float height, int color) {
enableRender2D();
glColor(color);
GL11.glBegin(7);
GL11.glVertex2d(x, y);
GL11.glVertex2d(x + width, y);
GL11.glVertex2d(x + width, y + height);
GL11.glVertex2d(x, y + height);
GL11.glEnd();
disableRender2D();
}
示例11: drawLine
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
private void drawLine(double x, double y, double x1, double y1, float width)
{
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glLineWidth(width);
GL11.glBegin(GL11.GL_LINES);
GL11.glVertex2d(x, y);
GL11.glVertex2d(x1, y1);
GL11.glEnd();
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
示例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: drawScreen
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
// middle
int middleX = width / 2;
int middleY = height / 2;
// background positions
int x1 = middleX - 100;
int y1 = middleY + 15;
int x2 = middleX + 100;
int y2 = middleY + 26;
// background
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glColor4f(0, 0, 0, 0.5F);
GL11.glBegin(GL11.GL_QUADS);
{
GL11.glVertex2d(x1, y1);
GL11.glVertex2d(x2, y1);
GL11.glVertex2d(x2, y2);
GL11.glVertex2d(x1, y2);
}
GL11.glEnd();
GL11.glColor4f(1, 1, 1, 1);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_CULL_FACE);
// name field
nameField.drawTextBox();
// buttons
super.drawScreen(mouseX, mouseY, partialTicks);
}
示例14: renderMinimizeButton
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
private void renderMinimizeButton(int x1, int y1, int x2, int y2,
boolean hovering, boolean minimized)
{
renderTitleBarButton(x1, y1, x2, y2, hovering);
double xa1 = x1 + 1;
double xa2 = (x1 + x2) / 2.0;
double xa3 = x2 - 1;
double ya1;
double ya2;
if(minimized)
{
ya1 = y1 + 3;
ya2 = y2 - 2.5;
GL11.glColor4f(0, hovering ? 1 : 0.85F, 0, 1);
}else
{
ya1 = y2 - 3;
ya2 = y1 + 2.5;
GL11.glColor4f(hovering ? 1 : 0.85F, 0, 0, 1);
}
// arrow
GL11.glBegin(GL11.GL_TRIANGLES);
GL11.glVertex2d(xa1, ya1);
GL11.glVertex2d(xa3, ya1);
GL11.glVertex2d(xa2, ya2);
GL11.glEnd();
// outline
GL11.glColor4f(0.0625F, 0.0625F, 0.0625F, 0.5F);
GL11.glBegin(GL11.GL_LINE_LOOP);
GL11.glVertex2d(xa1, ya1);
GL11.glVertex2d(xa3, ya1);
GL11.glVertex2d(xa2, ya2);
GL11.glEnd();
}
示例15: drawBorderedRect
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawBorderedRect(double x, double y, double x2, double y2, float l1, int col1, int col2) {
drawRect((float)x, (float)y, (float)x2, (float)y2, col2);
float f = (float)(col1 >> 24 & 0xFF) / 255F;
float f1 = (float)(col1 >> 16 & 0xFF) / 255F;
float f2 = (float)(col1 >> 8 & 0xFF) / 255F;
float f3 = (float)(col1 & 0xFF) / 255F;
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glColor4f(f1, f2, f3, f);
GL11.glLineWidth(l1);
GL11.glBegin(GL11.GL_LINES);
GL11.glVertex2d(x, y);
GL11.glVertex2d(x, y2);
GL11.glVertex2d(x2, y2);
GL11.glVertex2d(x2, y);
GL11.glVertex2d(x, y);
GL11.glVertex2d(x2, y);
GL11.glVertex2d(x, y2);
GL11.glVertex2d(x2, y2);
GL11.glEnd();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glPopMatrix();
}