content icon indicating copy to clipboard operation
content copied to clipboard

WebGL textures tutorial has broken fsSource, correct in github

Open dektar opened this issue 1 year ago • 1 comments

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Using_textures_in_WebGL

What specific section or headline is this issue about?

Fragment Shader code

What information was incorrect, unhelpful, or incomplete?

the fsSource causes errors when running the program Specifically, https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Using_textures_in_WebGL#the_fragment_shader, I get errors about both out vec4 fragColor; and fragColor = texture(uSampler, vTextureCoord);

What did you expect to see?

https://github.com/mdn/dom-examples/blob/main/webgl-examples/tutorial/sample6/webgl-demo.js shows the correct fsSource:

const fsSource = `
  varying highp vec2 vTextureCoord;

  uniform sampler2D uSampler;

  void main(void) {
    gl_FragColor = texture2D(uSampler, vTextureCoord);
  }
`;

Pasting this in instead of what was in the tutorial works

Do you have any supporting links, references, or citations?

https://github.com/mdn/dom-examples/blob/main/webgl-examples/tutorial/sample6/webgl-demo.js

Do you have anything more you want to share?

Thanks for the helpful tutorials!

MDN metadata

Page report details
  • Folder: en-us/web/api/webgl_api/tutorial/using_textures_in_webgl
  • MDN URL: https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Using_textures_in_WebGL
  • GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/api/webgl_api/tutorial/using_textures_in_webgl/index.md
  • Last commit: https://github.com/mdn/content/commit/005cc1fd55aadcdcbd9aabbed7d648a275f8f23a
  • Document last modified: 2024-01-15T21:58:53.000Z

dektar avatar Mar 04 '24 04:03 dektar