I need to render some lines “roads” with perspective correction.
I was doing this with glLineWidthx and glDrawElements, but with this I get now perspective correction on the line, same line width at start cap and at end cap.
So I though I could use triangle strips or triangles to render the road. Let’s say I define a rectangle in the world, this way I get my perspective correction done by OpenGLES.
I 'm doing something like this:
vertice = x1 - half_line_world_width; vertice = y1;
vertice = x1 + half_line_world_width; vertice = y1;
vertice = x2 + half_line_world_width; vertice = y2;
vertice = x2 - half_line_world_width; vertice = y2;
using vertices indices ( 1,2,0,3 ) then,
I call glDrawElements.
It’s works fine for 80% of the roads, but some of them doesn’t have the correct width.
Could someone help me doing this or another approach ?
I also want to do this with texture mapping using a pre-computed antialiased texture mapped on the triangle strip to reach antialiased rendering.
Thanks in advance,