Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
131
rated 0 times [  138] [ 7]  / answers: 1 / hits: 47414  / 12 Years ago, sat, december 8, 2012, 12:00:00

In the learningwebgl tutorial1 I've found an interesting line in the fragment shader.



precision mediump float;


I've found an article about it here, but I still can't understand what does it mean?



And if I remove this line, nothing changes. Everything is the same.
So what does precision mediump float mean?


More From » opengl-es

 Answers
377

This determines how much precision the GPU uses when calculating floats. highp is high precision, and of course more intensive than mediump (medium precision) and lowp (low precision).


Some systems do not support highp at all, which will cause code not to work at all on those systems.


On systems that DO support highp, you will see a performance hit, and should use mediump and lowp wherever possible. A good rule of thumb that I saw was:



  • highp for vertex positions,

  • mediump for texture coordinates,

  • lowp for colors.


[#81530] Friday, December 7, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
karolinab

Total Points: 644
Total Questions: 98
Total Answers: 117

Location: Vanuatu
Member since Mon, Dec 7, 2020
4 Years ago
;