In this way I see the shaded blue cube and the black edges drawn perfectly.
The problem arises when I select a cube face. I need to draw in yellow the shaded face and its boundary edge. When I do it and rotate the cube the edge change color unplesantly from black to yellow very frequently.
Is there a way to avoid this? To draw the yellow wire edges slightly closer to the user?
If there is flicker on the edges, it means you are drawing them more than once. A cube has only 12 edges, no need to drawn four edges aroung each face, it would mean 4 * 6 = 24 edges, with flickering.
I know ZbuffeR, the cube is an example, in reality we work with 3D surface based models. Each surface has a fill and an outline and all around overlap with others.
We are following the RedBook Chapter 14 that says to apply glPolygonOffset on filled polygons not on wires. Can we do the opposite and use glPolygonOffset on wires with different factor for selected wires?
I tryed to do what you suggested but using the glPolygonOffset on wires instead of polygons it pushes the polygons in front of wires even with negative factors.
NiCo,
Unfortuately in our Rendering engine we are not allowed to give different projection to different entities.
I am sure that a smarter solution exists.
Think about two overlapping lines: how would you make one always visible over the other?
You are right, I mixed up polygons and wire. So polygon offset is out.
NiCo,
Unfortuately in our Rendering engine we are not allowed to give different projection to different entities.
I am sure that a smarter solution exists.
Too bad, sometimes that is very useful. It is not smart enough for you ?
Think about two overlapping lines: how would you make one always visible over the other?
1)Change projection as said nico
2)disable depth test, or maybe use “or equal” tests, and draw selected wire last. If your vertex coordinates and drawing commands are exactly the same (only color changes), it should work without glitches.
3)use a custom vertex shader to do 1)
If you don’t want to change the projection matrix you can always change the modelview matrix to get the same effect. After all, the actual projection is only defined by projection*modelview…