MotorisedEditor Posted August 25, 2013 Posted August 25, 2013 So i created a texture with 50% Transparency but when i load it into minecraft it rensers like a Solid. What can i do? Up is what it should look like. [added w/ Paint.NET] Down what it renders. [using the code below] @ForgeSubscribe public void TestRender(RenderGameOverlayEvent.Post event){ //========Resolution======== res = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight); int width = res.getScaledWidth(); int height = res.getScaledHeight(); //========Resolution========+ this.mc.renderEngine.func_110577_a(new ResourceLocation("/Num/Chintzy/" + "Preview" + ".png")); drawTexturedModalRect(100, 100, 0, 0, 500, 500); mc.func_110434_K().func_110577_a(Gui.field_110324_m); } Quote
Jwosty Posted August 26, 2013 Posted August 26, 2013 Before you call drawTextureModalRect, call glColor. Example for 50% transparency: @ForgeSubscribe public void TestRender(RenderGameOverlayEvent.Post event){ //========Resolution======== res = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight); int width = res.getScaledWidth(); int height = res.getScaledHeight(); //========Resolution========+ this.mc.renderEngine.func_110577_a(new ResourceLocation("/Num/Chintzy/" + "Preview" + ".png")); [b]GL11.glColor4f(1, 1, 1, 0.5f);[/b] drawTexturedModalRect(100, 100, 0, 0, 500, 500); mc.func_110434_K().func_110577_a(Gui.field_110324_m); } Quote I like to make mods, just like you. Here's one worth checking out
hydroflame Posted August 26, 2013 Posted August 26, 2013 no. you have to enable blending GL11.glEnable(GL11.GL_BLEND); Quote how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
Jwosty Posted August 26, 2013 Posted August 26, 2013 no. you have to enable blending GL11.glEnable(GL11.GL_BLEND); Right... What was I thinking? Quote I like to make mods, just like you. Here's one worth checking out
hydroflame Posted August 26, 2013 Posted August 26, 2013 well even if you do call glColor it wont work unless blending is enabled, and bte its a bad practice to call glColor except when using a colorless texture that you want to programmatically change the color of. in his case the image seems/should be completelly baked in the image Quote how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
MotorisedEditor Posted August 26, 2013 Author Posted August 26, 2013 Nope.. still nothing.. @ForgeSubscribe public void ArmorlvlTest(RenderGameOverlayEvent.Post event){ //========Resolution======== res = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight); int width = res.getScaledWidth(); int height = res.getScaledHeight(); //========Resolution========+ this.mc.renderEngine.func_110577_a(new ResourceLocation("Num/Chintzy/Preview.png")); GL11.glEnable(GL11.GL_BLEND); GL11.glColor4f(1, 1, 1, 0.5f); drawTexturedModalRect(width-120, height-80, 75, 105, 110, 50); mc.func_110434_K().func_110577_a(Gui.field_110324_m); } Quote
Mew Posted August 26, 2013 Posted August 26, 2013 You need the push/popMatrix... So this: @ForgeSubscribe public void ArmorlvlTest(RenderGameOverlayEvent.Post event){ //========Resolution======== res = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight); int width = res.getScaledWidth(); int height = res.getScaledHeight(); //========Resolution========+ this.mc.renderEngine.func_110577_a(new ResourceLocation("Num/Chintzy/Preview.png")); GL11.glPushMatrix(); GL11.glEnable(GL11.GL_BLEND); drawTexturedModalRect(width-120, height-80, 75, 105, 110, 50); mc.func_110434_K().func_110577_a(Gui.field_110324_m); GL11.glPopMatrix(); } Quote I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
MotorisedEditor Posted August 27, 2013 Author Posted August 27, 2013 You need the push/popMatrix... "push" stops every other texture in the game from rendering... "pop" does nothing... Quote
Mew Posted August 27, 2013 Posted August 27, 2013 Lol.... Try using the PRE render event. And I know what I am talking about with those two statements I think you will find. Without them, openGL does NOTHING. But that about nearly covers what I do know about openGL... I can do translation, rotation and resizing. That is about it. Quote I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
robustus Posted August 27, 2013 Posted August 27, 2013 I could be way off here and just a shot in the dark, but you may need to add an alpha mask to the image. Saving regular transparency ive noticed like with liquid blocks they wont render partially transparent without an alpha mask. Quote
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.