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)
sprintf(string, "Some strings", string1 );
argDrawStringsByIdealPos( string, 10.0, 25.0 );
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 ?