eglInitialize function

EglInitializeResult eglInitialize(
  1. Pointer<Void> display
)

Implementation

EglInitializeResult eglInitialize(Pointer<Void> display) {
  final major = allocate<Int32>();
  final minor = allocate<Int32>();
  final nativeCallSucceeded = _libEGL.eglInitialize(display, major, minor) == 1;
  EglInitializeResult result;

  if (nativeCallSucceeded) {
    result = EglInitializeResult(
      majorVersion: major.value,
      minorVersion: minor.value,
    );
  } else {
    throw EglException('Failed to initialize with display [$display]');
  }

  free(major);
  free(minor);

  return result;
}