How can i convert gl_Position?

I think i have found a workarround.
I make the perspective divide self and shrink to floats after that
and not before.
E.g.

dvec4 posi = modelviewprojectionmatrix * vertex;
posi.x /= posi.w;
posi.y /= posi.w;
posi.z /= posi.w;
gl_Position = vec4( posi.x, posi.y, posi.z, 1.0 );

Another way to handle this is to convert your corrdinates to a relative origin in the vertex shader. The easy origin to use is the camera.

[QUOTE=Worker;1249570]dvec4 posi = modelviewprojectionmatrix * vertex;
posi.x /= posi.w;
posi.y /= posi.w;
posi.z /= posi.w;
gl_Position = vec4( posi.x, posi.y, posi.z, 1.0 );[/QUOTE]

This will make all varyings behave as if they were declared “noperspective”.

Also note that after viewport transformation the vertex coordinates are usually converted to fixed-point numbers with quite low sub-pixel precision (4 bits seems to be common), so in the end you’ll have only ~16 bits of precision in the rasterizer anyway (if you assume 12 bits for the pixel coordinate). The precision of float is good enough to handle that.