Original Post
Hi, I'm having problems with rendering to textures. I want to render n*n vertices onto an n*n texture, so I want to establish a 1:1 correspondence between vertices and texels. An Ortho projection is being used, so there should be no perspective distortion. The vertices are passed as points of size 1 to where the center of each texel is (an offset of 0.5 opengl space = 0.5/n texture sampling space. So, for a texture of 100 on a side, a vertex (0,0) I would corresponding to (0.005,0.005), which is the center of the texel at (1,1) on the texture). A nice render of size n*n (that fills the whole viewport) is produced, but there is a cross-shaped portion directly in the middle where no vertices were rendered, which is unacceptable. The viewport is sized to n*n, and I've been pulling my hair out (literally) trying to get this working. I can't think of a way to make the points line up exactly with the texels. What should I do? All transformations are done in shaders:If I need to provide more, I'd be happy to do so. Thanks for any help, -Geometrian
//Vertex shader relevant parts
//vertex = gl_Vertex (later "vertex" is used for the transformation)
//size = size of one dimension of the (square) texture
coord = vertex.xy+vec2(0.5/size); //the coordinates with which the texture is sampled later
vertex.xy = vec2(vertex.xy*(size))+vec2(0.5); //the vertices are shifted. I think this line is the problem.