Hi I have an issue with my fragment shader where it will only draw one pixel of the texture for the entire object, I am using the example from the lwjgl GLSL website.
Here is my fragment shader code and here is the vertex shader code
uniform sampler2D tex;
void main(){
gl_FragColor = texture2D(tex,gl_TexCoord[0].st);
}
attribute vec2 position;
uniform vec2 transform;
uniform float scalar;
void main()
{
vec4 offset = vec4(position.x+transform.x,(position.y+transform.y)/scalar,1,1);
gl_Position = offset;
gl_TexCoord[0] = gl_MultiTexCoord0;
}
and how I bind the texture
texid = GL15.glGenBuffers();
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, texid);
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, texcoord, GL15.GL_STATIC_DRAW);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
t = Texture.loadTexture(texturelocation);
bindtexture();
}
public void bindtexture() {
int loc = GL20.glGetUniformLocation(shader.programID, "tex");
if (loc != -1) {
GL20.glUniform1i(loc, 0);
GL13.glActiveTexture(GL13.GL_TEXTURE0);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, t.id);
}
else{
System.err.println("WARNING: NO VARIABLE DETECTED WITHIN SHADER");
}
}