slipping OpenGLView

Posts: 1
Joined: 2009.10
Post: #1
Hi There!

I want to make an OpenGL Window progrramatically, but it's not workin as expected.
The same OpenGLView class works in InterfaceBuilder, but it not works with the window+contentview created programatically.

I migth dont understand something. Please help!


here is the code:

        NSWindow* window;
        NSRect windowRect=NSMakeRect(100,300,400,200);
        window = [[NSWindow alloc] initWithContentRect:windowRect styleMask:NSResizableWindowMask backing:NSBackingStoreBuffered defer:NO];
        [window setTitle:@"canvas"];
        [window setHasShadow:YES];
        [window makeKeyAndOrderFront:self];
//this is where i create the content view
        NSView* contentView;
        contentView=[[NSView alloc] initWithFrame:[window frame]];
        [contentView setAutoresizesSubviews:YES];    
//set window's content view
        [window setContentView:contentView];
//create the GLView        
        GLView* glView;
        glView=[[GLView alloc]initWithFrame:NSMakeRect(20,20,360,160)];
        [contentView addSubview:glView];
        [glView setAutoresizingMask:NSViewWidthSizable];
        RedView* redView;
        redView=[[RedView alloc]initWithFrame:NSMakeRect(10,10,380,180)];
        [contentView addSubview:redView];
        [redView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
Quote this message in a reply
Posts: 245
Joined: 2005.11
Post: #2
Doesn't work how?
You do appear to be putting redView in front of it, which wouldn't help.
Quote this message in a reply
Post Reply