Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to checkCompilation #181

Open
orangebowlerhat opened this issue Jan 31, 2021 · 0 comments
Open

Change to checkCompilation #181

orangebowlerhat opened this issue Jan 31, 2021 · 0 comments

Comments

@orangebowlerhat
Copy link

orangebowlerhat commented Jan 31, 2021

The current output is busy and makes it hard to find the errors as the shader gets bigger. I modified a local version of pico with this -

checkCompilation() {
   if (!this.gl.getShaderParameter(this.shader, GL.COMPILE_STATUS)) {
     let log = this.gl.getShaderInfoLog(this.shader);
     let source = this.gl.getShaderSource(this.shader);
     let lines = source.split('\n');
     let errors = log.split('\n');
     let line = -1;
     errors.forEach (function (error) {
       let token = error.split(':');
       if (token.length > 3) {
         if (token[2] != line) {
           line = token[2];
           console.log(lines[line - 1]);
         }

         console.error(error);
       }
     });
   }
   return this;
 }

Which produces a more focused output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant