Drawing two overlapping lines in different colors

  • Follow


OK, to start thanks for the suggestions to get selecting and my lasso
working. I currently can lasso select points and polygons in my OpenGL
widget, whoopee!

What I do is change the color that the GL_LINE_LOOP is drawn to create the
"is selected" effect. This leads to an annoying issue. If two loops are
drawn sharing a line, one selected and one normal, it seems to be a
crap-shoot what color is shown.

Is there a technique I am missing to get the full loop to draw on top?

Thanks,

Steve
0
Reply Steven 3/19/2007 8:25:19 PM

Steven Green wrote:

> OK, to start thanks for the suggestions to get selecting and my lasso
> working. I currently can lasso select points and polygons in my OpenGL
> widget, whoopee!
> 
> What I do is change the color that the GL_LINE_LOOP is drawn to create the
> "is selected" effect. This leads to an annoying issue. If two loops are
> drawn sharing a line, one selected and one normal, it seems to be a
> crap-shoot what color is shown.

It's called z fighting.

> Is there a technique I am missing to get the full loop to draw on top?

Use glPolygonOffset to draw it slightly closer than the other one.

0
Reply Rolf 3/20/2007 8:18:09 AM


On Tue, 20 Mar 2007 09:18:09 +0100, Rolf Magnus wrote:

> Steven Green wrote:
> 
>> OK, to start thanks for the suggestions to get selecting and my lasso
>> working. I currently can lasso select points and polygons in my OpenGL
>> widget, whoopee!
>> 
>> What I do is change the color that the GL_LINE_LOOP is drawn to create the
>> "is selected" effect. This leads to an annoying issue. If two loops are
>> drawn sharing a line, one selected and one normal, it seems to be a
>> crap-shoot what color is shown.
> 
> It's called z fighting.
> 
>> Is there a technique I am missing to get the full loop to draw on top?
> 
> Use glPolygonOffset to draw it slightly closer than the other one.

Thanks for the info, I think this will be helpful when I get to a 3D edit
window I want to implement.

While at work last night I pondered this issue for quite some time and
decided on a different scheme. What I intend to do for the top, front and
side views is to project the polygons onto the x/y plane the give all the
selected polygons a closer z than the unselected polygons. Now the trick
will be keeping this concept straight while I try to turn it to code; I
keep confusing myself. :-)
0
Reply Steven 3/20/2007 11:16:36 AM

2 Replies
484 Views

(page loaded in 0.06 seconds)

Similiar Articles:













7/29/2012 7:35:13 AM


Reply: