graphicsdriver/opengl: Bug fix: Rename the attribute variables along with custom shaders

This commit is contained in:
Hajime Hoshi 2020-07-20 04:06:35 +09:00
parent c8fa937a0a
commit 29d53edf1d
2 changed files with 9 additions and 9 deletions

View File

@ -109,15 +109,15 @@ func fragmentShaderStr(useColorM bool, filter driver.Filter, address driver.Addr
const ( const (
shaderStrVertex = ` shaderStrVertex = `
uniform vec2 viewport_size; uniform vec2 viewport_size;
attribute vec2 vertex; attribute vec2 A0;
attribute vec2 tex; attribute vec2 A1;
attribute vec4 color_scale; attribute vec4 A2;
varying vec2 varying_tex; varying vec2 varying_tex;
varying vec4 varying_color_scale; varying vec4 varying_color_scale;
void main(void) { void main(void) {
varying_tex = tex; varying_tex = A1;
varying_color_scale = color_scale; varying_color_scale = A2;
mat4 projection_matrix = mat4( mat4 projection_matrix = mat4(
vec4(2.0 / viewport_size.x, 0, 0, 0), vec4(2.0 / viewport_size.x, 0, 0, 0),
@ -125,7 +125,7 @@ void main(void) {
vec4(0, 0, 1, 0), vec4(0, 0, 1, 0),
vec4(-1, -1, 0, 1) vec4(-1, -1, 0, 1)
); );
gl_Position = projection_matrix * vec4(vertex, 0, 1); gl_Position = projection_matrix * vec4(A0, 0, 1);
} }
` `
shaderStrFragment = ` shaderStrFragment = `

View File

@ -90,15 +90,15 @@ var theArrayBufferLayout = arrayBufferLayout{
// Note that GL_MAX_VERTEX_ATTRIBS is at least 16. // Note that GL_MAX_VERTEX_ATTRIBS is at least 16.
parts: []arrayBufferLayoutPart{ parts: []arrayBufferLayoutPart{
{ {
name: "vertex", name: "A0",
num: 2, num: 2,
}, },
{ {
name: "tex", name: "A1",
num: 2, num: 2,
}, },
{ {
name: "color_scale", name: "A2",
num: 4, num: 4,
}, },
}, },