2

I accidentally updated my Mac, and OpenGL is now deprecated in the latest MacOS Mojave. 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 get black screen.

I read a lot of same issues with black screen on OpenGL after Mojave update, like Black screen on OpenGL , and Mac Mojave + opengl Ask Question. But as of now, none of them have accepted answer and the provided answers don't work on me.

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();
}

I have 2 questions :

  1. Do you have any suggestion how to solve the black screen problem ? What I have tried but still got black screen :

    • Change glFlush() into glutSwapBuffers() to flush without a call

    • 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.

    • Try to resize the window using reshape.

    • Update Xcode compiler for terminal to the latest version (Beta)

  2. I'm using Gamma Correction from OpenGL with with glEnable(GL_FRAMEBUFFER_SRGB), and after Mojave I'm facing this

    "Assertion failed: (value >= 0.0f && value <= 1.0f), function LinearToSRGB"

    Does the openGL gamma correction doesn't work anymore ?

Any Suggestion ?

[UPDATE 1]

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' from The University of Bath, 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 using glutFullScreen(); , my screen is rendered, as of now the frame transition is not smooth and I'm still working on it.

Also, I set my fps into 60fps and print them out. 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). I realize this hack is also not reliable in the future. So, still need suggestion here, or other solution rather than resize.

enter image description here

[UPDATE 2]

I tried to changed my whole project using GLFW. Still the same black screen issue even with GLFW. Therefore this is not API issue.

[UPDATE 3]

Tried to clean uninstall XCode 10 (which comes with Mojave update). Then install XCode 9.41 (Sierra) and Command Tools 9.41 as well. As of now, the GLFW works, and the GLUT still doesn't work.

raisa_
  • 594
  • 2
  • 10
  • 28
  • I know you're working in C, but, as an experiment, can you try: 1) change your program to Objective-C by changing the filename extension from `.c` to `.m`; 2) add `#import ` near the top; 3) and adding `[CATransaction flush];` after your swap/flush statement(s). Does that help? – Ken Thomases Oct 31 '18 at 11:00
  • Hi, thanks. This may sound silly but I'm having linker command failed issue. Seems like the QuartzCore framework can't be properly called. – raisa_ Oct 31 '18 at 11:34
  • Oh, right. You need to add `-framework QuartzCore` to the link command. Sorry for forgetting that. – Ken Thomases Oct 31 '18 at 14:23
  • @KenThomases Hi, I have added the framework and followed the rest of you suggestion. However I still get the black screen as well. – raisa_ Nov 01 '18 at 07:06
  • You using FreeGLUT or whatever Apple is shipping? – genpfault Nov 02 '18 at 17:14
  • @genpfault it comes with the OS. I just need to call it. – raisa_ Nov 02 '18 at 17:27

0 Answers0