Is OpenGL on macOS deprecated?
According to the OpenGL Programming Guide for Mac as well as this here (all the way at the bottom), OpenGL is a deprecated technology starting with macOS 10.14. They want you to use Metal instead…
Glut/Glu alternatives on OSX 10.9 for drawing primitives like spheres
You might want to check out SceneKit if you can use 10.9+. It's a native Cocoa framework specifically designed for dealing with 3D rendering.
From the docs:
'Scene Kit is a 3D-rendering Objective-C framework that combines a
high-performance rendering engine with a high-level, descriptive API.
Scene Kit supports the import, manipulation, and rendering of 3D
assets without requiring the exact steps to render a scene the way
OpenGL does.'
In particular the SCNSphere
class is what you'll be looking for.
And here's a nice scene kit intro by Big Nerd Ranch:
SceneKit in Mountain Lion
However, one thing to consider is that you'll end up with code that is not portable to other platforms as SceneKit is native to OS X (and eventually iOS). Frameworks like OpenGL, Ogre, Irrlicht on the other hand support many different desktop and mobile platforms.
glutInitContextVersion() is missing from glut library
GLUT development ended many years ago and that is actually a non-standard extension (added in FreeGLUT). OS X ships with its own implementation of standard GLUT (3.x). Though since you mention OS X 10.9 in your question, it is worth pointing out that the compiler is going to generate all sorts of annoying deprecation warnings if you try to use it.
If you want to get a 3.2 core context on OS X using the Frameworks that ship with it, you will have to use CGL (C) or NSOpenGL (Objective C).
If you insist on using GLUT, you will need to find a port of FreeGLUT for OS X instead of the Framework that ships with the platform. This of course means tracking down additional dependencies, but I don't think that will be that big a deal. Just remember to stop including the GLUT headers that ship with Xcode.
OSX 10.9 alternative to ICMDecompressionSessionRef Deprecation and the like
The answer is the VideoToolbox Framework.
OpenGL C++ on Mac build fail 'GL/glut.h' file not found
When you changed it to 'GLUT/glut.h` it finds the header correctly. Unfortunately now you get all the warning messages about deprecated functions.
For a fix for the deprecated function messages see xcode 5 deprecation warning about glut functions or Glut deprecation in Mac OSX 10.9, IDE: QT Creator
You also have an error message saying that your main function needs to return an int. This is what will prevent your code from compiling, not the warnings.
Edit
You should change your main function to have a return type of int.
int main(int argc, char *argv[])
{
/* code */
return 0;
}
Some compilers will accept void as a return type for main but this is a non-standard extension.
Why won't this OpenGL program open a window?
YOu did not include the call to glutInit()
into your simple.cpp
example. You can't call any other GLUT commands before this intialization, and doing so results in undefined behavior.
Related Topics
Cuda Linking Error - Visual Express 2008 - Nvcc Fatal Due to (Null) Configuration File
How Could Comma Separated Initialization Such as in Eigen Be Possibly Implemented in C++
Implementing a Std::Vector Like Container Without Undefined Behavior
Large Negative Integer Literals
Calling Base Class Definition of Virtual Member Function with Function Pointer
C++ Regex for Overlapping Matches
Why Infinite Recursion Leads to Seg Fault
Cmake: Project Structure with Unit Tests
Improve Matching of Feature Points with Opencv
How to Program for Windows Phone 7 in Standard C++ Only
Qdialog Exec() and Getting Result Value
Initializing a Ublas Vector from a C Array
How to Pass a Std::Function Object to a Function Taking a Function Pointer
Exception Error C0000005 in Vc++
Aligning Static String Literals
Why the Initializer of Std::Function Has to Be Copyconstructible