slipping OpenGLView
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!
Thanks
here is the code:
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!
Thanks
here is the code:
Code:
//window
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];
Doesn't work how?
You do appear to be putting redView in front of it, which wouldn't help.
You do appear to be putting redView in front of it, which wouldn't help.

