Skip to content

Commit 57d7e8d

Browse files
GeertJohanstuartmorgan
authored andcommitted
[linux] Add GLFW-based proc resolving (#184)
Fixes #170 The default symbol resolver that is used when no specific resolver is given doesn't resolve according to OpenGL features available in the GLFW context. This causes errors for some users.
1 parent a304a86 commit 57d7e8d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

library/common/glfw/embedder.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,12 @@ static void GLFWClearCanvas(GLFWwindow *window) {
205205
glfwMakeContextCurrent(nullptr);
206206
}
207207

208+
// Resolves the address of the specified OpenGL or OpenGL ES
209+
// core or extension function, if it is supported by the current context.
210+
static void *GLFWProcResolver(void *user_data, const char *name) {
211+
return reinterpret_cast<void *>(glfwGetProcAddress(name));
212+
}
213+
208214
// Spins up an instance of the Flutter Engine.
209215
//
210216
// This function launches the Flutter Engine in a background thread, supplying
@@ -228,6 +234,7 @@ static FlutterEngine RunFlutterEngine(
228234
config.open_gl.clear_current = GLFWClearContext;
229235
config.open_gl.present = GLFWPresent;
230236
config.open_gl.fbo_callback = GLFWGetActiveFbo;
237+
config.open_gl.gl_proc_resolver = GLFWProcResolver;
231238
FlutterProjectArgs args = {};
232239
args.struct_size = sizeof(FlutterProjectArgs);
233240
args.assets_path = assets_path.c_str();

0 commit comments

Comments
 (0)