Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Using same image w newImageSheet() breaks texture wrap
Started by davebollinger Oct 14 2015 11:15 AM

No replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

davebollinger

[GLOBAL: userInfoPane.html]
davebollinger
  • Corona Geek

  • 1,309 posts
  • Enterprise

To reproduce, take the existing "PatternFill" sample as is, and insert the following line right after display.setStatusBar (at about line #28)

local waterSheet = graphics.newImageSheet("water-fill.png",{width=128,height=128,numFrames=4})

Then run the sample and note that the texture wraps specified around lines 58-59 no longer have any effect, and the water-fill is instead clampToEdge'd.

 

My suspicion is that it has to do with the internal texture caching, and the version of the texture created for the ImageSheet took the defaults at the time (clampToEdge) and the later version simply reuses that existing cached texture. The only way around it that I've discovered so far is to create a copy of the image (with a different filename) in order to "fool" the texture cache.

 

(aside: granted, this is a manufactured usage, but there are cases where you might want to pull a sprite out of the interior of a sheet that is also usable for tiling as a wrapped texture.  personally, i'd rather that wrapping were specified per fill rather than constantly setting/resetting display.setDefaults, then the texture cache might be able to act more "intelligently" in such scenarios.  but that design decision is already established and would be a breaking change, so instead, at the very least, if this is intentionally unsupported rather than a bug, i'd be nice to document that this unexpected interplay between image sheets and same-image-used-as-fill-with-wrap exists.)

 



[topic_controls]
[/topic_controls]