I am working on an application where graphics symbols like circles and rectangles have to be overlayed over a texture. Sometimes depending on the color of the texture, these graphic symbols are not clearly visible.
We have come up with a scheme to draw black border of 1 pixel width around these symbols(for example, inside and outside of rectangle) to make it stand out, depending on the texture background. How would this black bordering be implemented in OpenGL?
For non filled objects draw black lines with glLineWidth(3.0f) first as mask, and then with glLineWidth(1.0f) with exactly the same line coordinates in your preferred color.
You have to be careful with the depth test. It will always work with disabled depth test though.
For filled objects there are different approaches possible.
E.g. you could draw the object 8 times to fill the surrounding neighbour pixels, etc.
[This message has been edited by Relic (edited 02-22-2001).]
You could also use the stencil buffer to do this. Basically, you would need to do the following:
for (each polygon)
draw edges while setting stencil buffer to 1;
draw polygon where s != 1;
draw edges while setting stencil buffer to 0;
This last step allows you to draw overlapping polygon and still have the outlines drawn correctly. Hope this helps.