Hi, I've been studying Metal using the Apple docs and the wonderful RW tutorials.
I've managed to get some primitives on screen just fine but the problem comes with depth testing.
If I use
func mtkView(_ view: MTKView, drawableSizeWillChange size: CGSize) {
metalViewPort.originX = 0
metalViewPort.originY = 0
metalViewPort.height = Double(size.height)
metalViewPort.width = Double(size.width)
}
and during the draw loop:
//Setup code
commandEncoder.setViewport(aMetalView)
//draw stuff
The depth testing passes everything. Simply commenting out the setViewport on line 2 above makes it operate correctly and models obscure, move and rotate exactly as expected in 3D space.
Before I post reams of poorly written code, can someone tell me if this is generally expected behaviour?