Open snibbe opened 1 year ago
Hi @snibbe! So happy and honored seeing you here! Just send you a quick mail, this is one of those cases. GlslViewer geometry loaders mostly know to work with points and triangles at the moment. I usually work with lines them by creating collapsed geometry composed of triangles. The trick require:
a_texcoord
attribute then I extrude it dynamically on the vertex shader.I know a bit convoluted. I will try to bring supporting for them when I have some time.
I'll use the workaround. Thanks for such a quick answer!
If you happen to have an example vertex shader that does this, I would be very grateful if you posted it here. The solution I just tried uses gl_VertexID, but for some reason the glsl version on my Mac in glsViewer is limited to 1.2 and doesn't support gl_VertexID.
I found this example, is slightly different because it encode the direction that the vertex needs to take on the a_normal
vertex attribute.
shader.vert
#ifdef GL_ES
precision mediump float;
#endif
uniform mat4 u_projectionViewMatrix;
uniform float u_radius;
uniform float u_width;
attribute vec4 a_position;
attribute vec4 a_color;
attribute vec3 a_normal;
attribute vec2 a_texcoord;
varying vec4 v_position;
varying vec4 v_color;
varying vec2 v_texcoord;
void main() {
v_texcoord = a_texcoord;
v_position = a_position;
v_color = a_color;
v_position.xyz += a_normal * u_width;
gl_Position = u_projectionViewMatrix * v_position;
}
Hi, I'm just getting started with glslViewer (thanks @patriciogonzalezvivo!). I'm trying to work with an OBJ file consisting only of lines, but the lines won't render using a minimal shader. It looks like it might be an issue with the clipping planes and not computing a bounding box for line objects? But I am not certain. Any advice welcome. Minimal files include inline below. Scott
test.obj:
test.frag: