Pergunta

I am trying to draw a very simple, black and white stick figure whose head is a sphere. The background is black and I am drawing with white color. The orthographic projection of the sphere head should be a white circle with line width of 3 pixels. Everything behind the head should be hidden (DEPTH_TEST enabled). I would like to avoid using glut but glu is OK.

What is the simplest way to achive this?

Foi útil?

Solução

Not using a sphere. A sphere will be composed of several triangles, and if drawn using a line mode you'll end up with a wireframe sphere. Silouhette Shaders are overkill here. The simplemost solution is drawing a line circle, that's oriented towards the camera (=origin), i.e. a billboard effect.

Outras dicas

If you really want to use a sphere and orthographic projection I recommend looking at gluSphere. An alternative would be gluDisk (which already is 2D).

However, for pure 2D graphics (as it sounds) I recommend that you think about using point-sprites for the circles: One Quad with the circle as texture

http://nehe.gamedev.net/data/articles/article.asp?article=19

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top