Vertex displacement breaking mesh
<p>I'm doing some OpenGL stuff in Java (lwjgl) for a project, part of which includes importing 3d models in OBJ format. Everything <em>looks</em> ok, until I try to displace vertices, then the models break up, you can see right through them.
Here is Suzanne from blender, UV mapped with a completely black texture (for visibility's sake). In the frag shader I'm adding some white colour to the fragment depending on the fragments angle between its normal and the world's up vector:</p>

<p><a href="https://i.stack.imgur.com/6MIA1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6MIA1.png" alt="enter image description here"></a></p>

<p>So far so good. But when I apply a small Y component displacement to the same vertices, I expect to see the faces 'stretch' up. Instead this happens:</p>

<p><a href="https://i.stack.imgur.com/bNISj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bNISj.png" alt="enter image description here"></a></p>

<p>Vertex shader:</p>

<pre><code>#version 150

in vec3 position;
in vec2 texCoords;
in vec3 normal;

void main()
{
    vertPosModel = position;                        

    cosTheta = dot(vec3(0.0, 1.0, 0.0), normal);    

    if(cosTheta &gt; 0.0 &amp;&amp; cosTheta &lt; 1.0)     
        vertPosModel += vec3(0.0, 0.15, 0.0); 

    gl_Position = transform * vec4(vertPosModel, 1.0);
}
</code></pre>

<p>Fragment shader:</p>

<pre><code>#version 150

uniform sampler2D objTexture;
in vec2 texcoordOut;
in float cosTheta;
out vec4 fragColor;

void main()
{
    fragColor = vec4(texture(objTexture, texcoordOut.st).rgb, 1.0) + vec4(cosTheta);

}
</code></pre>