本文整理汇总了Java中org.lwjgl.opengl.GL11.glColor4f方法的典型用法代码示例。如果您正苦于以下问题:Java GL11.glColor4f方法的具体用法?Java GL11.glColor4f怎么用?Java GL11.glColor4f使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.opengl.GL11
的用法示例。
在下文中一共展示了GL11.glColor4f方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rect
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void rect(double x1, double y1, double x2, double y2, int color) {
float r = (float)(color >> 16 & 255) / 255.0f;
float g = (float)(color >> 8 & 255) / 255.0f;
float b = (float)(color & 255) / 255.0f;
float a = (float)(color >> 24 & 255) / 255.0f;
Tessellator tes = Tessellator.getInstance();
WorldRenderer t = tes.getWorldRenderer();
GL11.glEnable((int)3042);
GL11.glDisable((int)3553);
OpenGlHelper.glBlendFunc((int)770, (int)771, (int)1, (int)0);
GL11.glColor4f((float)r, (float)g, (float)b, (float)a);
t.begin(7, DefaultVertexFormats.POSITION);
t.pos(x1, y2, 0.0).endVertex();
t.pos(x2, y2, 0.0).endVertex();
t.pos(x2, y1, 0.0).endVertex();
t.pos(x1, y1, 0.0).endVertex();
tes.draw();
GL11.glEnable((int)3553);
GL11.glColor4f((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f);
GL11.glDisable((int)3042);
}
示例2: enableLighting
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void enableLighting() {
GL11.glDisable((int)3042);
GL11.glEnable((int)3553);
GL11.glDisable((int)2848);
GL11.glDisable((int)3042);
OpenGlHelper.setActiveTexture((int)OpenGlHelper.lightmapTexUnit);
GL11.glMatrixMode((int)5890);
GL11.glLoadIdentity();
float var3 = 0.0039063f;
GL11.glScalef((float)var3, (float)var3, (float)var3);
GL11.glTranslatef((float)8.0f, (float)8.0f, (float)8.0f);
GL11.glMatrixMode((int)5888);
GL11.glTexParameteri((int)3553, (int)10241, (int)9729);
GL11.glTexParameteri((int)3553, (int)10240, (int)9729);
GL11.glTexParameteri((int)3553, (int)10242, (int)10496);
GL11.glTexParameteri((int)3553, (int)10243, (int)10496);
GL11.glColor4f((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f);
OpenGlHelper.setActiveTexture((int)OpenGlHelper.defaultTexUnit);
}
示例3: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void render(float alpha)
{
columns.render(alpha);
Vec2 pos = getPos();
Vec2 radius = getRadius();
GL11.glLineWidth(1.0f);
GL11.glColor4f(1.0f, 1.0f, 1.0f, alpha);
GL11.glBegin(GL11.GL_LINE_LOOP);
GL11.glVertex2f(pos.x - radius.x, pos.y - radius.y);
GL11.glVertex2f(pos.x - radius.x, pos.y + radius.y);
GL11.glVertex2f(pos.x + radius.x, pos.y + radius.y);
GL11.glVertex2f(pos.x + radius.x, pos.y - radius.y);
GL11.glEnd();
}
示例4: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void render()
{
String version = getVersionString();
// draw version background
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
if(WurstClient.INSTANCE.mods.rainbowUiMod.isActive())
{
float[] acColor = WurstClient.INSTANCE.getGui().getAcColor();
GL11.glColor4f(acColor[0], acColor[1], acColor[2], 0.5F);
}else
GL11.glColor4f(1, 1, 1, 0.5F);
drawQuads(0, 6, Fonts.segoe22.getStringWidth(version) + 76, 18);
// draw version string
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_DEPTH_TEST);
Fonts.segoe22.drawString(version, 74, 4, 0xFF000000);
// draw Wurst logo
GL11.glColor4f(1, 1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
Gui.drawModalRectWithCustomSizedTexture(0, 3, 0, 0, 72, 18, 72, 18);
}
示例5: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void render(float alpha)
{
if (Objects.equals(option, value))
{
Vec2 center = getPos();
GL11.glColor4f(1.0f, 1.0f, 1.0f, alpha*0.25f);
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex2f(center.x - radius.x, center.y - radius.y);
GL11.glVertex2f(center.x - radius.x, center.y + radius.y);
GL11.glVertex2f(center.x + radius.x, center.y + radius.y);
GL11.glVertex2f(center.x + radius.x, center.y - radius.y);
GL11.glEnd();
}
GL11.glLineWidth(1.0f);
float color = Main.instance().getFocus() == this ? 0.75f : 1.0f;
GL11.glColor4f(color, color, 1.0f, alpha);
font.render(label, pos, FONT_SIZE, align);
}
示例6: 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;
}
示例7: drawWayPointTracer
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawWayPointTracer(Waypoint w)
{
try
{
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDepthMask(false);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_BLEND);
GL11.glLineWidth(1.5F);
GL11.glColor3d(w.red, w.green, w.blue);
GL11.glBegin(GL11.GL_LINE_LOOP);
Vec3d eyes = new Vec3d(0, 0, 1).rotatePitch(-(float) Math.toRadians(Wrapper.getPlayer().rotationPitch)).rotateYaw(-(float) Math.toRadians(Wrapper.getPlayer().rotationYaw));
GL11.glVertex3d(eyes.xCoord, Wrapper.getPlayer().getEyeHeight() + eyes.yCoord, eyes.zCoord);
GL11.glVertex3d(w.dX + 0.5, w.dY + 0.5, w.dZ + 0.5);
GL11.glEnd();
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glPopMatrix();
}catch(Exception e) {}
}
示例8: drawGuiContainerBackgroundLayer
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) {
super.drawGuiContainerBackgroundLayer(opacity, x, y);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
renderAir();
}
示例9: drawGuiContainerBackgroundLayer
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
protected void drawGuiContainerBackgroundLayer(float f)
{
int i = mc.renderEngine.getTexture("/gui/trap.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(i);
int j = (width - xSize) / 2;
int k = (height - ySize) / 2;
drawTexturedModalRect(j, k, 0, 0, xSize, ySize);
}
示例10: renderPortalOverlay
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
private void renderPortalOverlay(float f, int i, int j)
{
if(f < 1.0F)
{
f *= f;
f *= f;
f = f * 0.8F + 0.2F;
}
GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
GL11.glDisable(2929 /*GL_DEPTH_TEST*/);
GL11.glDepthMask(false);
GL11.glBlendFunc(770, 771);
GL11.glColor4f(1.0F, 1.0F, 1.0F, f);
GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/terrain.png"));
float f1 = (float)(Block.portal.blockIndexInTexture % 16) / 16F;
float f2 = (float)(Block.portal.blockIndexInTexture / 16) / 16F;
float f3 = (float)(Block.portal.blockIndexInTexture % 16 + 1) / 16F;
float f4 = (float)(Block.portal.blockIndexInTexture / 16 + 1) / 16F;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(0.0D, j, -90D, f1, f4);
tessellator.addVertexWithUV(i, j, -90D, f3, f4);
tessellator.addVertexWithUV(i, 0.0D, -90D, f3, f2);
tessellator.addVertexWithUV(0.0D, 0.0D, -90D, f1, f2);
tessellator.draw();
GL11.glDepthMask(true);
GL11.glEnable(2929 /*GL_DEPTH_TEST*/);
GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
示例11: color
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void color(final float colorRed, final float colorGreen, final float colorBlue, final float colorAlpha) {
GL11.glColor4f(colorRed, colorGreen, colorBlue, colorAlpha);
}
示例12: glColor
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void glColor(Color color) {
GL11.glColor4f((float)((float)color.getRed() / 255.0f), (float)((float)color.getGreen() / 255.0f), (float)((float)color.getBlue() / 255.0f), (float)((float)color.getAlpha() / 255.0f));
}
示例13: drawQuads
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Draws Blocks
* @param location > Block Location
*/
public void drawQuads(Location location) {
if (color == null) return;
GL11.glColor4f(color.getX(), color.getY(), color.getZ(), color.getYaw());
int x = location.getBlockX();
int y = location.getBlockY();
int z = location.getBlockZ();
/*
* Block Top
*/
Block top = location.add(0, 1, 0).getBlock();
if (top == null || top.isTransparent()) {
this.setTopData(x, y, z, 1.0f, 1.0f, 1.0f);
}
/*
* Block Bottom.
*/
Block bottom = location.add(0, -1, 0).getBlock();
if (bottom == null || bottom.isTransparent()) {
this.setBottomData(x, y, z, 1.0f, 1.0f, 1.0f);
}
/*
* Block Side
*/
GL11.glColor4f(color.getX() * 0.8f, color.getY() * 0.8f, color.getZ() * 0.8f, color.getYaw());
Block side_1 = location.add(0, 0, -1).getBlock();
if (side_1 == null || side_1.isTransparent()) {
setSideData(x + 1.0f, y, z, x, y + 1.0f, z);
}
Block side_2 = location.add(0, 0, 1).getBlock();
if (side_2 == null || side_2.isTransparent()) {
setSideData(x, y, z + 1.0f, x + 1.0f, y + 1.0f, z + 1.0f);
}
GL11.glColor4f(color.getX() * 0.7f, color.getY() * 0.7f, color.getZ() * 0.7f, color.getYaw());
Block side_3 = location.add(1, 0, 0).getBlock();
if (side_3 == null || side_3.isTransparent()) {
setSideData(x + 1.0f, y, z + 1.0f, x + 1.0f, y + 1.0f, z);
}
Block side_4 = location.add(-1, 0, 0).getBlock();
if (side_4 == null || side_4.isTransparent()) {
setSideData(x, y, z, x, y + 1.0f, z + 1.0f);
}
}
示例14: onRender
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void onRender(float partialTicks)
{
// GL settings
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glLineWidth(2);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glPushMatrix();
GL11.glTranslated(-mc.getRenderManager().renderPosX,
-mc.getRenderManager().renderPosY,
-mc.getRenderManager().renderPosZ);
// draw boxes
for(EntityPlayer entity : WMinecraft.getWorld().playerEntities)
{
if(entity == WMinecraft.getPlayer()
|| entity instanceof EntityFakePlayer)
continue;
if(!wurst.special.targetSpf.sleepingPlayers.isChecked()
&& entity.isPlayerSleeping())
continue;
if(!wurst.special.targetSpf.invisiblePlayers.isChecked()
&& entity.isInvisible())
continue;
// set color
if(wurst.friends.contains(entity.getName()))
GL11.glColor4f(0, 0, 1, 0.5F);
else
{
float factor =
WMinecraft.getPlayer().getDistanceToEntity(entity) / 20F;
if(factor > 2)
factor = 2;
GL11.glColor4f(2 - factor, factor, 0, 0.5F);
}
// set position
GL11.glPushMatrix();
GL11.glTranslated(
entity.prevPosX
+ (entity.posX - entity.prevPosX) * partialTicks,
entity.prevPosY
+ (entity.posY - entity.prevPosY) * partialTicks,
entity.prevPosZ
+ (entity.posZ - entity.prevPosZ) * partialTicks);
// draw box
RenderUtils.drawOutlinedBox(PLAYER_BOX);
GL11.glPopMatrix();
}
GL11.glPopMatrix();
// GL resets
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
示例15: drawButton
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void drawButton(Minecraft p_146112_1_, int p_146112_2_, int p_146112_3_)
{
if ( ! gradientFlag ) {
super.drawButton(p_146112_1_, p_146112_2_, p_146112_3_);
return ;
}
if (this.visible)
{
FontRenderer fontrenderer = p_146112_1_.fontRenderer;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_146123_n = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition && p_146112_2_ < this.xPosition + this.width && p_146112_3_ < this.yPosition + this.height;
int k = this.getHoverState(this.field_146123_n);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
if ( pressed ) {
k = 0 ;
}
int rgba = ( k == 0 ? -939458303 : k == 1 ? 1761673473 : -1694433023);// -1694433023 ) ;
this.drawGradientRect ( xPosition, yPosition, xPosition + width, yPosition+height, gradientVector ? 0 : rgba, gradientVector ? rgba : 0);
this.mouseDragged(p_146112_1_, p_146112_2_, p_146112_3_);
int l = 14737632;
if (packedFGColour != 0)
{
l = packedFGColour;
}
else if (!this.enabled || pressed)
{
l = -1258291201;
}
else if (this.field_146123_n)
{
l = -587202561;
}
this.drawCenteredString(fontrenderer, ( ( underlineFlag ? ( k > 1 || ( field_146123_n && stuckFlag ) ) : false ) ? EnumChatFormatting.UNDERLINE : "" ) + this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l);
}
}