0

Im porting a GLES3 app to desktop, at this point OSX with a OpenGL 3.2 context. My app rely on GL_LINES do draw wireframes for color picking. My problem is that on OpenGL 3.x glLineWidth can only accept line width of 1.0 (I need basically like 10.0).

I already write the code to convert my lines to triangle strips (since I cannot use geometry shaders). What I cannot figure out is how to insure that the line width when viewed up close or from far away is always the same number of pixels and that the triangles always face the camera, just like the way lines used to work in previous OpenGL...

My question is how can I write a vertex/fragment shader to simulate the same behavior that GL_LINES or GL_POINT is using but for my triangles?

McBob
  • 1,011
  • 2
  • 13
  • 25
  • A vertex shader is not the best way to do this, you would get the most flexibility if you used a geometry shader. Nevertheless, I have explained how you can do wireframe rendering without a `GL_LINE` primitive [here](http://stackoverflow.com/questions/18035719/drawing-a-border-on-a-2d-polygon-with-a-fragment-shader/18068177#18068177). – Andon M. Coleman Nov 02 '14 at 19:19
  • Note that in vertex shader, w holds distance from eye, ex for points 'gl_PointSize = gl_PointSize / gl_Position.w;' (used for trees on landscape) – j-p Nov 02 '14 at 23:07

0 Answers0