how to make GL_CLAMP_TO_EDGE look like GL_CLAMP_TO_BORDER before gles32?
Thanks!
ps. why openGL es NOT support GL_CLAMP_TO_BORDER before es3.2?
You’d have to implement texture sampling yourself in the fragment shader.
Because ES≤3.1 hardware isn’t required to support it. OpenGL is an API, not an implementation. The hardware is the implementation, OpenGL just provides a standardised interface to it.
Also: if the hardware supports most of 3.2 but not texture borders, the vendor might decide to implement them in software, in which case GL_CLAMP_TO_BORDER
is likely to be significantly slower than GL_CLAMP_TO_EDGE
(i.e. comparable performance to implementing it yourself in the fragment shader).
draw a fullscreen rect by the shader in which to change the clamped-border-color Outside the texture region?
just curious about it, it seems very usefull and not hard to implement, but why it’s not supported before GLES 3.2?
I meant: basically replace texture()
with your own function which implements the desired functionality using textureLod()
or even texelFetch()
.
I’d assume that it’s because most ES3 hardware didn’t have any support for texture borders. OpenGL generally doesn’t provide a feature if that feature will always be implemented in software (either on the CPU or GPU). There’s only a benefit to including it in the API if at least one implementation provides hardware support (so an API function will be faster than anything the user can implement). Well, that and legacy functionality which is retained for compatibility; but that doesn’t apply to ES (which hasn’t really been around long enough to accrue legacy functionality).
Note that desktop OpenGL has supported texture borders since 1.0, so it isn’t a new idea.