Hello.
To draw masked 2D image, I’m using next code:
(I study from next web site : http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=20, thanks)
//draw mask
glBlendFunc(GL_DST_COLOR, GL_ZERO);
glBindTexture(GL_TEXTURE_2D, mask_id); //bind mask to current texture
glCallList(5); //draw textured quad
//draw image
glBlendFunc(GL_ONE, GL_ONE);
glBindTexture(GL_TEXTURE_2D, image_id); //bind image to current texture
glCallList(5); //draw textured quad
above code draw no fade-in/out 2D Image.
By the way, I want to draw fade-in/out masked 2D image. How can I set glBlendFunc?
I tryed next code, but I don’t get fade-in/out 2D masked iamge.
//draw mask
glBlendFunc(GL_DST_COLOR, GL_ZERO);
glBindTexture(GL_TEXTURE_2D, mask_id);
glCallList(5);
//draw image
//glBlendFunc(GL_ONE, GL_ONE);
glBlendFunc(GL_SRC_ALPHA, GL_ONE); //<-add
glBindTexture(GL_TEXTURE_2D, image_id);
glColor4f(1.0f, 1.0f, 1.0f, alpha); //<- set alpha factor to quad for 2D image.
glCallList(5);
I should guess that If mask-image’s black color can fade-in, we can get fade-in/out masked 2D image.
I want to understand how we set glBlendFunc in this case, to get fade-in/out Masked 2D images.
If you have any suggestion, I want to listen your suggestion very much.
sorry, my broken English.
Thanks.
[This message has been edited by mdive (edited 06-18-2003).]