From 990a78d1a16a33adb92771864fbab228bacfc7a5 Mon Sep 17 00:00:00 2001 From: Brandon DeRosier Date: Thu, 23 Jun 2022 21:02:43 -0700 Subject: [PATCH] Make the GLFW embedder example work on Linux (flutter/engine#34156) --- engine/src/flutter/examples/glfw/FlutterEmbedderGLFW.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engine/src/flutter/examples/glfw/FlutterEmbedderGLFW.cc b/engine/src/flutter/examples/glfw/FlutterEmbedderGLFW.cc index b4b7fb4fe5..8b17b25958 100644 --- a/engine/src/flutter/examples/glfw/FlutterEmbedderGLFW.cc +++ b/engine/src/flutter/examples/glfw/FlutterEmbedderGLFW.cc @@ -103,6 +103,9 @@ bool RunFlutter(GLFWwindow* window, config.open_gl.fbo_callback = [](void*) -> uint32_t { return 0; // FBO0 }; + config.open_gl.gl_proc_resolver = [](void*, const char* name) -> void* { + return reinterpret_cast(glfwGetProcAddress(name)); + }; // This directory is generated by `flutter build bundle`. std::string assets_path = project_path + "/build/flutter_assets"; @@ -153,6 +156,10 @@ int main(int argc, const char* argv[]) { return EXIT_FAILURE; } +#if defined(__linux__) + glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API); +#endif + GLFWwindow* window = glfwCreateWindow( kInitialWindowWidth, kInitialWindowHeight, "Flutter", NULL, NULL); if (window == nullptr) {