Click here to Skip to main content
15,796,299 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

This is my main loop :

static void mainLoop(void)
{    glClearColor(0,0,0,0);
    argDrawMode2D(vp);                      //draw to the screen
    char string[256];
    sprintf(string, "Some strings", string1 );
    argDrawStringsByIdealPos( string, 10.0, 25.0 );
    argSwapBuffers();   //clear the buffer

What I have tried:

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)
3. Try to resize the screen. Still got black screen
4. update Xcode compiler for terminal


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

Still the black screen. Any suggestion ?
Updated 31-Oct-18 4:36am

1 solution

I wonder about that because Apple says that OpenGL is still supported. You should read this article about Mixing Metal and OpenGL Rendering in a View which should work.

The featrures of XCode for OpenGL debugging are great.

Consider switching to metal because it has real advantages. You can read my article about Metal on iOS which shows you a jump start on it.
Share this answer
lock&_lock 31-Oct-18 9:43am    
Hi, thanks. I'll read the article. But I'm afraid switching to Metal isn't going to be the best option for me for the time being. I'm not familiar at all with Metal, and to be honest even now I will not always work with MacOs, so I'd rather use OpenGL for cross-platform convenience. Also, I've updated my question, would you please take a look and give some suggestion, maybe ? Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900