Sign in to follow this  
Infinite_Daremo

Alpha turning to grey

Recommended Posts

I've been doing a facial recognition project and all has been going well so far, but i need to apply decals to the transformed image. I've done this countless times but for some reason now when im applying a decal to the cheeks around the edges the alpha is grey. I don't know if this is happening because the mapping area isn't perfectly square or there's some simple OGL call im missing. Below is a picture of the result, all that should be visible on the cheeks is the redness. http://i39.photobucket.com/albums/e183/kingwoods/IMG_0063.png Anyone have any ideas? Randomly google'ing alpha and glTexParamf is becoming a pain in the arse.

Share this post


Link to post
Share on other sites
The grey colour around the cheek area shouldn't be there, its a red overlay for the cheeks. It doesnt show up in Photoshop just when im mapping the texture. Its supposed to be a decal for damaged skin cells from alcohol abuse but the alpha on the texture is coming out as grey.

This is what the applied texture should look like:
http://i39.photobucket.com/albums/e183/kingwoods/overlayAlcoholCheekL.png

Share this post


Link to post
Share on other sites
Sorry for the late reply. Work finished.

Ok.

This renders a facial part and all the decals store within it.

 void CFacialPart::RenderDecals( const int iNumIndices ) const
{
glEnable(GL_TEXTURE_2D);
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY); // Enables texturing
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

std::vector< CFacialDecal * >::const_iterator it = m_pFacialDecals.begin();

for( ; it != m_pFacialDecals.end(); ++it ) // Render all facial decals
{
(*it)->Render( m_Vertices, m_IndexBuffer, iNumIndices );
}

glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glDisable(GL_TEXTURE_2D);
glDisable (GL_BLEND);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}



And this is how a decal is rendered:

void CFacialDecal::Render( const GLfloat *pVertices, const GLubyte *pIndexBuffer, const int iNumIndices ) const
{
if( m_fBlendCapacity < F_BLEND_CUTOFF )
return;

glBindTexture(GL_TEXTURE_2D, GetTextureID() );
glColor4f(1.0f, 1.0f, 1.0f, m_fBlendCapacity);

glVertexPointer(2, GL_FLOAT, 0, pVertices);
glTexCoordPointer(2, GL_FLOAT, 0, GetTextureCoords());

glDrawElements(GL_TRIANGLES, iNumIndices, GL_UNSIGNED_BYTE, pIndexBuffer);

glColor4f(1.0f, 1.0f, 1.0f, 1.0f );

}



I don't know whats happened to the operators here :S

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