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

Consider making all gl calls plain proxies w/o additional functionality #8

Open
lesnitsky opened this issue Mar 22, 2021 · 1 comment

Comments

@lesnitsky
Copy link
Contributor

example:

void compileShader(Shader shader, [bool checkForErrors = true]) {
    gl.glCompileShader(shader.shaderId);

    if (checkForErrors) {
      final compiled = tempInt32s[0];
      gl.glGetShaderiv(shader.shaderId, GL_COMPILE_STATUS, compiled);
      if (compiled.value == 0) {
        final infoLen = tempInt32s[1];

        gl.glGetShaderiv(shader.shaderId, GL_INFO_LOG_LENGTH, infoLen);

        String message = '';
        if (infoLen.value > 1) {
          final infoLog = calloc<Int8>(infoLen.value);

          gl.glGetShaderInfoLog(shader.shaderId, infoLen.value, nullptr, infoLog);
          message = "\nError compiling shader:\n${infoLog.cast<Utf8>().toDartString()}";

          calloc.free(infoLog);
        }
        throw OpenGLException(message, 0);
      }
    }
  }

gl.compileShader on the web doesn't have anything related to errors, so this would be a misalignment with browser's WebGL.
My suggestions is to make sure gl api is exactly the same as it is on the web

@escamoteur
Copy link
Contributor

I agree, we can keep the current method and rename it compileShaderPlus

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

2 participants