Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 1 of 1

Thread: How to handle OpenGL Black Screen after update to MacOs Mojave 10.14 ?

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2018
    Posts
    4

    How to handle OpenGL Black Screen after update to MacOs Mojave 10.14 ?

    As you may have known, OpenGL is now deprecated in the latest MacOS Mojave (10.14). I'm using OpenGL + GLUT (I know this is old, but I just need a simple program) and run on terminal (not using Xcode). With the same program that has been working perfectly in Sierra, I got so many OpenGL deprecated warnings in Mojave and managed to suppress all the warning using -Wno-deprecated-declarations , but now I only got black screen.

    I read a lot of same issues with black screen on OpenGL after Mojave update in StackOverflow. But as of now, only few of them actually have accepted answer and the answers don't work on me. So, when I run sometimes it renders, and sometimes it's just black screen. What I have tried :

    1. Change glFlush() into glutSwapBuffers() to flush without a call
    2. Change glClear(GL_COLOR_BUFFER_BIT) into glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); (this one causing even more warning). Also I tried to set the color into glClearColor(255,255,255,0) (white), but after clear color buffer, only black screen. So the glClear isn't working.
    3. Try to resize the window using reshape.
    4. update Xcode compiler for terminal to the latest version (Beta)


    This is my main loop :

    Code :
    static void mainLoop(void)
    {    glClearColor(0,0,0,0);
        glClear(GL_COLOR_BUFFER_BIT);
        //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        glEnable(GL_FRAMEBUFFER_SRGB);
     
        argDrawMode2D(vp);                      //draw to the screen
     
        char string[256];
        glColor3f(1,1,1);
        sprintf(string, "Some strings", string1 );
        argDrawStringsByIdealPos( string, 10.0, 25.0 );
     
        argSwapBuffers();   //clear the buffer
        glFlush();
    }

    Any suggestion ?

    [UPDATE]

    Step 3 above : Try to resize the window using reshape.

    This one seems to work a little bit after I changed into full screen, following this Mojave'Hack' to resize your window to other dimension than the initial size. It failed when I set to another size (smaller/bigger), but when I set into fullscreen usingHide glutFullScreen(); my screen is rendered, as of now the frame transition is not smooth and I'm still working on it.

    Attachment 2870

    Also, I set my fps into 60fps and print them out on terminal. And after this hack I got random fps from 100-200 fps here, despite my Mac refresh rate only 90Hz. It is because the resize command, when I commented out the resize command I got black screen but the printed fps in terminal is correct (around 60fps). So, still need suggestion here, or other solution rather than resize.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Screen Shot 2018-10-31 at 20.48.22.jpg 
Views:	9 
Size:	13.8 KB 
ID:	2871  
    Last edited by pixie_laluna; 10-31-2018 at 08:04 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •