Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 7 of 7

Thread: Showing polygons that are perpendicular to camera (orthographic view)

  1. #1
    Newbie Newbie
    Join Date
    Dec 2015
    Posts
    5

    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

  2. #2
    Junior Member Newbie
    Join Date
    Nov 2011
    Posts
    3
    Quote Originally Posted by audi02 View Post
    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
    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.

  3. #3
    Newbie Newbie
    Join Date
    Dec 2015
    Posts
    5
    Quote Originally Posted by haikarainen View Post
    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.

    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)..

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,730
    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.

  5. #5
    Newbie Newbie
    Join Date
    Dec 2015
    Posts
    5
    Quote Originally Posted by GClements View Post
    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.

  6. #6
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,730
    Quote Originally Posted by audi02 View Post
    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.

  7. #7
    Newbie Newbie
    Join Date
    Dec 2015
    Posts
    5
    Quote Originally Posted by GClements View Post
    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.
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •