Posts

Showing posts from January, 2016

4.0.0: MVC OpenGL Part 1

Image
Thinking in MVC Thus far, all of our code has been living in the view.  This was helpful for a time so we could see how the individual pieces of OpenGL interact in the simplest way possible; however, there is a limit to the readability and modularity of this C-like paradigm.  To fix this, we'll refactor the graphic engine into separate pieces in a way that conforms, as best we can, with Apple's MVC app design. Start by creating a new target--completely new.  Click on the SwiftOpenGL project in the Project Navigator.  In the Editor view, beneath all of the targets listed, click on the “+“.  Name the new target OpenGLMVCPt1.  Copy the ViewController.swift and SwiftOpenGLView.swift code into new versions of these files as we have done before (remembering to adjust the compile sources so that the new versions are used instead of those from OnTheMove).  This time, however, we’re going to call the view controller SwiftOpenGLViewController because we want to show that this co