1

I'm developing a game using LibGDX. In one screen of my game I simply draw some circles. For that I'm using the Circle java class from this GitHub repository in order to make the circle anti-aliased.

https://github.com/Dych/Smooth-circle/blob/master/core/src/gdx/example/Circle.java

It's working just fine on the desktop and on the Android emulator, but when I try to run it on my Android phone (Nexus 5), it just crashes and shows the following message:

com.badlogic.gdx.utils.GdxRuntimeException: --From Vertex Shader:
                                                                    Error: Symbol u_projTrans defined with different precision in vertex and fragment shaders.
                                                                    --From Fragment Shader:
                                                                    Error: Symbol u_projTrans defined with different precision in vertex and fragment shaders.

Could you help me with it? Thank you.

Ernestina Juan
  • 957
  • 1
  • 9
  • 24

1 Answers1

1

Your fragment shader use a #def to define a precision, if your devise use GL_ES or not.

But the same #def doesn't exist in your vertex shader, so the precision may not be the same between your vertex shader and your fragment shader (that's explain your error).

Just add in your vertex shader to fix the issue.

#ifdef GL_ES
precision mediump float;
#endif
dwursteisen
  • 11,435
  • 2
  • 39
  • 36
  • Assuming u_projTrans is some sort of projective transform, I'd say the better fix might be to define it as highp in both the vertex and fragment shader, rather than as mediump, because mediump is often not high enough precision for working on vertex positions. Bear in mind it might look fine on most devices, but produce artifacts on GPUs that use half-precision floats when mediump is defined. – Columbo Aug 08 '17 at 21:33