Skip to content

Commit

Permalink
Merge pull request #6316 from davepagurek/fix/rotated-text
Browse files Browse the repository at this point in the history
Fix WebGL text not rendering when rotated 90 degrees
  • Loading branch information
aferriss committed Aug 2, 2023
2 parents e0678fb + 6c99e8a commit b664e86
Showing 1 changed file with 5 additions and 2 deletions.
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

0 comments on commit b664e86

Please sign in to comment.