geroldboehler
2004.09.02, 05:16 PM
hi all
i draw a simple polygon (fullscreen context) and rotate it in some way. now it does rotate but flickers awfully. i tried different stuff but probably missed something.
probably someone can help me out?
thanks a lot
gerold
// this is the initialisation function, sorry for the wrapping:
CGDisplayCapture(kCGDirectMainDisplay);
CGOpenGLDisplayMask displayMask = CGDisplayIDToOpenGLDisplayMask( kCGDirectMainDisplay ) ;
CGDisplayHideCursor( kCGDirectMainDisplay );
CGLPixelFormatAttribute attribs[] =
{
kCGLPFAFullScreen,
kCGLPFADisplayMask,
kCGLPFADoubleBuffer,
(CGLPixelFormatAttribute)displayMask,
(CGLPixelFormatAttribute)NULL
};
CGLPixelFormatObj pixelFormatObj ;
long numPixelFormats ;
CGLChoosePixelFormat( attribs, &pixelFormatObj, &numPixelFormats );
CGLCreateContext( pixelFormatObj, NULL, &contextObj ) ;
CGLDestroyPixelFormat( pixelFormatObj ) ;
long swapInterval = 1;
CGLSetParameter( contextObj, kCGLCPSwapInterval, &swapInterval ) ;
CGLSetCurrentContext( contextObj ) ;
CGLSetFullScreen( contextObj ) ;
// and this is the function i call in a tight loop
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(0.0, 0.0, 0.0, 0.0);
glRotatef(0.1, 0.0f, 1.0f, 0.0f);
glRotatef(0.05, 1.0f, 0.0f, 0.0f);
glRotatef(0.2, 0.0f, 0.0f, 1.0f);
glBegin(GL_POLYGON);
glColor3f(1.0, 0.0, 0.0);
glVertex2f(-0.5, -0.5);
glColor3f(1.0, 0.0, 0.0);
glVertex2f(-0.5, 0.5);
glColor3f(1.0, 1.0, 1.0);
glVertex2f(0.5, 0.5);
glColor3f(1.0, 1.0, 1.0);
glVertex2f(0.5, -0.5);
glEnd();
glFinish();
CGLFlushDrawable( contextObj );
i draw a simple polygon (fullscreen context) and rotate it in some way. now it does rotate but flickers awfully. i tried different stuff but probably missed something.
probably someone can help me out?
thanks a lot
gerold
// this is the initialisation function, sorry for the wrapping:
CGDisplayCapture(kCGDirectMainDisplay);
CGOpenGLDisplayMask displayMask = CGDisplayIDToOpenGLDisplayMask( kCGDirectMainDisplay ) ;
CGDisplayHideCursor( kCGDirectMainDisplay );
CGLPixelFormatAttribute attribs[] =
{
kCGLPFAFullScreen,
kCGLPFADisplayMask,
kCGLPFADoubleBuffer,
(CGLPixelFormatAttribute)displayMask,
(CGLPixelFormatAttribute)NULL
};
CGLPixelFormatObj pixelFormatObj ;
long numPixelFormats ;
CGLChoosePixelFormat( attribs, &pixelFormatObj, &numPixelFormats );
CGLCreateContext( pixelFormatObj, NULL, &contextObj ) ;
CGLDestroyPixelFormat( pixelFormatObj ) ;
long swapInterval = 1;
CGLSetParameter( contextObj, kCGLCPSwapInterval, &swapInterval ) ;
CGLSetCurrentContext( contextObj ) ;
CGLSetFullScreen( contextObj ) ;
// and this is the function i call in a tight loop
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(0.0, 0.0, 0.0, 0.0);
glRotatef(0.1, 0.0f, 1.0f, 0.0f);
glRotatef(0.05, 1.0f, 0.0f, 0.0f);
glRotatef(0.2, 0.0f, 0.0f, 1.0f);
glBegin(GL_POLYGON);
glColor3f(1.0, 0.0, 0.0);
glVertex2f(-0.5, -0.5);
glColor3f(1.0, 0.0, 0.0);
glVertex2f(-0.5, 0.5);
glColor3f(1.0, 1.0, 1.0);
glVertex2f(0.5, 0.5);
glColor3f(1.0, 1.0, 1.0);
glVertex2f(0.5, -0.5);
glEnd();
glFinish();
CGLFlushDrawable( contextObj );