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

[rshapes] Pixel perfect issue #4670

Open
Bigfoot71 opened this issue Jan 9, 2025 · 1 comment
Open

[rshapes] Pixel perfect issue #4670

Bigfoot71 opened this issue Jan 9, 2025 · 1 comment

Comments

@Bigfoot71
Copy link
Contributor

This issue is about the discussions regarding the offset problems when rendering lines, see:

I noticed that the line rlTranslatef(0.375, 0.375, 0) is commented out in BeginDrawing().

AFAIK, this 0.375 offset was used to align coordinates with the centers of pixels, as NVIDIA and ATI had different rounding conventions, this offset worked for both manufacturers.

However, I have doubts about the explanation in the comment stating that this line is no longer needed with OpenGL 3.3+:

//rlTranslatef(0.375, 0.375, 0); // HACK for 2D pixel-perfect drawing on OpenGL 1.1
// NOTE: Not required with OpenGL 3.3+

I suspect that rounding conventions might have been standardized between manufacturers, making the 0.375 offset unnecessary, but I haven't found confirmation on this.

Based on my knowledge, with OpenGL, and here in the case of orthographic 2D projection, integer coordinates still correspond to the corners of the pixels, not their centers, so the offset for pixel-perfect rendering might still be needed.

Do I lack any additional information on this?

@asdqwe
Copy link
Contributor

asdqwe commented Jan 9, 2025

I suspect that rounding conventions might have been standardized between manufacturers, making the 0.375 offset unnecessary, but I haven't found confirmation on this.

@Bigfoot71 I could be wrong, but I think it was standardized by the IEEE 754 (ref). Which, AFAIK, the "big four" — ARM (ref), AMD (ref), Intel (ref) and Nvidia (ref) — follow. However, while (relatively) modern hardware doesn't appear to need it, it could still be necessary for really old hardware and/or old consoles.

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

2 participants