org.lwjgl.opengl.GL11 Java Examples

The following examples show how to use org.lwjgl.opengl.GL11. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImmediateModeOGLRenderer.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 7 votes vote down vote up
/**
 * @see org.newdawn.slick.opengl.renderer.SGL#initDisplay(int, int)
 */
public void initDisplay(int width, int height) {
	this.width = width;
	this.height = height;
	
	String extensions = GL11.glGetString(GL11.GL_EXTENSIONS);
	
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glShadeModel(GL11.GL_SMOOTH);        
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	GL11.glDisable(GL11.GL_LIGHTING);                    
       
	GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);                
       GL11.glClearDepth(1);                                       
       
       GL11.glEnable(GL11.GL_BLEND);
       GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
       
       GL11.glViewport(0,0,width,height);
	GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
 
Example #2
Source File: GuiButtonSpecial.java    From Signals with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks){
    if(thisVisible) super.drawButton(mc, mouseX, mouseY, partialTicks);

    if(visible) {
        if(renderedStacks != null) {
            int middleX = this.x + width / 2;
            int startX = middleX - renderedStacks.length * 9 + 1;
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            RenderHelper.enableGUIStandardItemLighting();
            for(int i = 0; i < renderedStacks.length; i++) {
                itemRenderer.renderItemAndEffectIntoGUI(renderedStacks[i], startX + i * 18, this.y + 2);
            }
            RenderHelper.disableStandardItemLighting();
            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        }
        if(resLoc != null) {
            mc.getTextureManager().bindTexture(resLoc);
            drawModalRectWithCustomSizedTexture(this.x + width / 2 - 8, this.y + 2, 0, 0, 16, 16, 16, 16);
        }
        if(enabled && !thisVisible && mouseX >= this.x && mouseY >= this.y && mouseX < this.x + width && mouseY < this.y + height) {
            Gui.drawRect(this.x, this.y, this.x + width, this.y + height, invisibleHoverColor);
        }
    }
}
 
Example #3
Source File: GLUtils.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
public static void drawFullCircle(int cx, int cy, double r, int c) {
    GL11.glScalef(0.5f, 0.5f, 0.5f);
    r *= 2.0;
    cx *= 2;
    cy *= 2;
    float f = (c >> 24 & 255) / 255.0f;
    float f1 = (c >> 16 & 255) / 255.0f;
    float f2 = (c >> 8 & 255) / 255.0f;
    float f3 = (c & 255) / 255.0f;
    GL11.glEnable(3042);
    GL11.glDisable(3553);
    GL11.glEnable(2848);
    GL11.glBlendFunc(770, 771);
    GL11.glColor4f(f1, f2, f3, f);
    GL11.glBegin(6);
    for (int i = 0; i <= 360; ++i) {
        double x = Math.sin(i * 3.141592653589793 / 180.0) * r;
        double y = Math.cos(i * 3.141592653589793 / 180.0) * r;
        GL11.glVertex2d((cx + x), (cy + y));
    }
    GL11.glEnd();
    GL11.glDisable(2848);
    GL11.glEnable(3553);
    GL11.glDisable(3042);
    GL11.glScalef(2.0f, 2.0f, 2.0f);
}
 
Example #4
Source File: TextureURL.java    From Custom-Main-Menu with MIT License 6 votes vote down vote up
@Override
public void bind()
{
	if (this.textureID != -1)
	{
		GlStateManager.bindTexture(this.textureID);
	}
	else
	{
		if (bi != null)
		{
			setTextureID(TextureUtil.uploadTextureImageAllocate(GL11.glGenTextures(), bi, false, false));
			bind();
			return;
		}
		CustomMainMenu.bindTransparent();
	}
}
 
