Skip to content
This repository was archived by the owner on Aug 31, 2025. It is now read-only.
This repository was archived by the owner on Aug 31, 2025. It is now read-only.

(QOL) Mapping shader as a sampler2D texture buffer not implemented for OnScreenEngine, does work on others #11

@Tremeschin

Description

@Tremeschin

First of all,

  • I have read on the README.md that NOTE: Buffer support is not very well tested, your mileage may vary.

.. however I really need this (sorta).

Context

I'm coding a sorta "video editor" / layers compositor for music visualization and having layers is essential to this task, not only I can separate the elements but apply effects on each and individually.

Issue / reproducing

I tried manually to set up two shaders with almost the same code called layer1.glsl and layer2.glsl:

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = fragCoord.xy / iResolution.xy;
    fragColor = vec4(0.0, 0.0, uv.y, 1);
}

The only difference was that layer2.glsl returns fragColor = vec4(uv.x, 0.0, 0.0, 1); so I could mix the two with some textureLod method and expect a purple at top right corder, black bottom left, red bottom right and blue top left by adding each other's vec4 pixel_color.

However either by defining on the layer2.glsl file the map buffer with:

#pragma map layer1=buffer:/path/to/layer1.glsl;1280x720

Or by giving to the CLI: ./shady -i layer2.glsl -g 1280x720 -map "layer1=buffer:/path/to/layer1.glsl;1280x720"

It just didn't work, outputting the following error:

Error reloading environment: failed to call eglCreateContext, edit: which ended up being a bug on the code where the GL version wasn't being passed properly to the OnScreenEngine render method.

What I tried

See next comments, edited this one for consistency

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions