Skip to content

Attempt to fix MOAIImageTexture reallocated on each new glyph rendered#968

Merged
halfnelson merged 1 commit intomoai:masterfrom
Vavius:fix-moaiimagetexture
Sep 6, 2014
Merged

Attempt to fix MOAIImageTexture reallocated on each new glyph rendered#968
halfnelson merged 1 commit intomoai:masterfrom
Vavius:fix-moaiimagetexture

Conversation

@Vavius
Copy link
Copy Markdown
Contributor

@Vavius Vavius commented Sep 2, 2014

Trying to fix MOAIImageTexture trashing it's glTexId every time a InvalidateAll() is called.

This happens because image texture is using MOAIGfxResource::Load() to force update - after the call it will be in STATE_PRECREATE, so on next render step OnCreate() is called. Problem is, Load() destroys texId and OnCreate() will always follow the CreateTextureFromImage() path instead of just UpdateTextureFromImage().

This fix is an update of MOAIGfxResource to add state switching method without calling OnInvalidate() (which releases texId).

In attached text case you can see how log is spammed with TEXTURE +/- events every time a new glyph is added to dynamic cache.

@halfnelson
Copy link
Copy Markdown
Contributor

Thanks for this

halfnelson added a commit that referenced this pull request Sep 6, 2014
Attempt to fix MOAIImageTexture reallocated on each new glyph rendered
@halfnelson halfnelson merged commit 3dcf831 into moai:master Sep 6, 2014
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

Successfully merging this pull request may close these issues.

2 participants