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

fix(webgl): Apply default viewport sizes #2116

Merged
merged 5 commits into from
Jun 25, 2024
Merged

Conversation

ibgreen
Copy link
Collaborator

@ibgreen ibgreen commented Jun 24, 2024

Background

  • Viewport was not set by default, causing examples to not fill screen

Change List

  • Apply reasonable defaults to viewports when not supplied.
  • Document behavior

Before
image

After
image

`RenderPassProps.parameters.viewport` controls how the rendered graphics is mapped to window pixels / texels (more precisely, the affine transformation of x and y from normalized device coordinates to window coordinates).

If no value for the `viewport` parameter is provided, the following defaults will be applied.
- If no `framebuffer` is specified, the size of the canvas drawing buffer will be used (`[gl.canvas.drawingBufferWidth, gl.canvas.drawingBufferHeight]`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a WebGPU equivalent?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a WebGPU equivalent?

Very good point, the docs should not be WebGL specific. Will drop.

supported = supported && checkTextureFeature(gl, info.f as DeviceFeature, extensions);
supported = supported && checkTextureFeature(gl, info.f, extensions);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard to tell in the diff, is this related?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, no, must be some some lint/prettier autofix. But if the casts are not needed, then better drop them...

@chrisgervang
Copy link
Contributor

LGTM assuming these values are post-application of device pixel ratio.

@ibgreen ibgreen merged commit ddb6ab0 into master Jun 25, 2024
2 checks passed
@ibgreen ibgreen deleted the ib/fix-default-viewport branch June 25, 2024 19:48
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

Successfully merging this pull request may close these issues.

3 participants