Example #5
Source File: WidgetVerticalScrollbar.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTick){
    GL11.glColor4d(1, 1, 1, 1);
    if(!Mouse.isButtonDown(0)) dragging = false;
    if(!wasClicking && Mouse.isButtonDown(0) && getBounds().contains(mouseX, mouseY)) {
        dragging = true;
    }
    if(!enabled) dragging = false;
    wasClicking = Mouse.isButtonDown(0);
    if(dragging) currentScroll = (float)(mouseY - 7 - getBounds().y) / (getBounds().height - 17);
    currentScroll = MathHelper.clamp_float(currentScroll, 0, 1);
    Minecraft.getMinecraft().getTextureManager().bindTexture(scrollTexture);
    Gui.func_146110_a(x, y, 12, 0, getBounds().width, 1, 26, 15);
    for(int i = 0; i < getBounds().height - 2; i++)
        Gui.func_146110_a(x, y + 1 + i, 12, 1, getBounds().width, 1, 26, 15);
    Gui.func_146110_a(x, y + getBounds().height - 1, 12, 14, getBounds().width, 1, 26, 15);

    if(!enabled) GL11.glColor4d(0.6, 0.6, 0.6, 1);
    Gui.func_146110_a(x + 1, y + 1 + (int)((getBounds().height - 17) * currentScroll), 0, 0, 12, 15, 26, 15);
    GL11.glColor4d(1, 1, 1, 1);
}
 
Example #6
Source File: GuiSolderingStation.java    From ExtraCells1 with MIT License 6 votes vote down vote up
@Override
public void drawScreen(int x, int y, float f)
{
	drawDefaultBackground();
	int posX = (this.width - xSize) / 2;
	int posY = (this.height - ySize) / 2;

	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	Minecraft.getMinecraft().renderEngine.bindTexture(guiTexture);

	drawTexturedModalRect(posX, posY, 0, 0, xSize, ySize);

	if (rightItem)
	{
		textfield_size.drawTextBox();
		textfield_types.drawTextBox();
	} else
	{
		this.fontRenderer.drawSplitString(StatCollector.translateToLocal("tooltip.solderingwarning.tutorial"), posX + 3, posY + 25, 170, 0x000064);
	}
	super.drawScreen(x, y, f);
}
 
Example #7
Source File: GenericShader.java    From LWJGUI with MIT License 6 votes vote down vote up
protected static int createProgram(int vertexShaderId, int[] fragmentShaderIds, String[] attrs, int[] indices) {

		// build the shader program
		int id = GL20.glCreateProgram();
		GL20.glAttachShader(id, vertexShaderId);
		for (int fragmentShaderId : fragmentShaderIds) {
			GL20.glAttachShader(id, fragmentShaderId);
		}

		assert (attrs.length == indices.length);
		for (int i=0; i<attrs.length; i++) {
			GL20.glBindAttribLocation(id, indices[i], attrs[i]);
		}

		GL20.glLinkProgram(id);
		boolean isSuccess = GL20.glGetProgrami(id, GL20.GL_LINK_STATUS) == GL11.GL_TRUE;
		if (!isSuccess) {
			throw new RuntimeException("Shader program did not link:\n" + GL20.glGetProgramInfoLog(id, 4096));
		}

		return id;
	}
 
Example #8
Source File: LightningRenderer.java    From tribaltrouble with GNU General Public License v2.0 6 votes vote down vote up
private static void render(RenderQueues render_queues, Lightning lightning) {
	if (Globals.isBoundsEnabled(Globals.BOUNDING_PLAYERS)) {
		RenderTools.draw(lightning, 1f, 1f, 1f);
	}

	GL11.glBindTexture(GL11.GL_TEXTURE_2D, render_queues.getTexture(lightning.getTexture()).getHandle());
	GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
	GL11.glBegin(GL11.GL_QUADS);

	List particles = lightning.getParticles();
	for (int i = particles.size() - 1; i >= 0; i--) {
		StretchParticle particle = (StretchParticle)particles.get(i);
		render2DParticle(particle);
	}

	GL11.glEnd();
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_REPLACE);
}
 
Example #9
Source File: MobEspHack.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
private void renderBoxes(double partialTicks)
{
	double extraSize = boxSize.getSelected().extraSize;
	
	for(MobEntity e : mobs)
	{
		GL11.glPushMatrix();
		
		GL11.glTranslated(e.prevX + (e.getX() - e.prevX) * partialTicks,
			e.prevY + (e.getY() - e.prevY) * partialTicks,
			e.prevZ + (e.getZ() - e.prevZ) * partialTicks);
		
		GL11.glScaled(e.getWidth() + extraSize, e.getHeight() + extraSize,
			e.getWidth() + extraSize);
		
		float f = MC.player.distanceTo(e) / 20F;
		GL11.glColor4f(2 - f, f, 0, 0.5F);
		
		GL11.glCallList(mobBox);
		
		GL11.glPopMatrix();
	}
}
 
