I am working on OS X Mountain Lion and Xcode 4.6. I am using the Cocoa APIs to create my windows and handle events. I can't seem to get a vertex buffer generated for some reason. I use NSLog() to print the value of my buffer, but it comes out as 0. Could someone please assist me? Here is my code, it is inside of a custom NSOpenGLView:

Code :
@implementation MyOpenGLView
static const GLfloat g_vertex_buffer_data[] = {
    -1.0f, -1.0f, 0.0f,
    1.0f, -1.0f, 0.0f,
    0.0f,  1.0f, 0.0f,
    NSOpenGLPixelFormatAttribute attrs[] =
        NSOpenGLPFADepthSize, 24,
        // Must specify the 3.2 Core Profile to use OpenGL 3.2
    NSOpenGLPixelFormat *pf = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attrs] autorelease];
    if (!pf)
        NSLog(@"No OpenGL pixel format");
    NSOpenGLContext *context = [[[NSOpenGLContext alloc]initWithFormat:pf shareContext:nil]autorelease];
    [self setPixelFormat:pf];
    [self setOpenGLContext:context];
    GLuint vertexBuffer;
    glGenBuffers(1, &vertexBuffer);
    glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
    glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_STATIC_DRAW);
- (id)initWithFrame:(NSRect)frame
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code here.
    return self;
- (void)drawRect:(NSRect)dirtyRect
    glClearColor(0.0, 0.0, 0.0, 1.0);
    NSLog(@"drawRect: is called");

I get a black window like expected with no errors or warning. My vertex buffer object is 0 for some reason.