#ifndef LLMR_RENDERER_GL #define LLMR_RENDERER_GL #include #ifdef NVIDIA #include #include // #include #elif __APPLE__ #include "TargetConditionals.h" #if TARGET_OS_IPHONE #include #include #define glGenVertexArrays glGenVertexArraysOES #define glBindVertexArray glBindVertexArrayOES #define glDeleteVertexArrays glDeleteVertexArraysOES #define GL_ARB_vertex_array_object 1 #elif TARGET_IPHONE_SIMULATOR #include #include #elif TARGET_OS_MAC #include #include #define glGenVertexArrays glGenVertexArraysAPPLE #define glBindVertexArray glBindVertexArrayAPPLE #define glDeleteVertexArrays glDeleteVertexArraysAPPLE #else #error Unsupported Apple platform #endif #else #define GL_GLEXT_PROTOTYPES #include #include #include #endif namespace llmr { namespace gl { // Debug group markers, useful for debuggin on iOS inline void start_group(const std::string &str) { #if GL_EXT_debug_marker glPushGroupMarkerEXT(0, str.c_str()); #endif } inline void end_group() { #if GL_EXT_debug_marker glPopGroupMarkerEXT(); #endif } struct group { inline group(const std::string &str) { start_group(str); } ~group() { end_group(); }; }; } } #ifdef GL_ES_VERSION_2_0 #define glClearDepth glClearDepthf #define glDepthRange glDepthRangef #endif void _CHECK_GL_ERROR(const char *cmd, const char *file, int line); #define _CHECK_ERROR(cmd, file, line) \ cmd; \ do { _CHECK_GL_ERROR(#cmd, file, line); } while (false); #define CHECK_ERROR(cmd) _CHECK_ERROR(cmd, __FILE__, __LINE__) #endif