Fullscreen Problem

Apprentice
Posts: 9
Joined: 2010.02
Post: #1
Hi, i try to setup a fullscreenmode, but i dont see anythink on the screen. Here is my setupcode
Code:
CGDisplayErr err;
    
    //capture main display
    err = CGDisplayCapture(kCGDirectMainDisplay);    
    NSAssert(err == CGDisplayNoErr, @"Error CGDisplayCapture");
    
    //Get best Mode
    CFDictionaryRef newMode = CGDisplayBestModeForParameters(kCGDirectMainDisplay, 24, _screenWidth, _screenHeight, NULL);
    NSAssert(err == CGDisplayNoErr, @"Error CGDisplayBestModeForParameters");

    //Switch to selected resolution.
    err = CGDisplaySwitchToMode(kCGDirectMainDisplay, newMode);
    NSAssert(err == CGDisplayNoErr, @"Error CGDisplaySwitchToMode");
    
    
    NSOpenGLPixelFormatAttribute attr[] = {
        NSOpenGLPFADoubleBuffer,
        NSOpenGLPFAAccelerated,
        NSOpenGLPFAColorSize, 24,
        NSOpenGLPFADepthSize, 16,
        NSOpenGLPFAFullScreen,
        NSOpenGLPFAScreenMask,CGDisplayIDToOpenGLDisplayMask(kCGDirectMainDisplay),​
    0 };    
        
    NSOpenGLPixelFormat *nsglFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr];
    _context = [[NSOpenGLContext alloc] initWithFormat: nsglFormat shareContext: nil];
    [nsglFormat release];
    
    //set openGL context to draw to screen    
    [_context setFullScreen];    
    [_context makeCurrentContext];

here my rendercode
Code:
glViewport( 0, 0, _screenWidth, _screenHeight);
        glMatrixMode( GL_PROJECTION );
        glLoadIdentity();
        gluPerspective( 45.0, _screenWidth/_screenHeight, 1.0, 5.0 );
        glMatrixMode( GL_MODELVIEW );
        glLoadIdentity();
        
        glClear(GL_COLOR_BUFFER_BIT);    
        
        glColor3f(1.0f, 0.85f, 0.35f);
        
        glBegin(GL_TRIANGLES);
        {
            glVertex3f( -0.2, -0.3, -2.0);
            glVertex3f(  0.2, -0.3, -2.0);
            glVertex3f(  0.0,  0.3, -2.0);
        }
        glEnd();
        
        //glFlush();
        [_context flushBuffer];

there are no errors.
any suggestions?
Quote this message in a reply
Apprentice
Posts: 9
Joined: 2010.02
Post: #2
argh, Mad
there is no error, in this code, i try and try and try, and now it works (no changes in the code).

i don't know whats going on, with my mac ????? Rolleyes
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
using Xcode 3? Maybe it couldn't be bothered compiling the last change to your source for a while...
Quote this message in a reply
Apprentice
Posts: 9
Joined: 2010.02
Post: #4
Yes Xcode 3,
after several clean and builds, the project works well.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Mac OSX fullscreen application problem e40pud 7 6,244 Mar 12, 2010 05:41 AM
Last Post: OneSadCookie
  Fullscreen change problem madjerry 5 3,377 Aug 4, 2008 10:22 AM
Last Post: AnotherJake
  Fullscreen SDL/OpenGL & CMD-TAB problem NicholasFrancis 5 4,520 Dec 2, 2004 01:00 PM
Last Post: NicholasFrancis