View Full Version : Blending BUG -- maybe not a newbie question?

12-10-2003, 12:34 PM
well i am testing out to see if i really understand blending. what i have is a LINE_LOOP that i draw with Vertex2i calls and drawn to the screen. i have another object drawn that i can move about the 3-D world with key commands. heres my question:

my default background color is black. therefore all the pixels within the line looop are still black. i want to be able to move my 2nd object but once it hits this set of black pixels, the pixels of the 2nd object will no longer be drawn. im sure this is a blending problem but trying to figure out how to solve it. i already know how to blend solid objects.

i have successfully done it the other way, to where the 2nd object(solid), when it moves over the line loop you can no longer see the pixels of the line loop that the object is over. help please? thanks!

12-10-2003, 12:40 PM
oh yeah question #2, this would probably solve my blending problem easier..

what i want to do is fill in the pixels within the GL_LINE_LOOP with different colors. the colors will represent different values. how would i go about doing this?

12-11-2003, 03:25 AM
Seems you noticed the a line loop is not filling the interior, it's not a filled primitve, go figure.

There are multiple ways to do that, the quickest is to use glPolygonOffset.
You need to draw the geomtrie inside the line loop as filled primitve first and then the outline on top of that.
If you want that perfectly without depth buffer intersections, don't mix different primitves like line loop and polygon, but use glPolygonMode fill and line and draw the same geometry twice.
Do not switch polygon offset and polygon mode per primitive, but draw all shaded geometry (the inside) first and the lay the outlines on top of that. The depth test will sort it out for you.
Either move the shaded geometry a little backwards (polygon offset units paramater positive), or pull the outline a little to the fron (units negative).

Other methods use the stencil buffer to safe wireframe from overdrawing with shaded inside, but that's slower.