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

WebGL extension properties should not be static #201

Open
CEksal opened this issue Mar 7, 2024 · 0 comments
Open

WebGL extension properties should not be static #201

CEksal opened this issue Mar 7, 2024 · 0 comments
Labels
area-api-bug type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@CEksal
Copy link

CEksal commented Mar 7, 2024

As the title states. Example:

import 'dart:js_interop';
import 'package:web/web.dart' hide WEBGL_compressed_texture_astc;

// Proper type for WEBGL_debug_renderer_info extension
// Note that the getters are not marked as `static`, because there is no global `WebGLDebugRendererInfo` object,
// nor is there one named `WEBGL_debug_renderer_info`.
extension type WebGLDebugRendererInfo._(JSObject _) implements JSObject {
  external int get UNMASKED_RENDERER_WEBGL;
  external int get UNMASKED_VENDOR_WEBGL;
}

void main() {
  final canvas = HTMLCanvasElement();
  final renderingContext = canvas.getContext('webgl')! as WebGLRenderingContext;
  final ext = renderingContext.getExtension('WEBGL_debug_renderer_info') as WebGLDebugRendererInfo?;

  print(ext?.UNMASKED_RENDERER_WEBGL); // prints 37446 (0x9246)
  print(WEBGL_debug_renderer_info.UNMASKED_RENDERER_WEBGL); // throws JavaScript TypeError
}
@kevmoo kevmoo added area-api-bug type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-api-bug type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

2 participants