Inclusion in a full-screen GL context

Okay, this is a little complicated. I detect when the application goes into full-screen mode (captures the display), and then I sometimes need to draw some materials in the context of the captured screens for notification purposes (for example, notifications about Growl, but they should also work in full-screen mode).

Is there a way to change the different context of the GL / CG application (For example, Fraps on Windows inserts the FPS counter into OGL applications)? Unfortunately, the overlay method of the shielding window does not work when capturing the display. Any ideas?

+3
source share
2 answers

OpenGL Quartz Display Services. , , .

  • CGLSetFullScreen , CGLSetFullScreenOnDisplay .

  • , GL

.

CGOpenGLDisplayMask displayMask = CGDisplayIDToOpenGLDisplayMask(displayId);
CGLPixelFormatAttribute attribs[] = {
    kCGLPFAFullScreen,
    kCGLPFADisplayMask,
    displayMask,
    0
};

// Create gl context
GLint numPixelFormats;
CGLPixelFormatObj pixelFormatObj;
CGLChoosePixelFormat(attribs, &pixelFormatObj, &numPixelFormats);

CGLCreateContext(pixelFormatObj, NULL, &glContext);

CGLDestroyPixelFormat(pixelFormatObj);
CGLSetCurrentContext(glContext);
CGLSetFullScreen(glContext);

do {
    glLoadIdentity();

    glBegin(GL_TRIANGLES);

    glColor3f(1.0f, 0.0f, 0.0f);
    glVertex3f(0.0f, 1.0f, 0.0f);
    glColor3f(0.0f, 1.0f, 0.0f);
    glVertex3f(-1.0f, -1.0f, 0.0f);
    glColor3f(0.0f, 0.0f, 1.0f);
    glVertex3f(1.0f, -1.0f, 0.0f);

    glEnd();
    glFlush();

} while (!invalid);
0

GLFullscreen 10.6+ ( ). - , - , - , CGL. , , . , -, -.

0

Source: https://habr.com/ru/post/1763119/


All Articles