[Renderer] Override prepareOpenGL to do some more setup
Set the clear color and some depth buffer stuff. Eventually I want to move this to the delegate, but not totally sure how yet.
This commit is contained in:
parent
cae145e0c1
commit
f8ec516b2f
1 changed files with 9 additions and 1 deletions
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import Cocoa
|
import Cocoa
|
||||||
import OpenGL
|
import GLKit
|
||||||
import CoreVideo
|
import CoreVideo
|
||||||
|
|
||||||
public class OpenGLView: NSOpenGLView, RenderingSurface {
|
public class OpenGLView: NSOpenGLView, RenderingSurface {
|
||||||
|
@ -36,6 +36,14 @@ public class OpenGLView: NSOpenGLView, RenderingSurface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override public func prepareOpenGL() {
|
||||||
|
super.prepareOpenGL()
|
||||||
|
|
||||||
|
glClearColor(0.16, 0.17, 0.21, 1.0)
|
||||||
|
glEnable(GLenum(GL_DEPTH_TEST))
|
||||||
|
glDepthFunc(GLenum(GL_LESS))
|
||||||
|
}
|
||||||
|
|
||||||
private func setupOpenGL() {
|
private func setupOpenGL() {
|
||||||
guard !didSetupOpenGL else { return }
|
guard !didSetupOpenGL else { return }
|
||||||
defer { didSetupOpenGL = true }
|
defer { didSetupOpenGL = true }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue