Jump to content

Recommended Posts

Posted

I'm having a tough time getting alpha transparency on strings to work.

 


         	GL11.glPushMatrix();
         	GL11.glEnable(GL11.GL_BLEND);
         	OpenGlHelper.glBlendFunc(770, 771, 1, 0);
         	mc.fontRenderer.drawStringWithShadow("Hello, world!", x, y, color + (alpha << 24));
         	GL11.glDisable(GL11.GL_BLEND);
         	GL11.glPopMatrix();

 

The alpha value is between 0 and 255, inclusively, but it refuses to render on certain numbers. Is there a different way of accomplishing this, or is my bitwise calculation off? I can't find help support for GUI text transparency anywhere.

 

Thanks in advance.

Posted

 

try a bitwise OR operation ( | operator)

 

e.g.

 

color | (alpha << 24)

 

Although for this use (with colors being bit-aligned), there should not be a functional difference.  Unfortunately, I have not tried playing around with transparent font-rendering, so could not give you a 100% for sure solution =\.

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.