Example #10
Source File: PlayerInventory.java    From TFC2 with GNU General Public License v3.0 6 votes vote down vote up
public static void drawInventory(GuiContainer container, int screenWidth, int screenHeight, int upperGuiHeight)
{
	Core.bindTexture(invTexture);
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	int guiX = (screenWidth - invXSize) / 2;
	int guiY = (screenHeight - (upperGuiHeight+invYSize)) / 2 + upperGuiHeight;
	container.drawTexturedModalRect(guiX, guiY, 0, 0, invXSize, invYSize);

	//encumbrance bar
	float eMult = Math.min(Core.getEncumbrance(net.minecraft.client.Minecraft.getMinecraft().player.inventory.mainInventory) / 80f, 1.0f);
	if(eMult < 0.5)
		GL11.glColor4f(0.0F, 0.8F, 0.0F, 1.0F);
	else if(eMult < 0.75)
		GL11.glColor4f(1.0F, 0.8F, 0.0F, 1.0F);
	else
		GL11.glColor4f(0.8F, 0.0F, 0.0F, 1.0F);
	container.drawTexturedModalRect(guiX+8, guiY+5, 2, 245, (int)(160 * eMult), 3);
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	//encumbrance meter
	container.drawTexturedModalRect(guiX+7, guiY+4, 1, 249, 162, 5);
}
 
Example #11
Source File: TileEntityWrathCageRenderer.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 6 votes vote down vote up
public static void renderMob(WrathSpawnerLogic spawnLogic, double par1, double y, double par5, float par7) {
    Entity entity = spawnLogic.getEntityForRender();

    if (entity != null) {
        entity.setWorld(spawnLogic.getSpawnerWorld());
        float f1 = 0.4375F;
        if (spawnLogic.getEntityNameToSpawn().equals("Ghast"))
            f1 = 0.1F;
        else if (spawnLogic.getEntityNameToSpawn().equals("Slime") || spawnLogic.getEntityNameToSpawn().equals("ThaumSlime"))
            f1 = 0.4F;
        else if (spawnLogic.getEntityNameToSpawn().equals("Enderman"))
            f1 = 0.3F;
        GL11.glTranslatef(0.0F, 0.4F, 0.0F);
        if (!spawnLogic.getSpawnerWorld().isBlockIndirectlyGettingPowered(spawnLogic.getSpawnerX(), spawnLogic.getSpawnerY(), spawnLogic.getSpawnerZ()))
            GL11.glRotatef((float) (spawnLogic.field_98284_d + (spawnLogic.field_98287_c - spawnLogic.field_98284_d) * (double) par7) * 10.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F);
        GL11.glTranslatef(0.0F, -0.4F, 0.0F);
        GL11.glScalef(f1, f1, f1);
        entity.setLocationAndAngles(par1, y, par5, 0.0F, 0.0F);
        RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, par7);
    }
}
 
Example #12
Source File: GuiIngame.java    From The-5zig-Mod with GNU General Public License v3.0 6 votes vote down vote up
private void renderTextAboveHotbar() {
	int scaledWidth = The5zigMod.getVars().getScaledWidth();
	int scaledHeight = The5zigMod.getVars().getScaledHeight();
	if (this.hoverTextTime > 0) {
		int l3 = (int) (this.hoverTextTime * 256.0F / 10.0F);
		if (l3 > 255) {
			l3 = 255;
		}
		GLUtil.pushMatrix();
		GLUtil.translate((float) (scaledWidth / 2), (float) (scaledHeight - 78), 0.0F);
		GLUtil.enableBlend();
		GLUtil.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_FALSE, GL11.GL_TRUE);

		The5zigMod.getVars().drawString(this.hoverText, -The5zigMod.getVars().getStringWidth(this.hoverText) / 2, -4, 0xD33D3A + (l3 << 24));
		GLUtil.disableBlend();
		GLUtil.popMatrix();
	}
}
 
