Hello friends… I am trying to convert texture2DRect to texture2D but it doest not work…
Currently I have a shader that works… it looks like this.
//Fragment shader
#version 120
#extension GL_ARB_texture_rectangle : enable
#extension GL_EXT_gpu_shader4 : enable
uniform sampler2DRect texture0;
void main(){
//Getting coordinates of the current pixel in texture
vec2 pos = gl_TexCoord[0].xy;
vec4 color = texture2DRect(texture0, pos);
gl_FragColor = color;
}
//Vertex Shader
#version 120
#extension GL_ARB_texture_rectangle : enable
#extension GL_EXT_gpu_shader4 : enable
void main() {
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_FrontColor = gl_Color;
}
The above shader code works… but I am trying to convert it like this but ti doest not work.
//Fragment Shader
#version 120
uniform sampler2D texture0;
varying vec2 tex_coords;
void main() {
vec4 color = texture2D(texture0, tex_coords);
gl_FragColor = color;
}
//Vertex Shader
#version 120
attribute vec3 vertices;
attribute vec2 textures;
varying vec2 tex_coords;
void main() {
tex_coords = textures;
gl_Position = vec4(vertices, 1);
}
How to fixed this?