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 4 of 4

Thread: Overlapping lines

  1. #1
    Advanced Member Frequent Contributor
    Join Date
    Dec 2005
    Location
    Italy
    Posts
    659

    Overlapping lines

    Hi All,

    If you draw two triangles with different color and an edge in common you'll see that edge animation during model rotation because one goes in front of the other randomly.

    Is there any trick to minimize this issue without writing 1000 lines of code?

    Thanks again,

    Alberto

  2. #2
    Junior Member Regular Contributor
    Join Date
    Feb 2005
    Location
    South Tyrol, Italy
    Posts
    107

    Re: Overlapping lines

    It's not exactly clear what you are trying to do! Do you draw the triangles in wireframe?

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,042

    Re: Overlapping lines

    Well, as you certainly know, what you observe is called z-fighting.

    The only way to avoid this altogether, is to not use the z-buffer, at all, and render the triangles in such an order, that you get the desired result.

    That can be achieved, by using a BSP-Tree, though it will take roughly 1000 lines of code.

    In the end, to answer your question: No, there is no way to do it, without some (much) work.

    The problem is, that you render two edges, that are identical (except for their color), so, what do you expect the final result to be?? First you should decide, what you actually want, and only then you can start to think about how to get that result.

    And, you should definitely try to put a bit more effort into your postings, because otherwise people can't really help you (also that's a good way to rethink your problem once again, and sometimes that's enough to find solutions yourself).

    Jan.
    GLIM - Immediate Mode Emulation for GL3

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Dec 2005
    Location
    Italy
    Posts
    659

    Re: Overlapping lines

    Thanks Jan,

    I thought it could exist a solution using blending. Maybe setting alpha at 90% the two lines colors could be blended together and reduce the z-fighting issue.

    Thanks again,

    Alberto

Posting Permissions

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