OpenGL Window class in C++

Discussion in 'Mac Programming' started by Odjaahla, Feb 26, 2011.

  1. Odjaahla macrumors newbie

    Feb 26, 2011

    I recently bought myself a mac and I would like to port some C++ OpenGL programming projects from Windows. On Windows I had a class that initialized an OpenGL window and provided functions to draw pixelated graphics, draw graphs and so on. For example:

    //compute some array x here....
    MyGLWindow* win = new MyGLWindow(640,480,"MyGraph");
    //compute another array y here...
    Writing such a class in C++ on Windows was pretty much a breeze. Not so on the mac as far as I can see. After numerous web searches it seems that the two most common OpenGL approaches are

    -glut, which is no good for my purposes, since I don't want to get stuck in glutMainLoop
    -cocoa, which seems to fail by the same reason. In all sample programs/tutorials I've seen there is the initial call to NSApplicationMain and/or one sets the window properties in xcode.

    I assume that it is possible to do what I want, but how much of a pain is it going to be? Are there any tutorial/code snippets out there?
  2. Mac_Max macrumors 6502

    Mar 8, 2004
    I'm not an expert at OpenGL by any means but have you considered using SDL or SFML? I don't believe that those two need an event loop for just using their OpenGL interfaces.

Share This Page