Moving Background Starfield

Blitz3D Forums/Blitz3D Beginners Area/Moving Background Starfield

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.

It is used to change the colour of a pixel. Write pixel uses a 24 bit colour value with alpha information.

			RGB1=ReadPixelFast(loop,loop1,TextureBuffer(texture))
			r=(RGB1 And $FF0000)shr 16;separate out the red
			g=(RGB1 And $FF00) shr 8;green
			b=RGB1 And $FF;and blue parts of the color
			a=(RGB1 And $FF000000)Shr 24
			
			a=255; remove any alpha information currently in the texture.

			newrgb= (a shl 24) or (r shl 16) or (g shl 8) or b; combine the ARGB back into a number

			WritePixelFast(loop,loop1,newrgb,TextureBuffer(texture)); write the info back to the texture


You need to extract the individual 8 bit Red, Green, Blue and Alpha values from it, using the method above. Tweak the values, then you can combine the value back into a 24 bit value.