kCGLPFASampleBuffers, 1,
kCGLPFASamples, 4,
kCGLPFAPBuffer,
+ kCGLPFAOpenGLProfile, kCGLOGLPVersion_Legacy,
0
};
kCGLPFADepthSize, 24,
kCGLPFAStencilSize, 8,
kCGLPFAPBuffer,
+ kCGLPFAOpenGLProfile, kCGLOGLPVersion_Legacy,
0
};
error = CGLChoosePixelFormat(prefered_attrs, pix, n);
- if (error || !pix) {
- YAGL_LOG_WARN("CGLChoosePixelFormat: no suitable prefered format found (%s)",
+ if (error) {
+ YAGL_LOG_WARN("CGLChoosePixelFormat: error occurs (%s)",
CGLErrorString(error));
return CGLChoosePixelFormat(fallback_attrs, pix, n);
+ } else if (*pix == NULL || *n == 0) {
+ YAGL_LOG_WARN("CGLChoosePixelFormat: no suitable prefered format found");
+ return CGLChoosePixelFormat(fallback_attrs, pix, n);
+ } else {
+ return error;
}
- return error;
}
static bool yagl_egl_cgl_get_gl_version(struct yagl_egl_cgl *egl_cgl,