Skip to content

WIP: gl: add support for opengl32 from MinGW which is OpenGL 1.1

When building cairo for Windows with mingw-w64 and the gl backend enabled the linker complains about undefined references to glActiveTexture and glBlendFuncSeparate:

-----------------------------------------------------------------------
/usr/bin/x86_64-w64-mingw32-ld: src/libcairo-2.dll.p/cairo-gl-composite.c.obj: in function `_cairo_gl_context_setup_operand':
/home/ao2/WIP/gnome/gtk/subprojects/cairo/build-meson/../src/cairo-gl-composite.c:343: undefined reference to `glActiveTexture'
/usr/bin/x86_64-w64-mingw32-ld: /home/ao2/WIP/gnome/gtk/subprojects/cairo/build-meson/../src/cairo-gl-composite.c:361: undefined reference to `glActiveTexture'
/usr/bin/x86_64-w64-mingw32-ld: src/libcairo-2.dll.p/cairo-gl-composite.c.obj: in function `_cairo_gl_set_operator':
/home/ao2/WIP/gnome/gtk/subprojects/cairo/build-meson/../src/cairo-gl-composite.c:484: undefined reference to `glBlendFuncSeparate'
/usr/bin/x86_64-w64-mingw32-ld: /home/ao2/WIP/gnome/gtk/subprojects/cairo/build-meson/../src/cairo-gl-composite.c:486: undefined reference to `glBlendFuncSeparate'
/usr/bin/x86_64-w64-mingw32-ld: src/libcairo-2.dll.p/cairo-gl-device.c.obj: in function `_cairo_gl_context_activate':
/home/ao2/WIP/gnome/gtk/subprojects/cairo/build-meson/../src/cairo-gl-device.c:344: undefined reference to `glActiveTexture'
/usr/bin/x86_64-w64-mingw32-ld: /home/ao2/WIP/gnome/gtk/subprojects/cairo/build-meson/../src/cairo-gl-device.c:346: undefined reference to `glActiveTexture'
/usr/bin/x86_64-w64-mingw32-ld: src/libcairo-2.dll.p/cairo-gl-glyphs.c.obj: in function `_cairo_gl_glyph_cache_add_glyph':
/home/ao2/WIP/gnome/gtk/subprojects/cairo/build-meson/../src/cairo-gl-glyphs.c:133: undefined reference to `glActiveTexture'
collect2: error: ld returned 1 exit status
-----------------------------------------------------------------------

This happens because the opengl32 library only exposes OpenGL 1.1 entry points.

Querying the two entry points via the GetProcAddress mechanism in cairo-gl-dispatcher.c fixes the build issues.

This change was originally proposed by daniel on https://bugs.freedesktop.org/show_bug.cgi?id=82054

Fixes #204 (closed)

Edited by Antonio Ospite

Merge request reports