Hey

I have a set of vertex locations (x,y) in an FBO/texture. I am trying to use a vertex shader which sets gl_Position to a given vertex. It sort of works, the problem is what should be randomly located points end up with a circular pattern

These are the input points:



This is the shader output:



This is the shader code:

Code :
#version 120
#extension GL_ARB_texture_rectangle : enable
 
uniform sampler2DRect partloc;
 
void main(void)
{
    vec2 loc = gl_Vertex.xy;
    vec4 pixpos = texture2DRect(partloc, loc);
    gl_Position = gl_ModelViewProjectionMatrix * pixpos;
    gl_FrontColor = vec4(1.0);
}

Yes I am using GLSL 1.2, the app itself uses openFrameworks and the main bits of code are here: http://pastebin.com/wcUr17xZ. I am rendering to an FBO, and the texture it is reading from also comes from an FBO. I have checked the points themselves are ok by a) keeping a copy of the points and drawing them with:

Code :
            glEnableClientState(GL_VERTEX_ARRAY);
            glVertexPointer(3, GL_FLOAT, 0, pos);
            glDrawArrays(GL_POINTS, 0, numParticles);
            glDisableClientState(GL_VERTEX_ARRAY)

And also by going through the location texture and drawing points at the locations it contains. Both of them give the random pattern, so it seems like something is up with the shader.

I feel like I am missing something, or something is being transformed when it should be, but I have no idea what. I am still relatively new to OpenGL & shaders.

Thanks