Changeset 960


Ignore:
Timestamp:
Sep 19, 2011, 1:32:18 AM (8 years ago)
Author:
sam
Message:

osx: link with the proper OpenGL libraries on OS X.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.ac

    r958 r960  
    103103 [MAKE_FSELF=no])
    104104AM_CONDITIONAL(USE_MAKE_FSELF, test "${MAKE_FSELF}" != "no")
     105
     106
     107LIBS_save="$LIBS"
     108LIBS="$LIBS -Wl,-framework -Wl,OpenGL"
     109AC_MSG_CHECKING(for -framework OpenGL)
     110AC_TRY_LINK([], [],
     111 [ac_cv_my_have_cocoa="yes"
     112  AC_MSG_RESULT(yes)
     113  GL_LIBS="${GL_LIBS} -framework OpenGL"
     114  CXXFLAGS="${CXXFLAGS} -ObjC++"],
     115 [AC_MSG_RESULT(no)])
     116LIBS="$LIBS_save"
    105117
    106118
     
    233245
    234246
    235 dnl Use Cocoa?
    236 ac_cv_my_have_cocoa="no"
    237 LIBS_save="$LIBS"
    238 LIBS="$LIBS -Wl,-framework -Wl,Cocoa"
    239 AC_MSG_CHECKING(for -framework Cocoa)
    240 AC_TRY_LINK([], [],
    241  [ac_cv_my_have_cocoa="yes"
    242   AC_MSG_RESULT(yes)
    243   CXXFLAGS="${CXXFLAGS} -ObjC++"],
    244  [AC_MSG_RESULT(no)])
    245 LIBS="$LIBS_save"
    246 AM_CONDITIONAL(USE_COCOA, test "${ac_cv_my_have_cocoa}" != "no")
    247 
    248 
    249247dnl Use EGL?
    250248ac_cv_my_have_egl="no"
  • trunk/src/debug/quad.cpp

    r943 r960  
    154154    if (!data->initialised && !IsDestroying())
    155155    {
    156 #if !defined __CELLOS_LV2__ && !defined __ANDROID__
     156#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__
    157157        glGenVertexArrays(NUM_ARRAYS, data->array);
    158158#endif
     
    184184    else if (data->initialised && IsDestroying())
    185185    {
    186 #if !defined __CELLOS_LV2__ && !defined __ANDROID__
     186#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__
    187187        glDeleteVertexArrays(NUM_ARRAYS, data->array);
    188188#endif
     
    916916     * animated distorted checkerboard.
    917917     */
    918 #if !defined __CELLOS_LV2__ && !defined __ANDROID__
     918#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__
    919919    if (!shader[0])
    920920    {
     
    986986     * animated distorted checkerboard.
    987987     */
    988 #if !defined __CELLOS_LV2__ && !defined __ANDROID__
     988#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__
    989989    if (!shader[0])
    990990    {
  • trunk/src/gradient.cpp

    r861 r960  
    3434    Shader *shader;
    3535    GLuint bufs[2];
    36 #if defined HAVE_GL_2X
     36#if defined HAVE_GL_2X && !defined __APPLE__
    3737    GLuint vaos[1];
    3838#endif
     
    155155#if !defined __CELLOS_LV2__
    156156        glGenBuffers(2, data->bufs);
    157 #   if defined HAVE_GL_2X
     157#   if defined HAVE_GL_2X && !defined __APPLE__
    158158        glGenVertexArrays(1, data->vaos);
    159159#   endif
     
    196196    /* Bind vertex, color and texture coordinate buffers */
    197197#if !defined __CELLOS_LV2__
    198 #   if defined HAVE_GL_2X
     198#   if defined HAVE_GL_2X && !defined __APPLE__
    199199    glBindVertexArray(data->vaos[0]);
    200200#   endif
     
    223223
    224224#if !defined __CELLOS_LV2__
    225 #   if defined HAVE_GL_2X
     225#   if defined HAVE_GL_2X && !defined __APPLE__
    226226    glBindVertexArray(0);
    227227#   endif
  • trunk/src/lolgl.h

    r954 r960  
    2424#endif
    2525
    26 /* Include GL */
    27 #if defined USE_GLEW
     26/* Include GL development headers.
     27 * Do not include glew.h on OS X, because the version shipped with Fink
     28 * links with X11 whereas we want the system’s Cocoa-friendly GL libs. */
     29#if defined USE_GLEW && !defined __APPLE__
    2830#   include <glew.h>
    2931#elif defined HAVE_GL_2X
    30 #   if defined __APPLE__ && defined __MACH__
     32#   if defined __APPLE__ && defined __MACH__ && defined __arm__
    3133#       include <OpenGL/gl.h>
     34#   elif defined __APPLE__ && defined __MACH__
     35#       define MACOS_OPENGL
     36#       define GL_GLEXT_PROTOTYPES
     37#       include <OpenGL/OpenGL.h>
     38#       include <OpenGL/gl.h>
     39#       include <OpenGL/glext.h>
    3240#   else
    3341#       define GL_GLEXT_PROTOTYPES
  • trunk/src/scene.cpp

    r866 r960  
    6060    float angle;
    6161
    62 #if defined HAVE_GL_2X
     62#if defined HAVE_GL_2X && !defined __APPLE__
    6363    GLuint vao;
    6464#endif
     
    8585    data->nbufs = 0;
    8686
    87 #if defined HAVE_GL_2X
     87#if defined HAVE_GL_2X && !defined __APPLE__
    8888    glGenVertexArrays(1, &data->vao);
    8989#endif
     
    9797    if (data->nbufs > 0)
    9898        glDeleteBuffers(data->nbufs, data->bufs);
    99 #if defined HAVE_GL_2X
     99#if defined HAVE_GL_2X && !defined __APPLE__
    100100    glDeleteVertexArrays(1, &data->vao);
    101101#endif
     
    321321    glEnable(GL_DEPTH_TEST);
    322322    glDepthFunc(GL_LEQUAL);
    323 #if defined HAVE_GL_2X
     323#if defined HAVE_GL_2X && !defined __APPLE__
    324324    glEnable(GL_ALPHA_TEST);
    325325    glAlphaFunc(GL_GEQUAL, 0.01f);
     
    360360
    361361        /* Bind vertex, color and texture coordinate buffers */
    362 #if defined HAVE_GL_2X
     362#if defined HAVE_GL_2X && !defined __APPLE__
    363363        glBindVertexArray(data->vao);
    364364#endif
     
    387387        glDrawArrays(GL_TRIANGLES, 0, (n - i) * 6);
    388388
    389 #if defined HAVE_GL_2X
     389#if defined HAVE_GL_2X && !defined __APPLE__
    390390        glBindVertexArray(0);
    391391#endif
  • trunk/src/video.cpp

    r939 r960  
    3434private:
    3535    static mat4 proj_matrix, view_matrix;
    36 #if defined __ANDROID__ || defined __CELLOS_LV2__
     36#if defined __ANDROID__ || defined __CELLOS_LV2__ || defined __APPLE__
    3737    static ivec2 saved_viewport;
    3838#endif
     
    4242mat4 VideoData::view_matrix;
    4343
    44 #if defined __ANDROID__ || defined __CELLOS_LV2__
     44#if defined __ANDROID__ || defined __CELLOS_LV2__ || defined __APPLE__
    4545ivec2 VideoData::saved_viewport = 0;
    4646#endif
     
    5252void Video::Setup(ivec2 size)
    5353{
    54 #if defined USE_GLEW
     54#if defined USE_GLEW && !defined __APPLE__
    5555    /* Initialise GLEW if necessary */
    5656    GLenum glerr = glewInit();
     
    6565    glViewport(0, 0, size.x, size.y);
    6666
    67 #if defined __ANDROID__ || defined __CELLOS_LV2__
     67#if defined __ANDROID__ || defined __CELLOS_LV2__ || defined __APPLE__
    6868    VideoData::saved_viewport = size;
    6969#endif
     
    7272    glClearDepth(1.0);
    7373
    74 #if defined HAVE_GL_2X
     74#if defined HAVE_GL_2X && !defined __APPLE__
    7575    glShadeModel(GL_SMOOTH);
    7676    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
     
    184184    // FIXME: use psglCreateDeviceAuto && psglGetDeviceDimensions
    185185    return VideoData::saved_viewport;
     186#elif defined __APPLE__
     187    return VideoData::saved_viewport;
    186188#else
    187189    GLint v[4];
Note: See TracChangeset for help on using the changeset viewer.