Why does OpenGL use float rather than double?
opengl
Solution
In the past, many OpenGL functions did have a `double` variant. `glMultMatrix` for example has `f` and `d` variations. Most of these don't exist anymore, but that has nothing to do with `float` vs. `double`. `glMultMatrixd` and `glMultMatrixf` are gone in core GL 3.1 and above.
In core OpenGL, there are still functions that have `double` variants. `glDepthRange` takes `double`, though there is a `float` version (introduced mainly for GL ES compatibility). There are some functions that don't have `double` variants, like `glBlendColor`.
Sometimes, OpenGL is just being inconsistent. Other times, it is simply following a reasonable principle: not lying to the user.
Take `glBlendColor`. If you could pass it double-precision values, that would imply that floating-point blending took place with double-precision accuracy. Since it most certainly does not (on any hardware that exists), providing an API that offers that accuracy is a tacit lie to the user. You're taking high-precision values to a low-precision operation. Though the same logic is true of `glDepthRange` (no double-precision depth buffers are not available), yet it takes `doubles`. So again, inconsistency.
The `glUniform*` suite of functions is a much better example. They set state into the current program object. Until GL 4.0, the `double` versions did not exist. Why? Because that would have been a lie. GLSL pre-4.0 did not allow you to declare a `double`, for the simple and obvious reason that no pre-4.0 hardware could implement it. There's no point in allowing the user to create a `double` if the hardware couldn't handle it.
Problem
I am wondering why OpenGL makes use of float rather than double in its functions. Double should be much more accurate than float.