Scaling for polygon overlay

Hi

I have a polygon in 3d space and I want to draw an overlay on this polygon,I need to draw an overlay polygon about few pixels bigger than the polygon itself otherwise I won’t see it.Easiest would be to scale it by about 1.2.
But how to calculate the coordinates for the new scaled polygon.
For each vertex if original coordinates were x,y,z what would be new x,y,z??

Well one solution is to find the center of the polygon and then to move each vertex acoording to the direction vector from polygon center.But this is painful - any simpler solutions?

Thanks a lot in advance

That solution is possible but aesthetically probably not ideal because you will see different X/Y deltas depending on where you are relative to the “scaling center”.

Usually what’s done is to just draw on top of the existing shape, either by disabling depth test, or using something like glPolygonOffset to shift the shape slightly closer to the eye while still sending the same vertex positions down the pipe. Then you don’t need to handle the tweaks to make this happen.

Before you draw the overlay, try doing this:

    glEnable( GL_POLYGON_OFFSET_FILL );
    glPolygonOffset( scale,  offset );

Then merely send the overlay down the pipe without any vertex position modifications.

See:

Thanks!!

I forgot about polygon offset…After you reminded me it solved another issue I had.But regards polygon overlay I’m thinking to do decals since seems that offset is not enough