parent
450a2b8a25
commit
26355676fa
|
@ -378,7 +378,7 @@ using namespace mitsuba;
|
||||||
MTS_NAMESPACE_BEGIN
|
MTS_NAMESPACE_BEGIN
|
||||||
|
|
||||||
NSGLDevice::NSGLDevice(NSGLSession *session)
|
NSGLDevice::NSGLDevice(NSGLSession *session)
|
||||||
: Device(session), m_visible(false), m_cursor(true) {
|
: Device(session), m_window(nil), m_view(nil), m_fmt(nil), m_currentContext(nil), m_visible(false), m_cursor(true) {
|
||||||
m_title = "Mitsuba [nsgl]";
|
m_title = "Mitsuba [nsgl]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,24 +409,26 @@ void NSGLDevice::init(Device *other) {
|
||||||
m_mutex = new Mutex();
|
m_mutex = new Mutex();
|
||||||
|
|
||||||
/* Create the device window */
|
/* Create the device window */
|
||||||
m_window = [[NSWindow alloc] initWithContentRect: contentRect
|
dispatch_async(dispatch_get_main_queue(), ^{ m_window = [[NSWindow alloc] initWithContentRect: contentRect
|
||||||
styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask
|
styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask
|
||||||
backing: NSBackingStoreBuffered defer: NO];
|
backing: NSBackingStoreBuffered defer: NO];
|
||||||
if (m_window == nil)
|
if (m_window == nil)
|
||||||
Log(EError, "Could not create window");
|
Log(EError, "Could not create window");
|
||||||
|
[m_window retain];
|
||||||
|
|
||||||
if (m_center)
|
if (m_center)
|
||||||
[m_window center];
|
[m_window center];
|
||||||
|
|
||||||
/* Create a sub-view as drawing destination and in order to catch events */
|
/* Create a sub-view as drawing destination and in order to catch events */
|
||||||
m_view = [[CustomView alloc] initWithFrame: contentRect];
|
m_view = [[CustomView alloc] initWithFrame: contentRect];
|
||||||
if (m_view == nil)
|
if (m_view == nil)
|
||||||
Log(EError, "Could not create view");
|
Log(EError, "Could not create view");
|
||||||
|
|
||||||
[m_view setDevice: this];
|
[m_view setDevice: this];
|
||||||
[[m_window contentView] addSubview: m_view];
|
[[m_window contentView] addSubview: m_view];
|
||||||
[m_window setDelegate: m_view];
|
[m_window setDelegate: m_view];
|
||||||
[m_window setAcceptsMouseMovedEvents: YES];
|
[m_window setAcceptsMouseMovedEvents: YES];
|
||||||
|
});
|
||||||
|
|
||||||
/* Pixel format setup */
|
/* Pixel format setup */
|
||||||
AssertEx(m_redBits == m_blueBits || m_redBits == m_greenBits, "NSGL does not support individual color depths");
|
AssertEx(m_redBits == m_blueBits || m_redBits == m_greenBits, "NSGL does not support individual color depths");
|
||||||
|
|
Loading…
Reference in New Issue