Shader, Drawing lines between vertexes?

Is it possible to draw lines between vertexes in a shader, or do you always have to create triangles for everything that will be drawn.

I guess the answer is that you have to create triangles, and you need a geometry shader otherwise. But thought I should ask if I misunderstood something. It is hard to know the limits of shaders sometimes.

And if you need to create rectangles for lines between points in 3D, I guess you need to rotate the vertexes so that the rectangles are aligned to the screen.

I was thinking about this and the idea of a “wireframe” shader for meshes.

I was thinking, in the fragment shader I could somehow determine where the point was on a triangle edge vs within the surface and then alpha 0 or alpha 1.0 as appropriate to get a nice transparent wireframe.

Now this also assumes that the shader isn’t automatically optimising for occluded faces etc…

People have used discard in the shader to create this, but it should be quite slow according to apple. Otherwise you have to draw the triangles in correct depth order, or? Still lot to learn. :slight_smile:

My experiments with see-through surface grids have made use of discard.

I used discard with a “wireframe” texture here:
http://twolivesleft.com/Codea/Talk/discussion/2203/3d-sin-in-a-shader#Item_7