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

WebGLRenderer: Change scissor, viewport functions to use "round" instead of "floor" #27703

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified examples/screenshots/webgl_effects_peppersghost.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ class WebGLRenderer {

}

state.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor() );
state.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).round() );
Copy link
Collaborator

Choose a reason for hiding this comment

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

In at least six other instances in the code, floor() is still used when applying pixelRatio. Was this an oversight, or was this intentional?

/ping @Mugen87
/ping @gkjohnson

Copy link
Collaborator

@Mugen87 Mugen87 May 25, 2024

Choose a reason for hiding this comment

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

To me that is an oversight. When looking at the code, the usage in setRenderTarget() should be updated to round() as well.

_currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor();
_currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor();

Not sure about getDrawingBufferSize() though.

return target.set( _width * _pixelRatio, _height * _pixelRatio ).floor();

Depending on how we decide, the code in examples/jsm/renderers/common/Renderer.js should be updated accordingly.


};

Expand All @@ -511,7 +511,7 @@ class WebGLRenderer {

}

state.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor() );
state.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).round() );

};

Expand Down