Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
gl_context_helper.h File Reference

Go to the source code of this file.

Functions

bool initialize_gl_mac ()
 

Function Documentation

◆ initialize_gl_mac()

bool initialize_gl_mac ( )

Definition at line 15 of file gl_context_helper.mm.

15 {
16 CGLPixelFormatAttribute attributes[] = {
17 // base parameters
18 kCGLPFAOpenGLProfile,
19 (CGLPixelFormatAttribute) kCGLOGLPVersion_3_2_Core,
20 kCGLPFADoubleBuffer,
21 (CGLPixelFormatAttribute)NULL
22 };
23
24 CGLPixelFormatObj pixFormat;
25 GLint npix;
26 CGLChoosePixelFormat(attributes, &pixFormat, &npix);
27 if (nullptr == pixFormat) {
28 printf("CGLChoosePixelFormat failed.");
29 return false;
30 }
31
32 CGLContextObj context;
33 CGLCreateContext(pixFormat, nullptr, &context);
34 CGLReleasePixelFormat(pixFormat);
35
36 if (!context) {
37 printf("CGLCreateContext failed.");
38 return false;
39 }
40
41 CGLSetCurrentContext(context);
42 return true;
43}
std::string printf(const char *fmt,...) SK_PRINTF_LIKE(1