openGL sphere that is both wireframe and solid
Asked Answered
C

1

7

I manually drew a sphere, at last :) I want my sphere to be red, but the outlines to be green:
alt text
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:alt text

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, I am aware of the existence of glu quadrics routines and glut's sphere.

Ceraceous answered 11/11, 2010 at 15:16 Comment(0)
A
6

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.

Ambulant answered 11/11, 2010 at 15:21 Comment(3)
OK :) Will you kindly tell me how I can do it better?Ceraceous
Check out those slides from K. Akeley, it's very well explained: www-graphics.stanford.edu/courses/cs248-07/lectures/…Ambulant
oh, you added the not word :)Ceraceous

© 2022 - 2024 — McMap. All rights reserved.