eglCreateContext function
Implementation
Pointer<Void> eglCreateContext(
Pointer<Void> display,
Pointer<Void> config, {
int contextClientVersion = 3,
Pointer<Void>? shareContext,
bool isDebugContext = false,
}) {
final attributeList = calloc<Int32>(5);
attributeList[0] = EGL_CONTEXT_CLIENT_VERSION;
attributeList[1] = contextClientVersion;
if (!isDebugContext) {
attributeList[2] = EglValue.none.toIntValue();
} else {
attributeList[2] = EGL_CONTEXT_OPENGL_DEBUG;
attributeList[3] = EGL_TRUE;
attributeList[4] = EglValue.none.toIntValue();
}
final nativeCallResult = _libEGL!.eglCreateContext(
display, config, shareContext ?? nullptr, attributeList);
late Pointer<Void> result;
if (nativeCallResult != nullptr) {
result = nativeCallResult;
}
calloc.free(attributeList);
if (nativeCallResult == nullptr) {
throw EglException(
'Failed to create context for display [$display], config [$config], context client version $contextClientVersion, share context [$shareContext].');
}
return result;
}