I have been attempting to replace all fixed functionality from an OpenGL project I wrote a while ago and have run into a snag which I havn't been able to resolve in the many hours I have spent on it.
After much research I have found it is due to the texture coordinates not being perspective correct. What I have not been able to find is a way to fix this in the shader.
(I have attached a screenshot demonstrating the issue and as you can see, the brick texture is not drawing correctly, creating a seam.)
The line of code in my frag shader which I believe to be causing the issue is as follows.
#version 120 uniform sampler2D tex; varying vec2 pass_tex_coord; ... gl_FragColor = texture2D(tex, pass_tex_coord);
So far I am under the impression that I need to obtain the w value from the pass_tex_coord s and t values.
I am unsure of how to do this because I am simply passing in the uv texture coordinates from my model (VBO). I have also noticed that the model of the cat has the correct texture coord mapping (because the triangles are smaller?)
If anyone could help shed some light on this or offer some example shader code to do this, I would be very greatful!
Best Regards,
Karsten






