相关疑难解决方法(0)

在 glsl es 2.0、Gamemaker Studio 2.0 中获取渐变方块的问题

我制作了一个包含 4 个三角形的三角形列表,中间点的颜色不同。然后旨在组合三角形以获得漂亮的渐变。但是三角形的边缘会产生不需要的线条,我不想要这些线条,我希望它一直平滑。我怎样才能得到想要的结果?

图片: 不需要的行

着色器代码:

    // Simple passthrough vertex shader
    //
    attribute vec3 in_Position;                  // (x,y,z)
    attribute vec4 in_Colour;                    // (r,g,b,a)
    attribute vec2 in_TextureCoord;              // (u,v)

    varying vec2 v_texcoord;
    varying vec4 v_colour;

    void main()
    {
        vec4 object_space_pos = vec4( in_Position.x, in_Position.y,         in_Position.z, 1.0);
        gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;

        v_colour = in_Colour;
        v_texcoord = in_TextureCoord;
    }

    //
    // Simple passthrough fragment shader
    //
    varying vec2 v_texcoord;
    varying vec4 v_colour;

    void main()
    {
        gl_FragColor = v_colour;
    }
Run Code Online (Sandbox Code Playgroud)

游戏制作者代码: 创建事件:

    //Build vertices list …
Run Code Online (Sandbox Code Playgroud)

shader opengl-es glsl opengl-es-2.0 game-maker-studio-2

5
推荐指数
1
解决办法
723
查看次数