I am doing a fluid simulation and need texture lookup from a vertex shader. So i need to compute the fragment coordinate of a point in a vertex shader. I am doing this (modelview is identity) :
Which works great with ATI card (HD 5870) but failed on NVIDIA card (GTX 580), drivers are up to date.Code :gl_Position = gl_ProjectionMatrix * vec4(VertexPosition, 1.0); Position = (gl_Position.xy / gl_Position.w) * 0.5 + 0.5; ... vec4 color = texture(mySampler, Position);
The shaders are compiled, but there is a precision error with the nvidia card. In order to debug, in the fragment shader i compare my computed fragment position with the real one and when some points have some specific coordinates my computed fragment position is one pixel away from the real one.
Anyone knows the real computation done by the graphics card ?
I just want to do the same ^^