Jump to content

Recommended Posts

Posted

Hey Guys!

I wanted to render some textures with the same technique the destroy overlay is rendered:

The grayscale of the texture is calculated into a corresponding alpha value. But actually I don't understand how this is done. I looked in RenderGlobal, tried to understand the code, copied something, no effect..

Can anybody explain how to do this?

Posted

Hi

 

I'm not sure what effect you're talking about - do you mean the cracks?

RenderGlobal::

public void drawBlockDamageTexture(Tessellator par1Tessellator, EntityLivingBase par2EntityPlayer, float par3)

or the flying fragments when the block bursts?

EntityDiggingFX

 

-TGG

Posted

The blending is done using the source and destination colour instead of alpha information, due to this command

 

            GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_SRC_COLOR);

 

This makes the blending use the source colour and destination colour, instead of the more usual alpha blending

            GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

 

You may also need GL11.glEnable(GL11.GL_BLEND); before the rendering.  These bits are also important to make the cracks stand a bit proud of the block surface

 

            GL11.glDisable(GL11.GL_ALPHA_TEST);
            GL11.glPolygonOffset(-3.0F, -3.0F);
            GL11.glEnable(GL11.GL_POLYGON_OFFSET_FILL);
            GL11.glEnable(GL11.GL_ALPHA_TEST);

 

See this link for more information...

 

http://www.glprogramming.com/red/chapter06.html

 

-TGG

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.