Need urgent help, quick

OSXRules
Unregistered
 
Post: #1
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.
Quote this message in a reply
OSXRules
Unregistered
 
Post: #2
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?
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #3
I'm not certain, but do you have a connection between your function and your slider?
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #4
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... :/
Quote this message in a reply
Sage
Posts: 1,234
Joined: 2002.10
Post: #5
Quote: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:

Code:
- (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.
Quote this message in a reply
OSXRules
Unregistered
 
Post: #6
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.
Quote this message in a reply
Post Reply