Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Texture wrap/filter API issues #1118

Open
tromero opened this issue Dec 24, 2022 · 0 comments
Open

Texture wrap/filter API issues #1118

tromero opened this issue Dec 24, 2022 · 0 comments

Comments

@tromero
Copy link

tromero commented Dec 24, 2022

When a texture is used, such as when drawing a Bitmap, the texture.filter and texture.wrap values on that texture get overwritten by values from the Drawable's smooth and tileWrap properties. This was unexpected and put me in situations where I was assigning texture sampler settings that did nothing, and were instead being overwritten every frame by a prior unrelated Bitmap's draw. This is because the texture was assigned as a secondary texture on a shader used by SpriteBatch, meaning the SpriteBatch's tileWrap setting was only stomping the wrap property of the SpriteBatch's assigned texture, and not the extra texture used by the shader.

This splat happens in RenderContext.hx in beforeDraw.

texture.filter = (currentObj.smooth == null ? defaultSmooth : (currentObj.smooth:Bool)) ? Linear : Nearest;
texture.wrap = currentObj.tileWrap && (currentObj.filter == null || inFilter != null) ? Repeat : Clamp;

I think the existence of these settings on the Drawable is unconventional and unexpected and would prefer to set them once on texture load and never again. The inconsistent naming scheme also bothers me.

Some possible adjustments:

  • eliminating the Drawable's smooth and tileWrap properties, so there is always one clear thing to assign
  • restoring the settings on the texture to what they were before they were squashed, to prevent situations where a Bitmap changes what a later SpriteBatch does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant