Masking Problem, any one could help, Urgent!!!

hi,

anyone could help,pls?I m stacked on this problem a few weeks.

I m doing a Renju chess board, but after picking the stone dose not appear properly, i think is the alpha part problem… the coding pls refer to

http://www.gamedev.net/community/forums/topic.asp?topic_id=309393

thank you thank you!!!

I’m not an expert on display lists (I never use them) but in the function ‘build_piece’ you call glBindTexture before glNewList so the texture call won’t be compiled into the display list.

It’s not clear exactly what’s wrong with your pieces but from your description I think you should create a 32-bit texture with pure white in the RGB channels and a circle mask in the alpha channel.

You should then enable alpha blending and call glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) and glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)

/A.B.

hi,

you are properly right, after i change the glBindTexture(GL_TEXTURE_2D, textures[9]);after call list, the piece appeared. But where should i add
“enable alpha blending and call glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) and glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)”

I suggest you do it in ‘draw_pieces’ after glEnable(GL_TEXTURE_2D). To enable alpha blending use glEnable(GL_BLEND). As I said earlier, you need a 32-bit texture with the circle in the alpha channel for this to work properly.

You might want to reset the OpenGL state at the end of the function, either with glPushAttrib/glPopAttrib or manually resetting the relevant states (i.e. glDisable(GL_BLEND) and so forth).

/A.B.