View Full Version : rotating faces to face the camera?

01-26-2013, 08:06 AM

I want to draw an antialised wireframe cube, with lines of a certain width (greater than 1). In OpenglES 2, on my devices at least, this isn't supported.

I've had some success drawing 2D antialiased lines, by using the trick of drawing an extra rim of polygons along the edge, with the outermost vertices transparent.

But if I were to do that in 3D, the polygons comprising a line would form a flat ruler shape, and it would change depending on the angle I looked at it. I was thinking I might be able to get it to work by rotating the polygons to face the camera. Has anyone done that? Will it work to achieve what I want?

I think I would start with the 8 cube vertices. Then for each segment in the cube, I would create two more vertices at each endpoint, extending perpendicular to the segment on the plane facing the camera. Does that make sense? Anyone know how to compute those?


01-30-2013, 08:09 AM
Nobody? What do most people do if they want to draw antialiased lines in 3D space?

01-30-2013, 03:23 PM
Use multisampling and let the hardware do it for you.

02-06-2013, 10:56 AM
But if the 'lines' are in 3D, you still have the problem of them becoming invisible when seen edge-on.

02-06-2013, 04:29 PM
Ah - you want wide lines - I have not used this but I think it is what you want
http://sebastien.hillaire.free.fr/demos/simplevolumeline/ (http://sebastien.hillaire.free.fr/demos/simplevolumeline/)


better link


02-07-2013, 10:24 AM
Yes I think that is what I want! Unfortunately OpenGLES2 doesn't do geometry shaders, but that article mentions an earlier technique that does not need them.