R
Roscoe.Zhao
Guest
Hi,
I'm trying to make a shader where I need to get some RGB values from a texture input from a surface (actually it's an output of another shader)
I tried something like this:
I tried this and expected it will draw the 'texture surface', but it gives a black screen.
I tried to draw the texture surface using draw_surface_stretched() it's normal, not empty.
Maybe I need to somehow calculate a new texture coordinate for that texture surface?
I know I could use the uvs values and v_vTexcoord to calculate the corresponding texcoords if I'm drawing a sprite, but I don't know how to deal with surfaces.
I can't find a function similar to sprite_get_uvs() for surfaces
Any help would be appreciated
I'm trying to make a shader where I need to get some RGB values from a texture input from a surface (actually it's an output of another shader)
I tried something like this:
Code:
varying vec4 v_vColour;
varying vec2 v_vTexcoord;
uniform sampler2D Texture;
// The 'texture surface'
// This is from another shader's output, like this: texture_set_stage(uTexture,surface_get_texture(sTexture));
void main() {
gl_FragColor = texture2D(Texture, v_vTexcoord);
}
I tried to draw the texture surface using draw_surface_stretched() it's normal, not empty.
Maybe I need to somehow calculate a new texture coordinate for that texture surface?
I know I could use the uvs values and v_vTexcoord to calculate the corresponding texcoords if I'm drawing a sprite, but I don't know how to deal with surfaces.
I can't find a function similar to sprite_get_uvs() for surfaces
Any help would be appreciated