Can I change default behaviour of SetColor?

BlitzMax Forums/BlitzMax Beginners Area/Can I change default behaviour of SetColor?

Russell(Posted 2006) [#1]
I can see where it could be useful to have the color of my images effected by SetColor, but is there a way to have it not effect images without having to set the current color to white before drawing them (and then back to the previous color)?

Thanks
Russell


ImaginaryHuman(Posted 2006) [#2]
From what I understand, and this only applies to OpenGL based Max2D, is that in OpenGL you have a few choices of how the current color is blended with the existing color from the texture. There is a `modulate` mode which lets the current color blend with the texture to create a tint, and there is also a decal mode which takes color from the texture only. I am presuming that Max2D, at least in OpenGL, is using the modulate mode to provide the blending of color with texture data.

To test this out the command to look at is:

	glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE)


Other values for the last parameter can be GL_DECAL and GL_BLEND.

If you just have decal it just takes color from the texture. If you have GL_MODULATE it combines it with the vertex color.

This is only my guess of how Max2D implements this feature. But you could try:

glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_DECAL)


and see if SetColor stops having an influence when you draw something which would normally draw tinted.

You probably should query OpenGL to read the existing value of the mode before you change it, and restore it after you're done, to be friendly to Max2D, but I think it likely that Max2D doesn't change that mode at all ever after initializing the display, nor use it for any other current purpose.

Absolutely no idea about DirectX and happily so :-)


Russell(Posted 2006) [#3]
Thanks!

I.....think I'll just change the color to white before each DrawImage()...just to be safe :)

Mark, if you're reading this, could you put in a flag for this?

Thanks
Russell