Make the GLFW embedder example work on Linux (flutter/engine#34156)

This commit is contained in:
Brandon DeRosier
2022-06-23 21:02:43 -07:00
committed by GitHub
parent ee0e8303fb
commit 990a78d1a1

View File

@@ -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<void*>(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) {