Projects > cpp > Issues > Bug #3540

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

RenderTextureTest not draw after a background/foreground

Bug #3540 [Closed]
Donmizzi 2013-12-30 00:11 . Updated almost 3 years ago

In case of standby and resume, the first sample of RenderTextureTest doesn’t work on many android device.
I’m not able to draw.
I tested Samsung Galaxy S Plus, Nexus 7, Asus TF300 and Kindle HD 2nd gen

zhangxm 2013-12-30 01:28

What’s the engine version did you test?
Thanks.

Donmizzi 2013-12-30 01:34

I tested 2.1.5, 2.2.1 and 3.0 alpha1

zhangxm 2013-12-30 02:38

Thanks.

waochidevelop 2014-01-24 08:04

"RenderTextureTest" worked when "Cocos2dxRenderer.java" was changed to this.

Example code


public class Cocos2dxRenderer implements GLSurfaceView.Renderer {

...

    private static int resumeflg = -1;

...

    @Override
    public void onSurfaceCreated(final GL10 pGL10, final EGLConfig pEGLConfig) {
        resumeflg = 1;
        Cocos2dxRenderer.nativeInit(this.mScreenWidth, this.mScreenHeight);
        this.mLastTickInNanoSeconds = System.nanoTime();
    }

    @Override
    public void onSurfaceChanged(final GL10 pGL10, final int pWidth, final int pHeight) {
        if(resumeflg==2)
        {
            resumeflg = 1;
            this.onSurfaceCreated(pGL10,null);
        }
    }

...


    public void handleOnPause() {
        resumeflg = 2;
        Cocos2dxRenderer.nativeOnPause();
    }

...
}


zhangxm 2014-01-24 09:18
  • Description updated (diff)
  • Assignee set to zhangbin@cocos2d-x.org
  • Target version set to 3.0-rc0
v2tmobile 2014-02-15 15:47

It's ok with home button but power button doesn't work on my android device (LG LTE2)

waochidevelop 2014-02-17 05:30

Not change the "Cocos2dxRenderer.java".

"RenderTextureTest" worked when "Cocos2dxGLSurfaceView.java" was changed to this.

I remove this comment out.

//super.onPause();

v2tmobile 2014-02-20 14:05

It worked with waochidevelop's solution. Perfect thanks.

zhangbin@cocos2d-x.org 2014-02-21 01:55
  • Status changed from New to Closed
  • % Done changed from 0 to 100

Applied in changeset commit:a6db195279a3e49b512a354c0c67fbe563ef9cac.

zhangbin@cocos2d-x.org 2014-02-21 02:37

@all
The problem has been resolved. You can take a look at this pull request:
https://github.com/cocos2d/cocos2d-x/pull/5401

Atom PDF

Status:Closed
Start date:2013-12-30
Priority:Low
Due date:
Assignee:zhangbin@cocos2d-x.org
% Done:

100%

Category:android
Target version:3.0-rc0

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.