Skip to content

Passthrough Shader in example breaks IMDraw #305

@coreyog

Description

@coreyog

I added shaders to my game recently and to ease in the new feature I decided to use your passthrough shader from the tutorial here. After adding it, I noticed anything being drawn by an IMDraw was black instead of the color it was supposed to be. Sprites and the Canvas clear color all show up as normal, but my IMDraw borders around buttons and simplistic progress bar appear as black.

Two causes come to mind.

  1. There is no "texture" for IMDraw things for the shader to reference.
  2. I'm drawing everything to a canvas, and then drawing the canvas to the window.

Number 1 makes a lot of sense if you look at the source, but I don't think I know enough about shaders yet to know what to do instead. Number 2 is something I read can enable a lot of advanced things but I'm still wrapping my head around the details so I admit this might be a side effect of that.

I don't think this is a bug in pixel, just in my understanding. How should I write my shaders to work with IMDraw?

Mac Big Sur x64
Pixel v0.10
Go 1.17.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions