texParameters lost after resuming application

  • set GL_REPEAT in texParameters for texture
  • minimize application with Home button
  • resume to application
    and looks like parameters “not restored” or breaked

Android or iOS?

Android :slight_smile:

Did you use CCTexture2D::setTexParameters(ccTexParams* texParams)?
The parameter should be ccTexParams*.

ccTexParams tex_params = { GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT };
ground_texture->setTexParameters(&tex_params);

I can suggest that you must store tex parameters somewhere for case of resource lost when you must recreate texture object and call glTexParameteri again, is it?

#913 is created for it.
Could you please paste some pictures to describe what is different after the texParameters lost.

just make a quad with texcoords bigger than 1.0 to see that tex params reseted to GL_CLAMP istead GL_REPEAT

After calling
ccTexParams tex_params = { GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT }; texture->setTexParameters(&tex_params);
i get something like:

after sending app to background and then resume it something like:

Hello, I Have the same issue with cocos2d-1.0.1-x-0.12.0 on Android (HTC Desire 2.2 Cyanogen).

Hi all :),

I’m using 0.13.0-beta, and have also seen this bug on android device.
There is a solution in 2.0 branch (https://github.com/cocos2d/cocos2d-x/pull/1266), and can be adopted for 1.x branch.

At first, patch did not work for me.

Then I have modified:
void VolatileTexture::setTexParameters(CCTexture2D *t, ccTexParams *texParams)

by adding at beginning of method:

if (isReloading) return;

so it would look like this:

void VolatileTexture::setTexParameters(CCTexture2D *t, ccTexParams *texParams) { if (isReloading) return; VolatileTexture *vt = findVolotileTexture(t); if (texParams->minFilter != GL_NONE) vt->m_texParams.minFilter = texParams->minFilter; if (texParams->magFilter != GL_NONE) vt->m_texParams.magFilter = texParams->magFilter; if (texParams->wrapS != GL_NONE) vt->m_texParams.wrapS = texParams->wrapS; if (texParams->wrapT != GL_NONE) vt->m_texParams.wrapT = texParams->wrapT; }

Now seems to be OK. Tested on HTC Desire with Cyanogenmod 7.2.
(Although I’m still seeing couple blank/dark texures after resume, but I’m not sure what is causing that, since they have default texture parameters)