Example #13
Source File: EditBlockScreen.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
private void renderIcon(MatrixStack matrixStack, ItemStack stack, int x,
	int y, boolean large)
{
	GL11.glPushMatrix();
	
	GL11.glTranslated(x, y, 0);
	double scale = large ? 1.5 : 0.75;
	GL11.glScaled(scale, scale, scale);
	
	DiffuseLighting.enable();
	ItemStack grass = new ItemStack(Blocks.GRASS_BLOCK);
	ItemStack renderStack = !stack.isEmpty() ? stack : grass;
	WurstClient.MC.getItemRenderer().renderInGuiWithOverrides(renderStack,
		0, 0);
	DiffuseLighting.disable();
	
	GL11.glPopMatrix();
	
	if(stack.isEmpty())
		renderQuestionMark(matrixStack, x, y, large);
}
 
Example #14
Source File: ClickGui.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
public void renderPinnedWindows(MatrixStack matrixStack, float partialTicks)
{
	GL11.glDisable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glShadeModel(GL11.GL_SMOOTH);
	GL11.glLineWidth(1);
	
	for(Window window : windows)
		if(window.isPinned() && !window.isInvisible())
			renderWindow(matrixStack, window, Integer.MIN_VALUE,
				Integer.MIN_VALUE, partialTicks);
		
	GL11.glEnable(GL11.GL_CULL_FACE);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
}
 
Example #15
Source File: RenderGolemHelper.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void renderCore(EntityGolemBase golem, AdditionalGolemCore core) {
    GL11.glPushMatrix();

    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
    GL11.glTranslatef(0.0875F, -0.96F, 0.15F + (golem.getGolemDecoration().contains("P") ? 0.03F : 0.0F));
    GL11.glScaled(0.175D, 0.175D, 0.175D);
    GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);

    ItemStack coreItem = core.getItem();
    IIcon icon = coreItem.getItem().getIcon(coreItem, 0);
    float f1 = icon.getMaxU();
    float f2 = icon.getMinV();
    float f3 = icon.getMinU();
    float f4 = icon.getMaxV();
    Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
    ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f3, f4, icon.getIconWidth(), icon.getIconHeight(), 0.2F);

    GL11.glPopMatrix();
}
 
Example #16
Source File: PlayerEspHack.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void onRenderWorldLast(RenderWorldLastEvent event)
{
	// 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(-TileEntityRendererDispatcher.staticPlayerX,
		-TileEntityRendererDispatcher.staticPlayerY,
		-TileEntityRendererDispatcher.staticPlayerZ);
	
	double partialTicks = event.getPartialTicks();
	
	if(style.getSelected().boxes)
		renderBoxes(partialTicks);
	
	if(style.getSelected().lines)
		renderLines(partialTicks);
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example #17
Source File: MixinTileEntityChestRenderer.java    From LiquidBounce with GNU General Public License v3.0 5 votes vote down vote up
@Inject(method = "renderTileEntityAt", at = @At("RETURN"))
private void injectChamsPost(CallbackInfo callbackInfo) {
    final Chams chams = (Chams) LiquidBounce.moduleManager.getModule(Chams.class);

    if (chams.getState() && chams.getChestsValue().get()) {
        GL11.glPolygonOffset(1.0F, 1000000F);
        GL11.glDisable(GL11.GL_POLYGON_OFFSET_FILL);
    }
}
 
Example #18
Source File: WidgetFluidTank.java    From ExtraCells1 with MIT License 5 votes vote down vote up
public void draw(int guiX, int guiY, int mouseX, int mouseY)
{
	if (tank == null || 73 < 31)
		return;

	GL11.glDisable(GL11.GL_LIGHTING);
	GL11.glColor3f(1.0F, 1.0F, 1.0F);

	Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("extracells", "textures/gui/fluidtank.png"));
	drawTexturedModalRect(posX, posY, 0, 0, 18, 73);

	int iconHeightRemainder = (73 - 4) % 16;

	FluidStack fluid = tank.getFluid();
	if (fluid != null && fluid.amount > 0)
	{
		Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);

		Icon fluidIcon = fluid.getFluid().getStillIcon();

		if (iconHeightRemainder > 0)
		{
			drawTexturedModelRectFromIcon(posX + 1, posY + 2, fluidIcon, 16, iconHeightRemainder);
		}
		for (int i = 0; i < (73 - 6) / 16; i++)
		{
			drawTexturedModelRectFromIcon(posX + 1, posY + 2 + i * 16 + iconHeightRemainder, fluidIcon, 16, 16);
		}

		Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("extracells", "textures/gui/fluidtank.png"));
		drawTexturedModalRect(posX + 2, posY + 1, 1, 1, 15, 72 - ((int) ((73) * ((float) fluid.amount / tank.getCapacity()))));
	}

	Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("extracells", "textures/gui/fluidtank.png"));
	drawTexturedModalRect(posX + 1, posY + 1, 19, 1, 16, 73);

	GL11.glEnable(GL11.GL_LIGHTING);
}
 
