texture buffer

Blitz3D Forums/Blitz3D Programming/texture buffer

I wish to capture the 3d display as a texture. However, with the following code (as a subroutine in a larger main loop), my cube remains blank...

cube_text=CreateTexture(128,128)
SetBuffer TextureBuffer(cube_text)
RenderWorld
EntityTexture cube,cube_text
FreeTexture cube_text
SetBuffer BackBuffer()


I can't see what is wrong with this.