Is there an easy way to open one (or many) opengl windows in Mac OS X with C ++?

Yes, I hate Objective-c, plus my project will be portable, so I would like as much C ++ code as possible, ideally 100%.
So I have a regular C ++ project created using Xcode, and you want to open some OpenGL windows.

edit: Damn, Glut takes control of the application with glutMainLoop (), and I like to have more control over the loop.
It will try freeglut, although I cannot find the OSX binaries, and I always have such an unsuccessful attempt to compile another code.

Update:
I tried connecting to SDL 1.3 again, and this time I was able to get it working! Yoo-hoo!
I always wanted to work with SDL, but the use of more than one window was mandatory, and that a version 1.3 function that is under development, and I could never get it to work.
Since it carries over to millions of operating systems and handles 2D graphics as well as OpenGL, I'm going with it. Thanks everyone!

+3
source share
4 answers

objective-c, , X11, , ​​ GLUT, . , GLUT, , .

GLUT, , objective-c ++. , , , , , objective-c ids void * ids, .

+3

, NeHe ;

+2

GLUT , , , ++-. , GLUT , .

EDIT: glutMainLoop(), , GLUT - , opengl. freeglut OOB mac, , .

Qt . ++ GUI . -, , , . , . , "" , .

Cocoa/OpenGL, : http://developer.apple.com/library/mac/#samplecode/CocoaGL/Introduction/Intro.html

+2

3 , . , Mac/Windows/Linux/mobile OpenGL. , - . , .

API , , , , , ..:

  • SFML github repo: nice & tidy, ++, - , OpenGL . OpenGL 3.3 MacOS, Win Linux. , 2.2 (github).
  • SDL2: , . OpenGL , GLEW, , (. ). SFML.

API , OpenGL:

  • GLWF: GLUT OpenGL. , : Win, OSX, Lin. .
  • GLEW : I mention this for completeness only. It does not manage windows, but helps manage OpenGL contexts, and you can use it with GLWF or SDL, for example.

Others:

  • Freeglut : continued open source GLUT. Suitable for small demonstration projects. I did not use it myself, but I saw good documents and a demo code. In active development.
  • GLUT: old, discontinued. Inherited demos and code on the network.
+1
source

Source: https://habr.com/ru/post/1783761/


All Articles