开发者

openGL sphere that is both wireframe and solid

I manually drew a sphere, at last :) I want my sphere to be red, but the outlines to be green:

openGL sphere that is both wireframe and solid

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:

openGL sphere that is both wireframe and solid

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