• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!

Texture2DLod doesn't work in vertex shader?

mbeytekin

Member
I can't get any colors from texture2dLod in vertex shader?
How we use texture2dLod function in GameMaker?
My example code like that in vertex shader;

attribute vec3 in_Position;
varying vec2 fragCoord;
varying vec4 Colour;
uniform vec3 iResolution;
uniform sampler2D tfm;
void main()
{
vec4 Position = vec4( in_Position, 1);
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * Position;
fragCoord = in_Position.xy;



vec2 uv = fragCoord.xy/iResolution.xy;

sum = texture2DLod(tfm,uv,1.).rgb;
Colour=vec4(sum.rgb,1.);
}
 

sp202

Member
You can't use the texture functions in the vertex shader in GM, not sure you can use texture2DLod in the fragment shader either.
 

mbeytekin

Member
Thank you for your answers. I know there are some mipmapping functions in GM2 But main problem in shaders in fragment shader we can not use texture2D(gm_BaseTexture) in loops with variables. (for a=0 ; a<width for example) Because GM doesn't compile it . texture2dLod isn't working in fragment shader either. I guess this feature is a must in future versions.
 
Top