title: Cocoa and OpenGL: failed to draw cube
body: <p>I am making a simple app in which I should draw a cube with GLUT.<br>
  Since I've studied OpenGL with plain C, I have difficulty to understand what functions should I call to initialize the context, since I don't have to call anymore functions like glutInit and others.<br>
  So I subclassed NSOpenGLView, disabled one shot memory for the window and wrote this code:  </p>
  
  <pre><code>@implementation MyView
  
  - (id)initWithFrame:(NSRect)frame
  {
      self = [super initWithFrame:frame];
      if (self)
      {
          NSOpenGLContext* context=[self openGLContext];
          [context makeCurrentContext];
          glMatrixMode(GL_MODELVIEW);
          glLoadIdentity();
          gluLookAt(0, 0, -100, 0, 0, 0, 0, 1, 0);
          glMatrixMode(GL_PROJECTION);
          glLoadIdentity();
          gluPerspective(45, 1, 1, 1000);
          glShadeModel(GL_SMOOTH);
          glMatrixMode(GL_MODELVIEW);
          glEnable(GL_DEPTH_TEST);
      }
      return self;
  }
  
  - (void)drawRect:(NSRect)dirtyRect
  {
      glClearColor(0, 0, 0, 0);
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  
      glColor4f(1, 0, 0, 0);
      glutSolidCube(10);
  
      glFlush();
  }
  </code></pre>
  
  <p>But it seems like I'm missing something because I see the black view but not the cube.</p>