openframeworks / openframeworks/openFrameworks

[Desktop / GLFW] Features proposal : untethered context creation and OpenGL Compatibility Profile.

Open
#6,795 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

Hello everyone,

For a project I needed to access the last features of libVLC 4.0 that runs its instance on a separated thread with a shared OpenGL context.

Two issues arised :

  1. libVLC requiered an OpenGL Compatibility Profile where OpenFrameworks is bound to Core Profile¹.
  2. Window creation links² the window to the windowApp map and make its context current on the main thread every frame³, breaking the context when used simultaneously in another thread.

References :

Proposed implementations :

The workarounds are simple and supposedly break-free.

For the first case, we can add a boolean flag in ofGLFWWindowSettings to use GLFW_OPENGL_COMPAT_PROFILE
instead of GLFW_OPENGL_CORE_PROFILE.

For the second case, we can either create an ofCreateContext function or add a boolean in settings (eg. useCustomThread) that pass ofMainloop.cpp#L68.

Here is an example that set off every graphics presenting capabilities, unasked for in a windowless context :

shared_ptr<ofAppBaseWindow> ofCreateContext(const ofWindowSettings & _settings) {
  ofGLFWWindowSettings settings(_settings);
  settings.doubleBuffering = false;
  settings.visible = false;
  settings.setSize(1, 1);

  shared_ptr<ofAppGLFWWindow> context = std::make_shared<ofAppGLFWWindow>();
  
  context->setup(settings);
  context->setVerticalSync(false);

  return context;
}

Any thoughts on this ?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with libs/openFrameworks/app/ofAppGLFWWindow.cpp for the referenced OpenGL profile setup and libs/openFrameworks/app/ofMainLoop.cpp for window registration and context-current behavior. Compare the proposed settings flag and context-creation alternatives; done means compatibility-profile selection and an untethered, windowless shared context are supported without the main loop reclaiming the context.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.