Change default wrap mode for osg::Texture from GL_CLAMP #1236
AnyOldName3
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The default texture wrapping mode for
osg::TextureisGL_CLAMP.GL_CLAMPwas removed in OpenGL 3 as nearly every time it was used, it was used because someone thought they were gettingGL_CLAMP_TO_EDGE, which is more useful. Also,GL_CLAMPtended not to be implemented with fixed-function hardware once programmable GPUs came along, and was instead shimmed in with a driver-generated shader variant. This meant it was slower, too. For context so everyone's on the same page,GL_CLAMPincludes a half-texel-wide region around the texture where the border colour is blended in, whereasGL_CLAMP_TO_EDGEuses the edge texel colour in this region.A recent discussion between the OpenMW and Zink teams revealed that OpenMW had unintentionally been using
GL_CLAMPquite a lot, leading to stutters as new pipelines needed creating immediately before use. We narrowed this down to textures with no explicit wrap mode set defaulting toGL_CLAMP, and have done some work to ensure we always explicitly set something. As we use a fork of OSG, we're probably going to end up changing the default there to an invalid value, so if we forget in the future we'll get OpenGL errors. The alternative would be to set another valid default, but that would mean we wouldn't get the benefit when packagers elected not to use the fork.I suspect OpenMW won't be the only project to have fallen for this, though. That would mean it might be beneficial for upstream OSG to make a change, too. As the upstream project, it doesn't need to mess around with the invalid default idea, and can pick a better alternative.
GL_CLAMP_TO_EDGEwould be one option, as that's almost certainly going to give the behaviour people who looked and saw it wasGL_CLAMPwere expecting, andGL_REPEATwould be another, as that would match the OpenGL default. This would technically be a breaking change, but I'd expect anyone in the rare situation of actually wantingGL_CLAMPwould be a tiny minority, and likely to be outweighed by a much greater number of users whose applications such a change would improve.Beta Was this translation helpful? Give feedback.
All reactions