Masking or occluding image strips in real time?

Blitz3D Forums/Blitz3D Programming/Masking or occluding image strips in real time?

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.

For the copyrect method you don't need to worry about SpriteCandy as you can do it all in native blitz. Here's the code (use the reel.png from the last example)

Graphics3D 800,600,0,2
Global cam=CreateCamera()
Const spriteSize=64
Global reelSprite=CreateSprite()
Global scrollPos#=1
PositionEntity reelSprite,0,0,3
cube=CreateCube()
light=CreateLight(2)
LightRange light,3
PositionEntity cube,0,0,5

Global masterTexture%=LoadTexture("reel.png")
Global reelTexture%=CreateTexture(128,1024,16) ;// Taking into account what Ross C said about max of 8:1 ratio

;// Make a reel using random tiles 
;// Just copy random tiles from the master texture, directly onto our new reelTexture
For x=0 To 1023 Step 64
	CopyRect(Rand(0,7)*spriteSize,Rand(0,7)*spriteSize,spriteSize,spriteSize,0,x,TextureBuffer(masterTexture),TextureBuffer(reelTexture))
Next
;// Now scale the texure so we only see a few tiles and apply it to the reelSprite
ScaleSprite reelSprite,(0.25),1
ScaleTexture reelTexture,(0.125)*16,(1)*5
EntityTexture reelSprite,reelTexture


;// Now the main loop to scroll the texure on the reelSprite
While Not KeyDown(1)
	If scrollPos<1 Then 
		scrollPos=scrollPos+0.001
	Else
		scrollPos=0
	EndIf
	PositionTexture reelTexture,0,scrollPos
	EntityColor cube,Rand(255),Rand(255),Rand(255)
	TurnEntity cube,1,1,0
	RenderWorld
	Flip 
Wend


it will look a little ugly because the png has a transparent background, but if this was solid then it would look fine. Unfortunately copyrect doesnt copy alpha info, and thats why I used spritecandy previously as I thought you needed to do this.