Coder Social home page Coder Social logo

Comments (4)

snibbe avatar snibbe commented on June 18, 2024 1

I'll use the workaround. Thanks for such a quick answer!

from glslviewer.

patriciogonzalezvivo avatar patriciogonzalezvivo commented on June 18, 2024 1

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;
}

from glslviewer.

patriciogonzalezvivo avatar patriciogonzalezvivo commented on June 18, 2024

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:

  • creating a spline (a line constructed of triangles). where each pair of vertices at each side of the spline is send to the same position.
  • using the 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.

from glslviewer.

snibbe avatar snibbe commented on June 18, 2024

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.

from glslviewer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.