PDA

View Full Version : Need urgent help, quick


OSXRules
2003.04.14, 03:25 PM
My project is due in one week. I need to sort out a few things. I need to be able to set the positions of sliders like what happens in the itunes equalizer when you change settings.

I would also like to know how to make an NSwindow fullscreen so I can bypass the window manager and also how to keep a preview of the scene in my NSOpenglcontext when I minimize my window. When I minimize now, the context flushes and goes white. It reappears when I bring it back, but I would like a preview thing working.

Please hurry with your replies, I don't have much time.

OSXRules
2003.04.14, 03:26 PM
I really just need the slider positioning. I tried using the setFloatValue method and it doesn't seem to do anything. Do I have to update the drawing or something?

skyhawk
2003.04.14, 04:31 PM
I'm not certain, but do you have a connection between your function and your slider?

Fenris
2003.04.15, 08:44 AM
This works for me:

In IB, make sure that your class has an IBOutlet NSSlider *mySlider that you have connected properly. Now, whenever you need to change the sliders, just [mySlider setFloatValue:666.0];

Never gave me any trouble... :/

arekkusu
2003.04.15, 12:45 PM
Originally posted by OSXRules
how to keep a preview of the scene in my NSOpenglcontext when I minimize my window. When I minimize now, the context flushes and goes white. It reappears when I bring it back, but I would like a preview thing working.


I have no idea why Apple can't get NSOpenGL content to minimize properly, especially now with Quartz Extreme. But the workaround is to copy your GL view into an NSImage, and draw that image over the Quartz content of your window. Here's my code from Untima, using a 640x400 view:


- (void) windowWillMiniaturize:(NSNotification *)notification {
[viewport lockFocus];
[offctx makeCurrentContext];
NSBitmapImageRep *minicon = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil
pixelsWide:640 pixelsHigh:400 bitsPerSample:8 samplesPerPixel:3 hasAlpha:NO
isPlanar:NO colorSpaceName:NSCalibratedRGBColorSpace bytesPerRow:0 bitsPerPixel:0];
glReadPixels(0, 0, 640, 400, GL_RGB, GL_UNSIGNED_BYTE, [minicon bitmapData]);
[minicon drawInRect:[viewport bounds]];
[minicon release];
[viewport unlockFocus];
}


Your image may appear upside down depending which way your viewport coordinate system is flipped.

OSXRules
2003.04.16, 08:16 AM
Thank you for your replies, I'll give that stuff a go. I think the sliders weren't working because I don't specify IBOutlet.