浏览代码

Revert re-arrangement of init function.
World and Renderer need to initialize before the openGLContext to function...

Sam Jaffe 6 年之前
父节点
当前提交
e0dbae0d8c
共有 1 个文件被更改,包括 7 次插入7 次删除
  1. 7 7
      danmaku/GameView.mm

+ 7 - 7
danmaku/GameView.mm

@@ -42,13 +42,6 @@ namespace env { namespace detail {
     return nil;
   }
 
-  // make the context current
-  NSOpenGLContext* context = [[NSOpenGLContext alloc] initWithFormat:nsglFormat
-                                                        shareContext:nil];
-  [self setOpenGLContext:context];
-  [self setPixelFormat:nsglFormat];
-  [[self openGLContext] makeCurrentContext];
-
   using graphics::direct_renderer;
   using graphics::driver;
   renderer = std::make_shared<direct_renderer>(driver::openGL);
@@ -57,6 +50,13 @@ namespace env { namespace detail {
   game->register_scene(world);
   game->activate_scene("light-1");
 
+  // make the context current
+  NSOpenGLContext* context = [[NSOpenGLContext alloc] initWithFormat:nsglFormat
+                                                        shareContext:nil];
+  [self setOpenGLContext:context];
+  [self setPixelFormat:nsglFormat];
+  [[self openGLContext] makeCurrentContext];
+
   return self;
 }