Skip to content

vertexNormals are not getting set #202

Open
@0x177

Description

i have a vertex shader that passes the normal of the vertex to the fragment shader. i can confirm that whatever fragNormal is set do does get passed to the fragment shader. the problem is that all the normals are 0,0,0. here are the relevant parts of code:

drawing geometry:

let mut d2 = d2.begin_shader_mode(&shader);

d2.draw_plane(
    Vector3::new(0.0, 0.0, 0.0),
    Vector2::new(32.0, 32.0),
    Color::LIGHTGRAY,
);

d2.draw_cube(Vector3::zero(),2.0,4.0,2.0,Color::WHITE);

vertex shader:

#version 330

in vec3 vertexNormal;

uniform mat4 matNormal;

out vec3 fragNormal;

void main()
{
    fragNormal = normalize(vec3(matNormal*vec4(vertexNormal, 1.0)));
}

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions