Skip to content

Commit ff234d8

Browse files
authored
example: clarifies EGL loading steps with comments (#531)
1 parent 27bed11 commit ff234d8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

example/c/egl_x11/egl_x11.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ int main(void) {
4747
printf("Unable to create window.\n");
4848
return 1;
4949
}
50-
50+
// We need to load EGL before `eglInitialize()` and after it.
51+
// Otherwise glad loads EGL 1.0.
52+
// https://github.com/Dav1dde/glad/issues/177
5153
int egl_version = gladLoaderLoadEGL(NULL);
5254
if (!egl_version) {
5355
printf("Unable to load EGL.\n");
@@ -61,12 +63,14 @@ int main(void) {
6163
printf("Got no EGL display.\n");
6264
return 1;
6365
}
64-
66+
6567
if (!eglInitialize(egl_display, NULL, NULL)) {
6668
printf("Unable to initialize EGL\n");
6769
return 1;
6870
}
6971

72+
// Try to load EGL again after calling `eglInitialize`, this time we pass the
73+
// `egl_display`.
7074
egl_version = gladLoaderLoadEGL(egl_display);
7175
if (!egl_version) {
7276
printf("Unable to reload EGL.\n");

0 commit comments

Comments
 (0)