         
         enc.endEncoding()
         
-        // TODO !!!!!
-        let renderTexture = engine.nextRenderTexture()
-        var framebuffer = Framebuffer()
-        var renderAttachment = FramebufferAttachment()
-        renderAttachment.render = renderTexture
-        framebuffer.colorAttachments.append(renderAttachment)
-        
-        let finalEnc = mainCommandBuffer.makeRenderCommandEncoder(handle: finalRenderPass, framebuffer: framebuffer)
+        finalFrameBuffer.colorAttachments[0].render = engine.nextRenderTexture()
+        
+        let finalEnc = mainCommandBuffer.makeRenderCommandEncoder(handle: finalRenderPass, framebuffer: finalFrameBuffer)
         
         finalEnc.setRenderPipelineState(texQuadVisPipeline)
         finalEnc.setFragmentTexture(mainPassFramebuffer.colorAttachments[0].render, at: 0)

            let r = rotation(angle: Vector3<Float>(cameraAngles.x, cameraAngles.y, 0.0))
            mainPassView = camera.viewMatrix * Matrix4x4<Float>(r.matrix)
            mainPassFrameData.viewProjection = camera.projectionMatrix * mainPassView
            mainPassFrameData.viewShadow0Projection = shadowPassData[0].viewProjection
            mainPassFrameData.lightPosition = Vector4<Float>(SHADOWED_DIRECTIONAL_LIGHT_POSITION.x,
                                                     SHADOWED_DIRECTIONAL_LIGHT_POSITION.y,
                                                     SHADOWED_DIRECTIONAL_LIGHT_POSITION.z, 1.0)

    private var mainPassView = Matrix4x4<Float>()
    private var mainPassProjection = Matrix4x4<Float>()
    private var mainPassFrameData = MainPass()
    private var shadowPassData = ShadowPass()
    private var moveForward = false
    private var moveBackward = false
    private var moveLeft = false
    private var moveRight = false
    private var mouseDown = false
    private var objectsToRender = 1000
    private var orbit = Vector2<Float>()
    private var cameraAngles = Vector2<Float>()
    private var mainRasterizerState: RasterizerStateHandle
    private var shadowRasterizerState: RasterizerStateHandle
    private var finalRenderPass: RenderPassHandle
    private var finalFrameBuffer = Framebuffer()
    
    public init(engine: Engine, logger: Logger) {
        self.engine = engine
