PDA

View Full Version : texture_env_dot3 result in alpha buffer



10-30-2002, 07:06 PM
I want to use the alpha buffer to store some
intermidiate results,with the following code using a RBGA color buffer:


//----------------------------
glActiveTexture(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,nmapId);
glTexEnv(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REP LACE);

glActiveTexture(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,lmapid);
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_DOT3_RGB_EXT);

glTexEnvf(GL_TEXTURE_ENV,GL_SOURCE0_RGB_EXT,GL_TEX TUR);
glTexEnvf(GL_TEXTURE_ENV,GL_OPERAND0_RGB_EXT,GL_SR C_COLOR);
glTexEnvf(GL_TEXTURE_ENV,GL_SOURCE1_RGB_EXT,GL_PRE VIOUS_EXT);
glTexEnvf(GL_TEXTURE_ENV,GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);

render_poly();

//----------------------------

will the result of the dotproduct be stored
in rgb and the alpha buffer?

If not in alpha, how do I do that? Can I "transfer" the result in the rgb buffer to the alpha buffer somehow(assuming the rgb values are the same of course).

Thanks in advance

/Peter

Mazy
10-30-2002, 11:16 PM
Dont know about the DOT3_EXT, but the ARB version has a GL_DOT3_RGBA_ARB that puts the result in both RGB (greyscale) and Alpha(single channel)

10-31-2002, 01:37 AM
Thanks I didn't see that. I tried it but it still didn't work though.

Many hours of debugging later I found it.
Most people using GLUT probably know this already:

SPECIFYING GLUT_RGBA DOES NOT GIVE YOU AN ALPHA BUFFER!!!!!! USE GLUT_ALPHA!

Stupid rookie mistake.
/Peter