Fix gtk4-demo’s gears demo on OpenGL ES
Here is a command to reproduce this testcase: GDK_DEBUG=gl-gles gtk4-demo --run gears Without this patch, Mesa throws this compile error: 0:130(13): error: no matching function for call to `mod(error, float)'; candidates are: This is caused by `u_rotation - 90` being of type error since `u_rotation` is a float and it’s illegal to subtract it with an integer.
This commit is contained in:
@@ -15,8 +15,8 @@ void main() {
|
||||
gl_Position = u_projection * u_modelview * vec4(aPosition, 0.0, 1.0);
|
||||
|
||||
// The -90 is because conics point to the top by default
|
||||
rotation = mod (u_rotation - 90, 360.0);
|
||||
if (rotation < 0)
|
||||
rotation = mod (u_rotation - 90.0, 360.0);
|
||||
if (rotation < 0.0)
|
||||
rotation += 360.0;
|
||||
rotation = PI / 180.0 * rotation;
|
||||
|
||||
@@ -55,7 +55,7 @@ void main() {
|
||||
angle -= rotation;
|
||||
// fract() does the modulo here, so now we have progress
|
||||
// into the current conic
|
||||
float offset = fract (angle / 2 / PI + 2);
|
||||
float offset = fract (angle / 2.0 / PI + 2.0);
|
||||
|
||||
vec4 color = color_stops[0];
|
||||
for (int i = 1; i < u_num_color_stops; i ++) {
|
||||
|
||||
Reference in New Issue
Block a user