Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8504557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:04:09+00:00 2026-06-11T02:04:09+00:00

I am working on engine (http://b2dengine.com/) to implement my game idea, which is already

  • 0

I am working on engine (http://b2dengine.com/) to implement my game idea, which is already in progress. Now for quite a while I am stuck with this problem with text rendering.

I have texture atlas that contains all supported/needed characters in a single png image. Character mapping is defined by Font class.
Everything works fine, characters are rendered correctly and accurately. Thing is that I also need ability to change color of the text.
This sounds and I bet it is simple but I cant make it work.

I am using this gl blend function to get desired effect.

GL.instance.glBlendFunc(GL.instance.GL_SRC_ALPHA, GL.instance.GL_ONE_MINUS_SRC_ALPHA);

In most cases it works, well as long as the color is somewhat dark. But when its set to white, I can see artifacts. I can provider screenshot if needed.
Also for this to work, “text” in texture must be white.

I am using opengl 1.1 ( yes I know its old, but I am just not ready for shaders ).

So in short, my question is: how to render a texture and completely replace the color? Keeping only alpha channel.
E.g. if its black and 80% transparent in png, when I render I want it green at 80% transparency on screen.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:04:11+00:00Added an answer on June 11, 2026 at 2:04 am

    I think this will work, though these are some anciently deprecated functions and I don’t remember too much about them anymore.

    With your texture unit active which has the text texture, try setting these options:

    glTexEnv(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
    glTexEnv(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
    glTexEnv(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PRIMARY_COLOR);
    glTexEnv(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE);
    

    I believe this will replace the RGB of your fragment with the incoming fragment color (glColor), and completely ignore the RGB channel of the texture. Having said this, it would be a lot better if you just uploaded an alpha channel texture to begin with.

    Make sure to check for errors, and if it doesn’t work, you can see if I’ve grabbed something incorrectly from here: http://www.opengl.org/sdk/docs/man/xhtml/glTexEnv.xml

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, recently, I've been working on a JS/HTML5 Game Engine. Right now I'm calling
I am working on a game engine which is loosely descended from Quake 2,
I working on a Game. The View, Thread and the Engine are done. Now
I am working on a 3d game engine which requires some maths, but i
I'm trying to make a fully-automated game engine which needs to be working based
I've been working with app engine for quite some time, I know that there
I have been working on a scheduler engine which reads schedule Jobs from a
I am working with CrystalDecisions.CrystalReports.Engine.ReportDocument in WinForms in Visual Studio 2008. Right now when
I've been working on a game engine for awhile. I've started out with 2D
I'm working on a game engine in C++ and I have methods like setColour

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.