Please run this code
SetWindowTitle( "Z-Buffer" )
SetWindowSize( 1024, 768, 0 )
// set display properties
SetVirtualResolution( 100, 100 )
SetOrientationAllowed( 1, 1, 1, 1 )
BoxObjectID=CreateObjectBox(1,1,1)
SetCameraPosition(1,4,4,-4)
SetCameraLookAt(1,0,0,0,0)
DepthImageID=CreateRenderImage(512,512,1,0)
DepthSpriteID=createsprite(DepthImageID)
SetSpriteSize(DepthSpriteID,30,30)
SetSpritePosition(DepthSpriteID,0,0)
do
Print( ScreenFPS() )
//~ Update3D(0)
//~ Render2DBack()
//~ ClearDepthBuffer()
SetRenderToImage(-1,DepthImageID)
ClearScreen()
Render3D()
//~ SetRenderToScreen()
//~ Update(0)
//~ Render3D()
//~ ClearDepthBuffer()
//~ Render2DFront()
//~ Swap()
//~
sync()
loop
As i said above it crashes for me if i put a 0 as colorImage:
SetRenderToImage(0,DepthImageID)
If i put a -1 as colorImage it runs fine but the image is all Black:
SetRenderToImage(-1,DepthImageID)
I understand that -1 is for: "There is no Image" as 0 could be an ImageID !?
But i don't get plausible results.
And presuming it gives me a non-linearized depth image, I should nevertheless see a minimal change in the gray scale, and not a black only image, as I get now.