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 incorrect scissor box in h2d.Scene.captureBitmap #1248

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pkhead
Copy link

@pkhead pkhead commented Dec 3, 2024

Currently, there is an issue with the OpenGL driver when using h2d.Scene.captureBitmap. When it sets the scissor bounds to the viewport bounds, GlDriver.curTexture incorrectly refers to the current texture rather than the texture being rendered into, causing the scissor box to potentially use an incorrect position. I will note that the DirectX driver has no problem here because it doesn't need to alter the scissor box if it's rendering to a texture, which the OpenGL driver needs to do.

I have fixed this by simply reordering some function calls in h2d.Scene.captureBitmap to ensure the correct framebuffer will be set when setRenderZone is called.

@ncannasse
Copy link
Member

Maybe this should be fixed at the driver level @TothBenoit ;)

@pkhead
Copy link
Author

pkhead commented Dec 4, 2024

imho I don't think its a driver issue, really. just in the captureBitmap function, setRenderZone was called when a framebuffer change hadn't yet been flushed to the driver. plus, OpenGL framebuffers are upside-down, whereas it seems DirectX framebuffers arent, so it is necessary to track the current framebuffer to see if the scissor box should be flipped; I also did the same thing when I wrote an OpenGL renderer for a project. But, I obviously am not the person who wrote all of this code, so I may be wrong.

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.

2 participants