Draw image without texture?

BlitzMax Forums/BlitzMax Programming/Draw image without texture?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

SetBlend is the same as using glBlendFunc() which I already described the only way you might get some kind of lighting effect with it - GL_SRC_ALPHA_SATURATE and GL_ONE. The only way to make colors increase past their original values is either to use lightblend or to set up the blending so that one or both of the source/dest pixel values is not scaled down (GL_ONE), so the total is more than 1.0.

Otherwise, are you using the stencil buffer at all in your game? Would you be willing to use it to achieve this effect?

If so..

1. Set up the stencil buffer so that when you draw your RGB sprite, any pixels that get drawn sets the stencil buffer to a reference value (e.g. $FF)

2. Draw the RGB sprite with alpha blending as normal - the stencil buffer gets populated with masked pixels.

3. Switch on the stencil test and set it up so that it only allows pixels to be drawn if that pixel in the stencil is the reference value. If possible, also set it so that it also wipes the stencil buffer after using it.

4. SetColor to the maximum color you want the sprite to fade to, e.g. white.

5. SetBlend so that alphablending is switched on and SetAlpha value to whatever level you want.

6. DrawRect over the sprite - so only the stencilled pixels are affected.


Otherwise, good luck finding a way to do this. (maybe you can make use of the destination alpha channel in 32-bit modes)