I manually drew a sphere, at last :) I want my sphere to be red, but the outlines to be green:
In order to achieve this I did the following. I drew a solid sphere in red, and then I drew the same sphere, but wireframe and green. When I turned DEPTH_TEST on, I got some weird behavior, like this:And in order to avoid this weird behavior I just drew the wired sphere scaled by (1.001, 1.001, 1.001)
and everything is drawn perfectly, as in the first picture. My question is, am I, a real newbie, doing it in a bad way? Are there any better ways to do what I want to do? Thanks in advance.
P.S. I am drawing the sphere manually for an exercise's sake, 开发者_JS百科I am aware of the existence of glu quadrics routines and glut's sphere.
You're not doing something awfully bad, but if you need to offset geometry to avoid Z-fighting you might want to have a look at glPolygonOffset.
精彩评论