Jump to content

Recommended Posts

Posted

Ok, i've been away from modding for over a year and I've decided to come back to it.  This is an error that I could never quite figure out.  On any mod I make that involves drawing an HUD, I get this error

 

[00:08:59] [Client thread/ERROR]: ########## GL ERROR ##########
[00:08:59] [Client thread/ERROR]: @ Post render
[00:08:59] [Client thread/ERROR]: 1280: Invalid enum
[00:08:59] [Client thread/ERROR]: ########## GL ERROR ##########
[00:08:59] [Client thread/ERROR]: @ Post render
[00:08:59] [Client thread/ERROR]: 1280: Invalid enum
[00:08:59] [Client thread/ERROR]: ########## GL ERROR ##########
[00:08:59] [Client thread/ERROR]: @ Post render
[00:08:59] [Client thread/ERROR]: 1280: Invalid enum
[00:08:59] [Client thread/ERROR]: ########## GL ERROR ##########
[00:08:59] [Client thread/ERROR]: @ Post render
[00:08:59] [Client thread/ERROR]: 1280: Invalid enum
[00:08:59] [Client thread/ERROR]: ########## GL ERROR ##

 

 

It just keeps on going.  This error seems to be completley harmless and hasn't caused any problems in the mod, but it makes it impossible for me to print things to the console because this error keeps spamming.

 

My code for my mod's GuiInGame:

 

package com.crymsonstudios.saohud.HUD;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import com.crymsonstudios.saohud.Core.SAOHud;
import com.crymsonstudios.saohud.Util.Resources;
import com.mojang.realmsclient.gui.ChatFormatting;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Post;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;



public class GuiInGameSAO extends Gui
{
private Minecraft mc;
//protected static final RenderItem itemRenderer = new RenderItem();
private static final ResourceLocation widgetsTexPath = new ResourceLocation("saohud:textures/gui/widgets.png");
private static final ResourceLocation INV_SLOT_EMPTY = new ResourceLocation("saohud:textures/hud/aimBox.png");
// ScaledResolution scaledresolution = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight);
public GuiInGameSAO(Minecraft mc)
{
	super();
	// We need this to invoke the render engine.
	this.mc = mc;
}

//
// This event is called by GuiIngameForge during each frame by
// GuiIngameForge.pre() and GuiIngameForce.post().
//
int progress = 0;
@SubscribeEvent
public void onRenderSAOHUD(RenderGameOverlayEvent event)
{

	mc.gameSettings.heldItemTooltips = !SAOHud.SAO_INV_ENABLED;

	ScaledResolution scaledresolution = new ScaledResolution(mc);
	int k = scaledresolution.getScaledWidth();
	int l = scaledresolution.getScaledHeight();
	// 
	if(SAOHud.SAO_HUD_ENABLED)
	{
		// We draw after the ExperienceBar has drawn.  The event raised by GuiIngameForge.pre()
		// will return true from isCancelable.  If you call event.setCanceled(true) in
		// that case, the portion of rendering which this event represents will be canceled.
		// We want to draw *after* the experience bar is drawn, so we make sure isCancelable() returns
		// false and that the eventType represents the ExperienceBar event.
		if(event.isCancelable() || event.getType() != ElementType.CROSSHAIRS)
		{      
			return;
		}

		// Starting position for the buff bar - 2 pixels from the top left corner.
		int xPos = SAOHud.hpPosX;
		int yPos = SAOHud.hpPosY;  
		GL11.glPushMatrix();
		GL11.glEnable(GL11.GL_ALPHA);
		//GuiIngame
		GL11.glEnable(GL11.GL_BLEND);
		OpenGlHelper.glBlendFunc(770, 771, 1, 0);
		GL11.glDisable(GL11.GL_ALPHA_TEST);
		//GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.4F);

			this.mc.renderEngine.bindTexture(SAOHud.skinFiles.get(SAOHud.SKIN_INDEX));    

		drawTexturedModalRect(xPos, yPos, 0, 0, 260, 100);

		this.mc.renderEngine.bindTexture(new ResourceLocation("saohud:textures/hud/saoHealthBar.png"));      

		drawTexturedModalRect(xPos, yPos, 0, 0, 260, 100);

		int h = (int)mc.thePlayer.getHealth();

		if(h > 10)
			this.mc.renderEngine.bindTexture(new ResourceLocation("saohud:textures/hud/saoHealthBar_FULL.png"));      
		else if(h > 5)
			this.mc.renderEngine.bindTexture(new ResourceLocation("saohud:textures/hud/saoHealthBar_HALF.png"));    
		else
			this.mc.renderEngine.bindTexture(new ResourceLocation("saohud:textures/hud/saoHealthBar_LOW.png"));    

		float hpPercent = (mc.thePlayer.getHealth() / mc.thePlayer.getMaxHealth());
		int hpbarl = (int)(200 * hpPercent);

		if(progress > hpbarl)
		{
			if(progress - 4 >= hpbarl)
				progress -= 4;
			else
				progress -= 1;
		}
		else if(progress < hpbarl)
			if(progress + 4 <= hpbarl)
				progress += 4;
			else
				progress += 1;

		if(SAOHud.SAO_SMOOTH_ENABLED)
			drawTexturedModalRect(xPos, yPos, 0, 0, (int) (65 + progress - 10), 100);
		else
			drawTexturedModalRect(xPos, yPos, 0, 0, (int) (65 + hpbarl - 10), 100);

		drawString(mc.fontRendererObj, ChatFormatting.WHITE + /*mc.thePlayer.getDisplayName()*/ SAOHud.PLAYER_NAME, xPos + 24, yPos + 14, 1);
		drawString(mc.fontRendererObj, "" + ChatFormatting.WHITE + "[" + (int)mc.thePlayer.posX + ", " + (int)mc.thePlayer.posZ + "]", xPos + 152, yPos + 26, 1);

		if(mc.thePlayer.capabilities.isCreativeMode)
			this.mc.renderEngine.bindTexture(new ResourceLocation("saohud:textures/hud/creative.png"));  
		else
			this.mc.renderEngine.bindTexture(new ResourceLocation("saohud:textures/hud/survival.png"));  

		drawTexturedModalRect(xPos, yPos, 0, 0, 260, 100);

		//DrawHelper.drawStatusEffects(this, mc.thePlayer, mc);

		if(!mc.getMinecraft().isSingleplayer())
			this.mc.renderEngine.bindTexture(new ResourceLocation("saohud:textures/hud/online.png"));  
		else
			this.mc.renderEngine.bindTexture(new ResourceLocation("saohud:textures/hud/offline.png"));  

		drawTexturedModalRect(xPos, yPos, 0, 0, 260, 100);

		if(SAOHud.GUILD_ICON_INDEX != 0)
		{
			if(SAOHud.GUILD_ICON_INDEX > 0)
			{
				this.mc.renderEngine.bindTexture(SAOHud.iconFiles.get(SAOHud.GUILD_ICON_INDEX));
			}
			drawTexturedModalRect(xPos, yPos, 0, 0, 200, 100);
		}
		this.mc.renderEngine.bindTexture(INV_SLOT_EMPTY);  
		this.drawTexturedModalRect(0, 0, 0, 0, 260, 100);
		if(mc.thePlayer.isDead)//RenderLivingEvent
		{
			this.mc.renderEngine.bindTexture(new ResourceLocation("saohud:textures/hud/dead.png"));  

			drawTexturedModalRect(mc.currentScreen.width/2 - 125, mc.currentScreen.height/2, 0, 0, 250, 250);
		}

		GL11.glPopMatrix();
		if(SAOHud.SAO_INV_ENABLED)
		{
			GL11.glPushMatrix();
			this.mc.getTextureManager().bindTexture(Resources.invSlotSelect);
			//this.drawTexturedModalRect(mc.displayWidth * 5 - 264, 264 * mc.thePlayer.inventory.currentItem, 0, 0, 264, 264);
			GL11.glPopMatrix();
			GL11.glPushMatrix();
			this.mc.getTextureManager().bindTexture(ICONS);
			GL11.glEnable(GL11.GL_BLEND);
			OpenGlHelper.glBlendFunc(775, 769, 1, 0);
			//this.drawTexturedModalRect(k / 2 - 7, l / 2 - 7, 0, 0, 16, 16);
			OpenGlHelper.glBlendFunc(770, 771, 1, 0);
			this.mc.mcProfiler.startSection("bossHealth");
			this.mc.mcProfiler.endSection();

			this.mc.mcProfiler.startSection("actionBar");
			GL11.glEnable(GL12.GL_RESCALE_NORMAL);
			RenderHelper.enableGUIStandardItemLighting();

			int i1;
			int j1;
			int k1;
			for (i1 = 0; i1 < 9; ++i1)
			{
				j1 = k / 2 - 90 + i1 * 20 + 2;
				k1 = l - 16 - 3;
				this.renderInventorySlot(i1, mc.displayWidth/2 - (264/10 - 5), ((264/10 + 4) * i1 + 5), 1);
			}
			RenderHelper.disableStandardItemLighting();
			GL11.glDisable(GL12.GL_RESCALE_NORMAL);
			this.mc.mcProfiler.endSection();
			GL11.glDisable(GL11.GL_BLEND);
			GL11.glPopMatrix();
		}
	}

	/*GL11.glPushMatrix();
		//int k = scaledresolution.getScaledWidth();
		// int l = scaledresolution.getScaledHeight();

		this.mc.renderEngine.bindTexture(new ResourceLocation("saohud:textures/hud/skin/saoSkinInv.png"));
		drawTexturedModalRect(xPos, yPos + 100, 0, 0, 200, 200);
		itemRenderer.renderItemOverlayIntoGUI(this.mc.fontRenderer, this.mc.getTextureManager(), this.mc.thePlayer.inventory.mainInventory[0], xPos + 100, yPos + 100);
		GL11.glPopMatrix();*/
}//GuiIngame


@SubscribeEvent
public void pre(Pre event)
{
	if (event.getType().equals(RenderGameOverlayEvent.ElementType.HEALTH))
	{
		event.setCanceled(!SAOHud.MC_HUD_ENABLED); // Cancels the rendering of the HEALTH bar. Take a look at all the different ElementType's
	}

	if (event.getType().equals(RenderGameOverlayEvent.ElementType.HOTBAR))
	{
		event.setCanceled(SAOHud.SAO_INV_ENABLED); // Cancels the rendering of the HOTBAR. Take a look at all the different ElementType's
	}


}

@SubscribeEvent
public void post(Post event)
{

}

protected void renderInventorySlot(int par1, int par2, int par3, float par4)
{
	GL11.glPushMatrix();
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	GL11.glScaled(0.1, 0.1, 0);
	GL11.glEnable(GL11.GL_BLEND);
	OpenGlHelper.glBlendFunc(770, 771, 1, 0);
	GL11.glDisable(GL11.GL_ALPHA_TEST);
	this.mc.getTextureManager().bindTexture(Resources.invSlot);
	InventoryPlayer inventoryplayer = this.mc.thePlayer.inventory;
	this.zLevel = -90.0F;
	if(par1 == mc.thePlayer.inventory.currentItem)
		this.mc.getTextureManager().bindTexture(Resources.invSlotSelect);
	else
		this.mc.getTextureManager().bindTexture(Resources.invSlot);
	this.drawTexturedModalRect(par2 * 10 - (244/5), par3 * 10 - (244/5), 0, 0, 264, 264);

	if(par1 == mc.thePlayer.inventory.currentItem)
	{
		{
		this.mc.getTextureManager().bindTexture(Resources.tooltip);
		//this.drawTexturedModalRect(par2 * 10 - (244/5) - 600, par3 * 10 - (244/5), 0, 0, 600, 264);
		}
	}

		GL11.glPopMatrix();
	GL11.glPushMatrix();
	ItemStack itemstack = this.mc.thePlayer.inventory.mainInventory[par1];

	if (itemstack != null)
	{
		float f1 = (float)itemstack.animationsToGo - par4;

		if (f1 > 0.0F)
		{
			float f2 = 1.0F + f1 / 5.0F;
			GL11.glTranslatef((float)(par2 + , (float)(par3 + 12), 0.0F);
			GL11.glScalef(1.0F / f2, (f2 + 1.0F) / 2.0F, 1.0F);
			GL11.glTranslatef((float)(-(par2 + ), (float)(-(par3 + 12)), 0.0F);
		}

		//itemRenderer.renderItemAndEffectIntoGUI(this.mc.fontRenderer, this.mc.getTextureManager(), itemstack, par2, par3);

		if (f1 > 0.0F)
		{

		}

		//itemRenderer.renderItemOverlayIntoGUI(this.mc.fontRenderer, this.mc.getTextureManager(), itemstack, par2, par3);
	}
	GL11.glPopMatrix();

}
}

 

Any help would be greatly appreciated!

Creator Of Weapons+ Mod & Sword Art Online HUD Mod

Posted

What version of MC and Forge are you developing in? If it's older than mc 1.8, then 07 will lock the thread and tell you to upgrade.

 

You should find where that message is generated, then set a break point and run in the debugger so you can look at the client call stack when it hits. That should give you a clue what you're doing to trigger it.

 

Of course, if you upgrade to the latest Forge, then the problem may vanish on its own (after solving many other problems).

 

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

This seems to be a very common error, I am getting it too in one of my mods in 1.10.2 when using the tesselator to draw a line. Somewhere I read that this can be caused by outdated graphics card drivers or having a certain graphics card model.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.