KhronosGroup / KhronosGroup/WebGL
viewport doesn't work as per spec?
- Dominant language
- HTML
- Stars
- 2.9k
- Forks
- 703
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 4
Description
AFAICT the spec requires a point that is at the edge of a viewport to draw outside the viewport.
In other words
1. you have a canvas 300x150.
2. You set the viewport(0, 0, 150, 150); // left half
3. You draw a `gl_PointSize = 64.0` point at clip space (0.99, 0, 0, 1) which is pixel 149, 74
Result should be a 64x64 point around 149,74

What I get instead, the point is clipped.

https://jsfiddle.net/greggman/uxzpdwvc/
I thought the point is not supposed to be clipped. The viewport setting clips vertices, not fragments. Clipping fragments only happens with the scissor test but the scissor test is not on.
The pipeline picture shows the scissor test but what's the point if `gl.viewport` is clipping fragments?

@MarkCallow is this a known issue or am I mis-understanding the spec.
note: I tried on Mac Intel, Mac NVidia, Windows Intel, Windows NVidia, iPhoneX, and they all clipped the point which seems like I'm mis-understanding the spec. Any idea what I'm missing?
Contributor guide
Research direction
Start with the linked jsfiddle and the issue's viewport and gl_PointSize reproduction. Read the relevant WebGL specification sections on viewport behavior, point rasterization, and scissoring, then compare the expected and observed results across the reported environments. Done means establishing whether the behavior violates the spec and documenting the conclusion or the required change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100