From 52d6b13dc9a96ce57ab42739ef67148ebc43f05c Mon Sep 17 00:00:00 2001 From: rti Date: Sun, 31 Oct 2010 18:24:58 +0100 Subject: [PATCH] Fixed: #1147 Needed one resize event to properly show GL view. --- .../nel/src/3d/driver/opengl/driver_opengl_window.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index 8ba37c2df..10b632245 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -938,7 +938,8 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re // create a opengl view with the created format _glView = [[CocoaOpenGLView alloc] - initWithFrame:NSMakeRect(0, 0, 0, 0) pixelFormat: format]; + initWithFrame:NSMakeRect(0, 0, mode.Width, mode.Height) + pixelFormat:format]; if(!_glView) nlerror("cannot create view"); @@ -967,7 +968,9 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re // let the open gl view handle the input [[containerView() window] makeFirstResponder:_glView]; + // prevents scrambled content in the view before first swap [_ctx flushBuffer]; + [_glView display]; _EventEmitter.init(this, _glView); @@ -1426,7 +1429,8 @@ bool CDriverGL::createWindow(const GfxMode &mode) // create a dummy view which works like the window on other platforms // the open gl view will be created as subview of this one. - window = [[NSView alloc] init]; + window = [[NSView alloc] + initWithFrame:NSMakeRect(0, 0, mode.Width, mode.Height)]; [cocoa_window setContentView: (NSView*)window]; @@ -2514,6 +2518,9 @@ void CDriverGL::setWindowSize(uint32 width, uint32 height) } } + _WindowWidth = width; + _WindowHeight = height; + #elif defined(NL_OS_UNIX) if (width != _WindowWidth || height != _WindowHeight)