View Full Version : Masking Problem, any one could help, Urgent!!!
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
thank you thank you!!!
03-29-2005, 11:10 PM
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)
you are properly right, after i change the glBindTexture(GL_TEXTURE_2D, textures);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)"
03-30-2005, 02:21 AM
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).
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.