OpenGL headers for OS X & Linux

前端 未结 4 624
谎友^
谎友^ 2021-02-05 22:58

I\'d like to have both the includes for OS X as well as linux in my opengl program (C++) how can I set my program to use one if the other is not available? Here\'s what i\'m cur

4条回答
  •  萌比男神i
    2021-02-05 23:10

    What we use for OSX, Unix, Linux, Android, and iOS

    #if defined(_WIN32) || defined(_WIN64)
    #  include 
    #  include 
    #  include 
    #elif __APPLE__
    #  include "TargetConditionals.h"
    #  if (TARGET_OS_IPHONE && TARGET_IPHONE_SIMULATOR) || TARGET_OS_IPHONE
    #    include 
    #    include 
    #  else
    #    include 
    #    include 
    #    include 
    #  endif
    #elif defined(__ANDROID__) || defined(ANDROID)
    #  include 
    #  include 
    #elif defined(__linux__) || defined(__unix__) || defined(__posix__)
    #  include 
    #  include 
    #  include 
    #else
    #  error platform not supported.
    #endif
    

提交回复
热议问题