This is based on the question: Best way to detect NaN's in OpenGL shaders
Standard GLSL defines isnan() and isinf() functions for detection. OpenGL ES 2.0 shading language doesn't. How can I deal with NaNs and Infs nevertheless?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- CALayer - backgroundColor flipped?
- Listening to outgoing sms not working android
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Same problem for WebGL. Answer of Nicol Bolas works good for most GPUs but does not for some nVidias. This version works good for all GPUs I had an opportunity to try:
You can check for NaN via a condition that will only be true for NaN:
isinf
is a bit more difficult. There is no mechanism to convert the float into its integer representation and play with the bits. So you'll have to compare it against a suitably large number.Untested, so not sure this will work (due to optimizations), but it should work, both for Inf and -Inf.