Skip to content

WebGL and iOS GLES version from OF_WEBGL_VERSION / OF_GLES_VERSION defines - #8573

Open
danoli3 wants to merge 1 commit into
openframeworks:masterfrom
danoli3:gl-version-defines
Open

danoli3 wants to merge 1 commit into
openframeworks:masterfrom
danoli3:gl-version-defines

Conversation

@danoli3

@danoli3 danoli3 commented Oct 6, 2026

Copy link
Copy Markdown
Member

Lets a project pick the WebGL version (emscripten) and the GLES version (iOS / tvOS) with a define instead of editing OF core or main.mm. projectGenerator will expose both as dropdowns and write the define into the project (Xcode preprocessor defines, PROJECT_DEFINES in config.make for make projects).

Emscripten - OF_WEBGL_VERSION=1|2 (default 2)

  • ofxAppEmscriptenWindow.cpp: context majorVersion was hardcoded to 2, now OF_WEBGL_VERSION
  • config.emscripten.default.mk: OF_WEBGL_VERSION=1 in PROJECT_DEFINES links -s MAX_WEBGL_VERSION=1 -s FULL_ES2, otherwise the existing MAX_WEBGL_VERSION=2 ... FULL_ES3 flags (config.make is included before the platform makefile, so PROJECT_DEFINES is already set there)
  • Renderer still sets up as ES 2.0 (setup(2,0)), unchanged, so shaders work for both

iOS / tvOS - OF_GLES_VERSION=1|2|3 (default 2 / ES2)

  • ofxiOSConstants.h: #define OF_GLES_VERSION OFXIOS_RENDERER_ES2 unless already defined
  • ofiOSWindowSettings default glesVersion uses it (was literal 2)
  • ios / tvOS template main.mm: settings.glesVersion = OF_GLES_VERSION;
  • Existing projects with OFXIOS_RENDERER_ES2 hardcoded in their main.mm keep ES2 - the define only takes over where main.mm uses it

No define = same behaviour as before on both.

Checks

  • em++ compile of ofxAppEmscriptenWindow.cpp with no define and with -DOF_WEBGL_VERSION=1
  • makefile filter: empty / OF_WEBGL_VERSION=1 / OF_WEBGL_VERSION=2 resolve to the right -s flags
  • iOS SDK clang++ syntax check of ofxiOSConstants.h usage with no define and -DOF_GLES_VERSION=3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant