Showing polygons that are perpendicular to camera (orthographic view)

Hi all,
If a face is perpendicular to the camera (lets say in orthographic view), its thickness is zero and therefor the rasterizer doesn’t draw any pixel for it.

What I would like to have, is that a line of one pixel width will be drown against such polygon. This line should also have the relevant colors -means that if there is a texture for this polygon, the appropriate colors of the texture appear on this line.

How can this achieved ?

Thanks

[QUOTE=audi02;1280477]Hi all,
If a face is perpendicular to the camera (lets say in orthographic view), its thickness is zero and therefor the rasterizer doesn’t draw any pixel for it.

What I would like to have, is that a line of one pixel width will be drown against such polygon. This line should also have the relevant colors -means that if there is a texture for this polygon, the appropriate colors of the texture appear on this line.

How can this achieved ?

Thanks[/QUOTE]

Render lines instead (or in combination with triangles if you want both possibilities). I’d imagine textures would work pretty much the same way (point to texture coordinates in your VAO with glVertexAttribPointer and sample the texture using those UVs in the shader program).

Might be a better solution to this, I’ve never had the need to render stuff like this before so I wouldnt know.

[QUOTE=haikarainen;1280478]Render lines instead (or in combination with triangles if you want both possibilities). I’d imagine textures would work pretty much the same way (point to texture coordinates in your VAO with glVertexAttribPointer and sample the texture using those UVs in the shader program).

Might be a better solution to this, I’ve never had the need to render stuff like this before so I wouldnt know.[/QUOTE]

Thanks, this is a method I tried, and it is good only when the polygons are not clipped.

If a polygon is clipped (say there is a clip plan that cut it), then its front lines are not exist, and its back lines are covered by the polygon it share edges with, so they won’t always be seen.

I tried to load an image to show this, but the system says that it is not valid image (jpg of size of 250x250)…

In theory, another option is to enable anti-aliasing (GL_POLYGON_SMOOTH) but without any blending. Unfortunately, it’s common for that option to be silently ignored.

I’m not familiar with the GL_POLYGON_SMOOTH as I understand there are side effects of using it (slowing, depth issues , cracks where triangles are joined ) so I use multisample buffer for antialiasing.

I’m not suggesting using it for anti-aliasing.

The point about GL_POLYGON_SMOOTH is that (when it actually works), it renders each fragment which intersects the polygon, regardless of whether the fragment’s centre is inside the polygon. The generated alpha value varies according to the (estimated) proportion of the fragment which is inside the polygon. But the alpha value doesn’t matter unless you actually enable blending or alpha tests.

[QUOTE=GClements;1280483]I’m not suggesting using it for anti-aliasing.

The point about GL_POLYGON_SMOOTH is that (when it actually works), it renders each fragment which intersects the polygon, regardless of whether the fragment’s centre is inside the polygon. The generated alpha value varies according to the (estimated) proportion of the fragment which is inside the polygon. But the alpha value doesn’t matter unless you actually enable blending or alpha tests.[/QUOTE]

Thanks.

After re-thinking, the method of drawing lines won’t help for clipping case (as I mention in the older message) as even if we can see the back line… it will present the texture colors that exist at the back line. not the colors exist in the part cut by the clipping plan.