Jump to content

Display Semi-Transparent textures


MotorisedEditor

Recommended Posts

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]

uQNOycZ.png

	@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);
    	
}

Link to comment
Share on other sites

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);
}

I like to make mods, just like you. Here's one worth checking out

Link to comment
Share on other sites

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

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

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);
    	
}

Link to comment
Share on other sites

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();
    	
}

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 xD

Link to comment
Share on other sites

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. xD

 

But that about nearly covers what I do know about openGL... I can do translation, rotation and resizing. That is about it.

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 xD

Link to comment
Share on other sites

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.