Files
conan-build/recipes/opengl/all/test_package/osx.mm
Aleksandr Vodyanov 3759e1163f [DO-981] qt package (!15)
Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech>
Reviewed-on: https://git.avroid.tech/Conan/conan_build/pulls/15
2025-02-13 12:25:48 +03:00

32 lines
804 B
Plaintext

#include "TargetConditionals.h"
#if TARGET_OS_TV || TARGET_OS_WATCH || TARGET_OS_IPHONE
#else
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
#endif
bool init_context()
{
#if TARGET_OS_TV || TARGET_OS_WATCH || TARGET_OS_IPHONE
return true;
#else
NSOpenGLPixelFormatAttribute pixelFormatAttributes[] =
{
NSOpenGLPFAColorSize, 24,
NSOpenGLPFAAlphaSize, 8,
NSOpenGLPFADoubleBuffer,
0
};
NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:pixelFormatAttributes];
if (!pixelFormat)
return false;
NSOpenGLContext *context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil];
if (!context)
return false;
[context makeCurrentContext];
return true;
#endif
}