Example #19
Source File: BoxRenderer.java    From OpenModsLib with MIT License 5 votes vote down vote up
protected void renderRightEdge(Gui gui, int width, int height) {
	GL11.glPushMatrix();
	GL11.glTranslatef(width - 3, 3, 0);
	GL11.glScaled(1, height - 7, 0);
	gui.drawTexturedModalRect(0, 0, u + 8, v, 3, 1);
	GL11.glPopMatrix();
}
 
Example #20
Source File: OffscreenRenderer.java    From tribaltrouble with GNU General Public License v2.0 5 votes vote down vote up
public final void dumpToFile(String filename) {
	GLIntImage image = new GLIntImage(width, height, GL11.GL_RGBA);
	GL11.glReadPixels(0, 0, image.getWidth(), image.getHeight(), image.getGLFormat(), image.getGLType(), image.getPixels());
	System.out.println("filename = " + filename);
	com.oddlabs.util.Utils.flip(image.getPixels(), image.getWidth()*4, image.getHeight());
	image.saveAsPNG(filename);
}
 
Example #21
Source File: PlayerEspHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@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.glDisable(GL11.GL_LIGHTING);
	
	GL11.glPushMatrix();
	RenderUtils.applyRenderOffset();
	
	// draw boxes
	if(style.getSelected().boxes)
		renderBoxes(partialTicks);
	
	if(style.getSelected().lines)
		renderTracers(partialTicks);
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example #22
Source File: LWJGL20DrawContext.java    From settlers-remake with MIT License 5 votes vote down vote up
@Override
public void drawTrianglesWithTextureColored(TextureHandle textureid, GeometryHandle shapeHandle, GeometryHandle colorHandle, int offset, int lines, int width, int stride, float x, float y) {
	bindTexture(textureid);

	if(backgroundVAO == -1) {
		if(glcaps.GL_ARB_vertex_array_object) {
			backgroundVAO = ARBVertexArrayObject.glGenVertexArrays();
			bindFormat(backgroundVAO);
		}
		GL20.glEnableVertexAttribArray(0);
		GL20.glEnableVertexAttribArray(1);
		GL20.glEnableVertexAttribArray(2);

		bindGeometry(shapeHandle);
		GL20.glVertexAttribPointer(0, 3, GL11.GL_FLOAT, false, 5 * 4, 0);
		GL20.glVertexAttribPointer(1, 2, GL11.GL_FLOAT, false, 5 * 4, 3 * 4);

		bindGeometry(colorHandle);
		GL20.glVertexAttribPointer(2, 1, GL11.GL_FLOAT, false, 0, 0);

		setObjectLabel(GL11.GL_VERTEX_ARRAY, backgroundVAO, "background-vao");
		setObjectLabel(KHRDebug.GL_BUFFER, shapeHandle.getInternalId(), "background-shape");
		setObjectLabel(KHRDebug.GL_BUFFER, colorHandle.getInternalId(), "background-color");
	}
	int starti = offset < 0 ? (int)Math.ceil(-offset/(float)stride) : 0;

	useProgram(prog_background);

	GL20.glUniform2f(prog_background.ufs[TRANS], x, y);

	bindFormat(backgroundVAO);
	for (int i = starti; i != lines; i++) {
		GL11.glDrawArrays(GL11.GL_TRIANGLES, (offset + stride * i) * 3, width * 3);
	}
}
 
Example #23
Source File: PBufferUniqueGraphics.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Enter the orthographic mode 
 */
