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 WebGL text not rendering when rotated 90 degrees #6316

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/webgl/shaders/font.vert
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ void main() {

// Expand glyph bounding boxes by 1px on each side to give a bit of room
// for antialiasing
vec3 newOrigin = (uModelViewMatrix * vec4(0., 0., 0., 1.)).xyz;
vec3 newDX = (uModelViewMatrix * vec4(1., 0., 0., 1.)).xyz;
vec3 newDY = (uModelViewMatrix * vec4(0., 1., 0., 1.)).xyz;
vec2 pixelScale = vec2(
1. / uModelViewMatrix[0][0],
1. / uModelViewMatrix[1][1]
1. / length(newOrigin - newDX),
1. / length(newOrigin - newDY)
);
vec2 offset = pixelScale * normalize(aTexCoord - vec2(0.5, 0.5)) * vec2(1., -1.);
vec2 textureOffset = offset * (1. / vec2(
Expand Down