Home Game Development 3d Line drawing utilizing OpenGL shaders, the best way to repair this damaged instance?

3d Line drawing utilizing OpenGL shaders, the best way to repair this damaged instance?

0
3d Line drawing utilizing OpenGL shaders, the best way to repair this damaged instance?

[ad_1]

Why do not these shaders introduced on this web site work?

I attempted adapting it to a extra ‘current’ model of OpenGL, with the next outcome.

vertex shader

#model 330
in vec4 Vertex;
uniform vec2 uViewPort; //Width and Height of the viewport
uniform mat4 ModelViewProjectionMatrix;
out vec2 vLineHeart;
void major(void)
{
  vec4 pp = ModelViewProjectionMatrix * Vertex;
  gl_Position = pp;
  vec2 vp = uViewPort;
  vLineHeart = 0.5*(pp.xy + vec2(1, 1))*vp;
};

fragment shader

#model 330
uniform float uLineWidth;
uniform vec4 uColor;
uniform float uBlendFactor; //1.5..2.5
in vec2 vLineHeart;
out vec4 LFragment;
void major(void)
{
      vec4 col = uColor;        
      float d = size(vLineHeart-gl_FragCoord.xy);
      float w = uLineWidth;
      if (d>w)
        col.w = 0;
      else
        col.w *= pow(float((w-d)/w), uBlendFactor);
      LFragment = col;
};

And I’m giving it a legitimate MVP matrix.

    glm::mat4 View = glm::lookAt(
            glm::vec3(0,0,2), 
            glm::vec3(0,0,0), 
            glm::vec3(0,1,0)  
            );
    glm::mat4 Model = glm::mat4(1.0f);
    glm::mat4 mvp = Projection * View * Model; 

And the opposite inputs/uniforms are set, too.
I even checked it with ‘renderdoc’.
(viewport is pixel values, proper? 1920x 1080 ?)

But all I get is a strong sq..

I simply need some depth/overlap conforming 3d strains for debugging…
Basically, I would like this spoon fed.

The vertices all have a 1 for the w part, by the way in which.
Does that matter?
The vertex buffer is stuffed accurately, too.

Is this simply outdated? I haven’t got the data/understanding to investigate this.
I’m a brainlet ignoramus on the subject of this type of factor. Please assist.

This appears so good and easy, but when this doesn’t work out then I’ll go for a type of ‘single go’ approaches from the NVIDIA examples and whatnot.

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here