Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!

We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Member Since 30 Dec 2012
Offline Last Active Feb 11 2013 09:33 AM

Topics I've Started

How to color a grayscale texture removing the alpha channel?

31 December 2012 - 09:30 AM


I need some help understanding what I am doing wrong.

I am drawing text into a texture and then render this texture to the screen. The texture used is a grayscale texture. Why? Because the tutorial I have the code from says it saves memory. OK, so I have white text that I need to color. That means I want to color my grayscale texture when I am drawing it. But the result turns out to be unsatisfying.

I am drawing the texture with a quad, each vertex getting the color red and full alpha (1,0,0,1);

Result 1:
I use this code for blending:


The red is as expected (full red), but the alpha channel is opaque.

Result 2:


With this code, I can remove the black background, but the red is rather pale.

Which settings could I use to remove the black background and keep the full red color? Or is this not possible and I should use an RGBA texture in the first place? I could then color the text when rendering it to the texture. Anyway, I want to understand what is going on, before I decide to spend more memory.