render ctx
This commit is contained in:
1 parent
fbea0673c1
commit
fbb02855ee
10 files changed
+167
-15
No files matched your search
@@ -11,20 +11,11 @@ final class RenderGLView: NSOpenGLView {
|
||||
private var startTime: CFTimeInterval = 0
|
||||
|
||||
override init(frame frameRect: NSRect) {
|
||||
let attributes: [NSOpenGLPixelFormatAttribute] = [
|
||||
UInt32(NSOpenGLPFAOpenGLProfile), UInt32(NSOpenGLProfileVersion3_2Core),
|
||||
UInt32(NSOpenGLPFAColorSize), 24,
|
||||
UInt32(NSOpenGLPFAAlphaSize), 8,
|
||||
UInt32(NSOpenGLPFADepthSize), 24,
|
||||
UInt32(NSOpenGLPFADoubleBuffer),
|
||||
UInt32(NSOpenGLPFAAccelerated),
|
||||
0
|
||||
]
|
||||
|
||||
guard let format = NSOpenGLPixelFormat(attributes: attributes) else {
|
||||
fatalError("Unable to create an OpenGL 3.2 core pixel format")
|
||||
guard
|
||||
let format = NSOpenGLPixelFormat(attributes: RENDER_OPENGL_ATTRS)
|
||||
else {
|
||||
fatalError("ERROR Could not create required OpenGL pixel format")
|
||||
}
|
||||
|
||||
super.init(frame: frameRect, pixelFormat: format)!
|
||||
wantsBestResolutionOpenGLSurface = true
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
class RenderComponent {
|
||||
let ctrl = DialectController(RenderContext())
|
||||
static private(set) weak var singleton: RenderComponent?
|
||||
|
||||
init() {
|
||||
Self.singleton = self
|
||||
renderRegisterEffects(ctrl)
|
||||
renderRegisterShoulds(ctrl)
|
||||
}
|
||||
|
||||
func setup() {
|
||||
renderSet(F.didSetup, true)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import AppKit
|
||||
|
||||
let RENDER_OPENGL_ATTRS: [NSOpenGLPixelFormatAttribute] = [
|
||||
UInt32(NSOpenGLPFAOpenGLProfile), UInt32(NSOpenGLProfileVersion3_2Core),
|
||||
UInt32(NSOpenGLPFAColorSize), 24,
|
||||
UInt32(NSOpenGLPFAAlphaSize), 8,
|
||||
UInt32(NSOpenGLPFADepthSize), 24,
|
||||
UInt32(NSOpenGLPFADoubleBuffer),
|
||||
UInt32(NSOpenGLPFAAccelerated),
|
||||
0
|
||||
]
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import Combine
|
||||
import Foundation
|
||||
|
||||
final class RenderVM: ObservableObject {
|
||||
var timer: Timer?
|
||||
|
||||
static private(set) weak var shared: RenderVM?
|
||||
|
||||
init() {
|
||||
Self.shared = self
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user