Flenix Posted February 13, 2014 Posted February 13, 2014 Hey guys, This is (hopefully) my final GUI issue, and it's probably something simple. Basically, in the vanilla hotbar you can see there is a transparancy alpha layer; you can see through the bar. In my custom hotbar, even when it's just a copy-paste of the vanilla hotbar render code, this alpha transparency doesn't work. Anyone got any idea what might cause such a thing? Also, while I'm on the subject; is it possible to animate GUI elements, in a similar way to how we animate normal textures? I know I could do it in a long-winded way, running a tick timer and changing the texture coordinates each tick, but that IS very long-winded; is there a shorter way? Quote http://s13.postimg.org/z9mlly2av/siglogo.png[/img] My mods (Links coming soon) Cities | Roads | Remula | SilvaniaMod | MoreStats
Draco18s Posted February 13, 2014 Posted February 13, 2014 Make sure you enable glBlend Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Flenix Posted February 13, 2014 Author Posted February 13, 2014 Make sure you enable glBlend I have AFAIK- One of the snippets I snagged from the vanilla class. What's interesting and worth noting that I just discovered via a misconfiguration; If my hotbar renders over another widget, the transparancy DOES affect that widget - it seems to only not work on the game itself. Here's my render method: @ForgeSubscribe(priority = EventPriority.NORMAL) public void renderHotbarHorizontal(RenderGameOverlayEvent event) { if (config.hotbarEnabled) { double widthMultiplier = getResIncreaseMultiplier("x"); double heightMultiplier = getResIncreaseMultiplier("y"); int sizeX = 182; int sizeY = 22; if (!config.horizontalHotbar) { sizeX = 22; sizeY = 182; } int configX = 0; int configY = 0; if (config.hotbarAnchor == 0 || config.hotbarAnchor > { configX = (int) Math.round(config.hotbarXPos * widthMultiplier); configY = (int) Math.round(config.hotbarYPos * heightMultiplier); } else { configX = calculateAnchorPointX(config.hotbarAnchor, sizeX); configY = calculateAnchorPointY(config.hotbarAnchor, sizeY); } int xPos = configX + config.hotbarXOffset; int yPos = configY + config.hotbarYOffset; GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(guiStatsBar); if (config.horizontalHotbar) { InventoryPlayer inv = mc.thePlayer.inventory; drawTexturedModalRect(xPos, yPos, 0, 168, sizeX, sizeY); drawTexturedModalRect(xPos - 1 + (inv.currentItem * 20), yPos - 1, 182, 168, 24, 24); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL12.GL_RESCALE_NORMAL); RenderHelper.enableGUIStandardItemLighting(); for (int i = 0; i < 9; ++i) { int x = xPos + (i * 20) + 2; int z = yPos - 3; renderInventorySlot(i, x, z, 1.0F); } } else { InventoryPlayer inv = mc.thePlayer.inventory; drawTexturedModalRect(xPos, yPos, 234, 0, sizeX, sizeY); drawTexturedModalRect(xPos - 1, yPos - 1 + (inv.currentItem * 20), 182, 168, 24, 24); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL12.GL_RESCALE_NORMAL); RenderHelper.enableGUIStandardItemLighting(); for (int i = 0; i < 9; ++i) { int x = xPos + 3; int z = yPos + (i * 20) + 2; renderInventorySlot(i, x, z, 1.0F); } } RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); } } Quote http://s13.postimg.org/z9mlly2av/siglogo.png[/img] My mods (Links coming soon) Cities | Roads | Remula | SilvaniaMod | MoreStats
Flenix Posted February 13, 2014 Author Posted February 13, 2014 Realized that what I said about widget transparency might sound a bit confusing; here's a screenshot to try and clear it up: The solid white squares should have alpha transparency. You can see the health bar through it, but you can't see the game world. Quote http://s13.postimg.org/z9mlly2av/siglogo.png[/img] My mods (Links coming soon) Cities | Roads | Remula | SilvaniaMod | MoreStats
Recommended Posts
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.