Textures and Masking

  • Follow


I have 2 textures and would like to use 1 texture (black-gray-white) as a 
Mask for the other (Color). I used the technique described in Lesson 20 of 
Nehe (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=20).

The result is not quite what I expected 
(http://users.pandora.be/bart.de.lathouwer/mask.gif).
I expected the color texture to be only partially visible (where the Mask 
color is black), in stead, the Mask texture shines through.

Any help anyone?

Thanks
- Bart


glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);

glBlendFunc(GL_DST_COLOR,GL_ZERO);
        m_pMaskTexture->Draw(); // glBind and draw GL_QUADS

glBlendFunc(GL_ONE, GL_ONE);
        m_pFrame->Draw(); // glBind and draw GL_QUADS

glEnable(GL_DEPTH_TEST);
glDisable(GL_BLEND); 


0
Reply Latti 1/15/2006 9:15:18 PM

Hi,

I haven't checked your Blending so far. But one quite good method is 
simple multitexturing with the right Texture-Combine Mode. This is 
independent from what is in the frame buffer before, not like Blending.

Just google'ing a bit should help. (And on modern Graphic Cards at least 
4 Texture Units are supported).

For Blending check your 2 images. Like in Nehe said: " It's also very 
important that your image has a BLACK background and the mask has a 
WHITE background!".

Maik Wagner


Latti wrote:
> I have 2 textures and would like to use 1 texture (black-gray-white) as a 
> Mask for the other (Color). I used the technique described in Lesson 20 of 
> Nehe (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=20).
> 
> The result is not quite what I expected 
> (http://users.pandora.be/bart.de.lathouwer/mask.gif).
> I expected the color texture to be only partially visible (where the Mask 
> color is black), in stead, the Mask texture shines through.
> 
> Any help anyone?
> 
> Thanks
> - Bart
> 
> 
> glEnable(GL_BLEND);
> glDisable(GL_DEPTH_TEST);
> 
> glBlendFunc(GL_DST_COLOR,GL_ZERO);
>         m_pMaskTexture->Draw(); // glBind and draw GL_QUADS
> 
> glBlendFunc(GL_ONE, GL_ONE);
>         m_pFrame->Draw(); // glBind and draw GL_QUADS
> 
> glEnable(GL_DEPTH_TEST);
> glDisable(GL_BLEND); 
> 
> 
0
Reply Maik 1/15/2006 9:34:41 PM


1 Replies
220 Views

(page loaded in 0.034 seconds)

Similiar Articles:













7/21/2012 8:36:37 AM


Reply: