
Masking/Blending Help
OK, now I really apreciate NeHe for his tutorials, but I have a question:
1. what does the "AUX_RGBImageRec" structure look like?
2. I need to do the following: AFTER i rendered a quad, for example, I need to place another one on top of it via masking
overlapped quad: (texture2) -------------------
original quad: (texture1) -------------------
and i need only parts of the texture2 to be visible, but rather via alpha source blending rather than masking (some sections need to blend in with the original quad)
None of the glBlendFunc parameters combinations work...
(or I''m too stoopid)
basicly:
Draw #Patch1
Draw Mask
Draw #Patch2
so that only the masked part of Patch2 will be visible on Patch1, but not MASK, BLEND...
Hope you ppl understand what i ment.
Thanx

If I understand you clearly, what you want is to have a quad with a texture on it, and then make a portion of another texture transparent (or semi-transparent) and stick this on top of your first texture?
Assuming that this is what you are after then you have two options - multitexturing vs multi-pass rendering; I''ll gloss over multitexturing as multi-pass is easier to implement (in my view anyway). Here goes:
glEnable(GL_DEPTH_TEST);
glDisable(GL_BLEND);
Bind Texture1 and draw your quad
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
Bind Texture2 and draw your quad again
C''est voila! You should have what you want there.
One thing though: make sure Texture2 has an Alpha Channel - you will need to create this in a paint package like Photoshop or Paint Shop Pro.
If you want to know more about blending try The Red Book or this post (specifically the last entry by RipTorn has two good links in it).
Hope this helps.
--
Cheers,
Assuming that this is what you are after then you have two options - multitexturing vs multi-pass rendering; I''ll gloss over multitexturing as multi-pass is easier to implement (in my view anyway). Here goes:
glEnable(GL_DEPTH_TEST);
glDisable(GL_BLEND);
Bind Texture1 and draw your quad
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
Bind Texture2 and draw your quad again
C''est voila! You should have what you want there.
One thing though: make sure Texture2 has an Alpha Channel - you will need to create this in a paint package like Photoshop or Paint Shop Pro.
If you want to know more about blending try The Red Book or this post (specifically the last entry by RipTorn has two good links in it).
Hope this helps.
--
Cheers,
--
Cheers,
Darren Clark
Cheers,
Darren Clark
Well, first thanx, but I think I wasn't clear enough... My bad...
Blending with an alpha source from the image is easy. I want to have multiple (blending) masks for the same image texture, and vice-versa, use one sigle loaded mask for multiple image textures...
I already got it down to:
1. draw initial quad
2. enable blending and blend function
3. draw mask
4 result == original quad with the modifiable areas black
5 now all i need is the combination of glBlend.. parameters that will render the second image quad on top of the first one ONLY where black pixels are. This way I can put any mask there for the same secondary image. Unfortunately this doesn't work.
I need someone to tell me if it is possible or not.
Thanx.
BTW, I was thinking, if OpenGL can't do this by it's own, maybe there's a multitexturing method that can. If so I'd like to know where can I find Some MT documents (those at OpenGL.org are somewhat chaotic...)
Also I'm wondering if I can use "polygon stippling" as a "hard mask" (0/1 no blending)...
[edited by - FAndrew on December 29, 2003 3:32:11 AM]
Blending with an alpha source from the image is easy. I want to have multiple (blending) masks for the same image texture, and vice-versa, use one sigle loaded mask for multiple image textures...
I already got it down to:
1. draw initial quad
2. enable blending and blend function
3. draw mask
4 result == original quad with the modifiable areas black
5 now all i need is the combination of glBlend.. parameters that will render the second image quad on top of the first one ONLY where black pixels are. This way I can put any mask there for the same secondary image. Unfortunately this doesn't work.
I need someone to tell me if it is possible or not.
Thanx.
BTW, I was thinking, if OpenGL can't do this by it's own, maybe there's a multitexturing method that can. If so I'd like to know where can I find Some MT documents (those at OpenGL.org are somewhat chaotic...)
Also I'm wondering if I can use "polygon stippling" as a "hard mask" (0/1 no blending)...
[edited by - FAndrew on December 29, 2003 3:32:11 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement