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

Invalid scissor when rendering to fbo #88

Open
vorg opened this issue Oct 12, 2020 · 0 comments
Open

Invalid scissor when rendering to fbo #88

vorg opened this issue Oct 12, 2020 · 0 comments

Comments

@vorg
Copy link
Member

vorg commented Oct 12, 2020

A correct viewport will be set if not provided but rendering to a texture but scissor is not.
https://github.com/pex-gl/pex-context/blob/master/index.js#L533

if (!cmd.viewport && cmd.pass && cmd.pass.opts.color) {
        let tex = null
        if (cmd.pass.opts.color[0]) {
          tex = cmd.pass.opts.color[0].texture || cmd.pass.opts.color[0]
        }
        if (cmd.pass.opts.depth) {
          tex = cmd.pass.opts.depth.texture || cmd.pass.opts.depth
        }
        if (tex) {
          newCmd.viewport = [0, 0, tex.width, tex.height]
        }
      }

Other things to test:

Scissor and viewport stacking in subcommands

Should we apply parent scissor if child command overwrote it and we finished rendering?
https://github.com/pex-gl/pex-context/blob/master/index.js#L1019

if (cmd.scissor !== state.scissor) {
          state.scissor = cmd.scissor
          gl.disable(gl.SCISSOR_TEST)
        }

Same for viewport
https://github.com/pex-gl/pex-context/blob/master/index.js#L1029

if (cmd.viewport) {
        if (cmd.viewport !== state.viewport) {
          state.viewport = cmd.viewport
          gl.viewport(
            state.viewport[0],
            state.viewport[1],
            state.viewport[2],
            state.viewport[3]
          )
        }
      }
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

1 participant