Wireframe GLSL Shader?

Has anyone got any links to a simple implementation of a wire frame shader suitable for OpenGL ES 2.x, or even OpenGL for that matter.

I have some ideas about how to do it, but want to see if I am on the right track in terms of efficiency / logic.

Cheers for any links.

Doh! I seriously could not find anything on Google, or here. I must have been drunk when I was looking as I just found this :

http://www.opengl.org/discussion_boards/…true#Post266563

Sorry for the noise, but is that really the simplest solution?
If there a way to do this mathematically with just the geometry without the extra texture calculations? I am looking for something simpler (perhaps less accurate) for a faster implementation on mobile devices… :slight_smile:

all you really need is glPolygonMode

Yeah… but unfortunately that doesn’t exist on GL ES, which is where I need to implement it. :slight_smile:

old code


glDrawArrays(GL_TRIANGLES, 0, n);

new code


for(int i = 0; i < n; i += 3)
  glDrawArrays(GL_LINE_LOOP, i, 3);

whoops, read your other post. guess great minds think alike. This is likely why turning on wireframe makes vbos so damn choppy on regular opengl. Only other solution is a clever impl. based on lattice shader, but it wouldn’t look very nice or accurate.

As you suggest, drawing repetitive line loops from groups of triangles, or batching the geometry in a different way is an option, but it’s not very efficient. On mobile devices particularly we are trying to avoid small geometry batches.

I am interested in your lattice shader idea… Accuracy is not that important to me… But I am presuming that is something akin to the suggestion I linked to above…

What I’d really like to know from anyone is if there is a quicker / dirtier way to generate the texture coordinate info in the vertex shader with minimal extra data passed in alongside the existing geometry… I am assuming that without indexing / geometry shaders we are always going to have to help the vertex shader know which vertex it is dealing with by sending side data.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.