beeware / beeware/toga

Add an OpenGL API-Agnostic OpenGL Widget

Open
#4,273 9 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
5.4k
Forks
827
Avg merge
15h 39m
Merged PRs (30d)
40

Description

### What is the problem or limitation you are having?

OpenGL is a widely-used and reasonably common standard known and understood by a large number of developers, even though it is not the easiest API to learn. There should be a widget that allows a user to perform OpenGL drawing using whatever OpenGL API they prefer or is available on their platform.

### Describe the solution you'd like

The solution would be widgets on each platform that set up an OpenGL view which call back to user functions for initialisation and rendering code. What the user does in these call-back is *completely* up to them: the widget makes no assumptions about the library which is being uses to interface with OpenGL, permitting the user to choose between libraries like PyOpenGL or ModernGL, to use the native OpenGL interface for their platform if there is one, or potentially to call out to wrapped OpenGL code written in C or C++.

### Describe alternatives you've considered

A similar widget, but where Toga has an OpenGL compatibility layer which provides a common OpenGL interface that works cross platform, choosing a particular "best" OpenGL API for each platform which is wrapped by the compatibility layer.

Or possibly something more structured. For example, rather than arbitrary rendering callbacks on the interface widget, the user supplies shader programs, buffer data, etc. which are then used in a pre-defined, standard rendering pipeline defined completely in the interface layer.

### Additional context

This isn't necessarily the end-state: as discussed in #51, it probably makes sense to have more smaller, more user-friendly GL API similar to WebGL, which is built on top of this widget.

Tests for this API are probably going to be fairly simple (eg. do the callbacks get called when we expect, etc.) since actual drawing is not the widget's responsibility.

Contributor guide

Open the contributing guide

Research direction

No files, tests, or implementation entry points are named. Read the discussion in #51 first, then trace how Toga’s platform widgets expose views and where widget callback tests would belong; done means a cross-platform OpenGL view invokes initialization and rendering callbacks, with tests covering when those callbacks run.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.