protected void enterOrtho() {
	GL11.glMatrixMode(GL11.GL_PROJECTION);
	GL11.glLoadIdentity();
	GL11.glOrtho(0, screenWidth, 0, screenHeight, 1, -1);
	GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
 
Example #24
Source File: TrajectoriesHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
private void drawLine(ArrayList<Vec3d> path, Vec3d camPos)
{
	GL11.glBegin(GL11.GL_LINE_STRIP);
	GL11.glColor4f(0, 1, 0, 0.75F);
	
	for(Vec3d point : path)
		GL11.glVertex3d(point.x - camPos.x, point.y - camPos.y,
			point.z - camPos.z);
	
	GL11.glEnd();
}
 
Example #25
Source File: GuiUtils.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void drawTexturedModalRect(int x, int y, int u, int v, int width, int height, float zLevel) {
    float uScale = 1f / 0x100;
    float vScale = 1f / 0x100;
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer wr = tessellator.getWorldRenderer();
    wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    wr.pos(x, y + height, zLevel).tex(u * uScale, ((v + height) * vScale)).endVertex();
    wr.pos(x + width, y + height, zLevel).tex((u + width) * uScale, ((v + height) * vScale)).endVertex();
    wr.pos(x + width, y, zLevel).tex((u + width) * uScale, (v * vScale)).endVertex();
    wr.pos(x, y, zLevel).tex(u * uScale, (v * vScale)).endVertex();
    tessellator.draw();
}
 
Example #26
Source File: GuiHandle.java    From The-5zig-Mod with MIT License 5 votes vote down vote up
public static void drawRect(double left, double top, double right, double bottom, int color) {
	double i;
	if (left < right) {
		i = left;
		left = right;
		right = i;
	}

	if (top < bottom) {
		i = top;
		top = bottom;
		bottom = i;
	}

	float a = (float) (color >> 24 & 255) / 255.0F;
	float b = (float) (color >> 16 & 255) / 255.0F;
	float g = (float) (color >> 8 & 255) / 255.0F;
	float r = (float) (color & 255) / 255.0F;
	bmh tesselator = bmh.a;
	GL11.glEnable(3042);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	buu.c(770, 771, 1, 0);
	GL11.glColor4f(b, g, r, a);
	tesselator.b();
	tesselator.a(left, bottom, 0.0D);
	tesselator.a(right, bottom, 0.0D);
	tesselator.a(right, top, 0.0D);
	tesselator.a(left, top, 0.0D);
	tesselator.a();
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(3042);
}
 
Example #27
Source File: LayerBag.java    From BetterChests with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void doRenderLayer(EntityLivingBase entity, float limbSwing, float limbSwingAmount,
                          float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {

	GL11.glPushMatrix();
	GL11.glRotatef(180, 0, 0, 1);
	GL11.glTranslatef(0, -1 * ONE_PIXEL, 4 * ONE_PIXEL);
	Minecraft.getMinecraft().getRenderItem().renderItem(bag, ItemCameraTransforms.TransformType.NONE);
	GL11.glPopMatrix();
}
 
Example #28
Source File: GuiUnitProgrammer.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
protected void drawBorder(IProgWidget widget, int color){
    GL11.glPushMatrix();
    GL11.glTranslated(widget.getX() + guiLeft, widget.getY() + guiTop, 0);
    GL11.glScaled(0.5, 0.5, 1);
    drawVerticalLine(0, 0, widget.getHeight(), color);
    drawVerticalLine(widget.getWidth(), 0, widget.getHeight(), color);
    drawHorizontalLine(widget.getWidth(), 0, 0, color);
    drawHorizontalLine(widget.getWidth(), 0, widget.getHeight(), color);
    GL11.glPopMatrix();
}
 
Example #29
Source File: ClickGui.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
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();
}
 
Example #30
Source File: RenderUtilsLiving.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public static void glSetup(double x, double y, double z) {
	GL11.glPushMatrix();
	RenderUtils.offsetRender();
    GL11.glTranslated(x, y, z);
    GL11.glNormal3f(0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-mc.player.yaw, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(mc.player.pitch, 1.0F, 0.0F, 0.0F);
    //GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_DEPTH_TEST);

    GL11.glEnable(GL11.GL_BLEND);
    GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    
}