BGL in the uv editor? [solved]

Anyone know what the trick is to drawing GL in a 2D view like the UV Editor? I can draw just fine to a 3D view, but haven’t managed to get anything to draw in the UV Editor. While trying to find a working example of python doing GL in the UV editor I remembered that MagicUVs had a way to visualize overlap, so i poked around in the most recent version and noticed they’re still using fixed function GL… did the UV editor get left out of all the new GL updates? If so, is this going to be in the docs somewhere? All of the references to the fixed function pipeline have been removed from the 2.8 bgl docs (if you search for glBegin for example, you get no results).

Ignore me, tried a simplified test case and it works just fine. For those finding this in a search, the following code works just fine:

import bpy
import gpu
from gpu_extras.batch import batch_for_shader

vertices = (
    (100, 100), (300, 100),
    (100, 200), (300, 200))

indices = (
    (0, 1, 2), (2, 1, 3))

shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR')
batch = batch_for_shader(shader, 'TRIS', {"pos": vertices}, indices=indices)


def draw():
    shader.bind()
    shader.uniform_float("color", (0, 0.5, 0.5, 1.0))
    batch.draw(shader)


bpy.types.SpaceImageEditor.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL')

That poses another question…
Why SpaceImageEditor has a draw_handler_add , but not the SpaceUVEditor?

I would imagine it’s because you can’t have a SpaceUVEditor without also having a SpaceImageEditor, and SpaceImageEditor already supports draw handler callbacks.

The uveditor space is the uv-centric space that exists within an image editor space. I don’t quite get it myself, architecturally a lot of effort has been spent on pretending that UVs aren’t anything special so they should just be duct taped onto something else (looking at you, meshloops)