howto make keystone with Blitz3d?

Blitz3D Forums/Blitz3D Programming/howto make keystone with Blitz3d?

This shows how to use CopyRect to copy the rendered scene onto a texture:
Graphics3D 800, 600, 0, 2
SetBuffer BackBuffer()

pivot = CreatePivot()

For i = 0 To 10

	cube = CreateCube(pivot)
	PositionEntity cube, Rnd(-5, 5), 0, Rnd(-5, 5)
	EntityColor cube, Rand(255), Rand(255), Rand(255)
	
Next
	
camera = CreateCamera()
MoveEntity camera, 0, 2, -15

keystone = CreateCube()
FlipMesh keystone
PositionEntity keystone, 0, 2, -15
EntityParent keystone, camera
ScaleEntity keystone, 5, 5, 5
EntityFX keystone, 1

tex = CreateTexture(512, 512)

Repeat

	HideEntity keystone
	ShowEntity pivot
	RenderWorld()
	
	CopyRect 144, 44, 512, 512, 0, 0, BackBuffer(), TextureBuffer(tex)
	EntityTexture keystone, tex
	
	ShowEntity keystone
	HideEntity pivot
	RenderWorld()
	
	If KeyDown(200) Then TurnEntity keystone,  1, 0, 0
	If KeyDown(208) Then TurnEntity keystone, -1, 0, 0
	If KeyDown(203) Then TurnEntity keystone,  0, -1, 0
	If KeyDown(205) Then TurnEntity keystone,  0, +1, 0
	
	Text 0, 0, "use cursor keys to turn cube"
	
	Flip
	
Until KeyHit(1)

End