Sign in to follow this  
FlyingSolo

Apply texture with separate alpha mask

Recommended Posts

I've got a texture which looks ok but I also have a second texture which is meant to overlay the first to give it some 'depth'. The 1st texture is a full colour 'picture', the 2nd is just shades of grey. I've been back and forth through the Red book to no avail. Anyone got a clue I could use!? Thanks. [Edited by - FlyingSolo on February 22, 2010 7:46:56 PM]

Share this post


Link to post
Share on other sites
Have you considered writing a shader to handle this? I'm not sure what functionality exists in plain openGL to achieve that effect, but with a shader I think that should be trivial (and a good learning exercise).

Also are you talking about an alpha map or a depth map? I think alpha channel is typically considered to be a transparency channel, but you sound like you are talking about a depth map or bump map.

If you just start flipping through a few GLSL articles you should be able to work it out I think.

Share this post


Link to post
Share on other sites

I need to keep this as compatible as I can with old opengl so sadly, shaders are out.

The effect this 'mask' gives is one of light and dark areas (shadows) - if that helps !?

Share this post


Link to post
Share on other sites
They say a picture is worth a thousand words...

Looky here: www.aerobits.org/shade

the 'mask' image gives the center of the instrument some shading which gives the illusion that it's a sphere - like the real thing.

I've piddled about with blendfunc all evening and can't crack it.

Anyone?

Share this post


Link to post
Share on other sites
How about multitexturing? I have never used it myself but it seems appropriate for your use:
http://jerome.jouvie.free.fr/OpenGl/Tutorials/Tutorial22.php

Share this post


Link to post
Share on other sites
In graphics, a equation is worth more than a picture :)

A quick tought is use multitexturing (no blending required) and multiply (GL_MODULATE) both texture colors.

Share this post


Link to post
Share on other sites
My guess is you need to multiply the texels together so my guess is GL_MODULATE for GL_TEXTURE0 and GL_TEXTURE1.
glActivateTexture(GL_TEXTURE0);
glTexEnv(........GL_MODULATE);
glActivateTexture(GL_TEXTURE1);
glTexEnv(........GL_MODULATE);

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this