Giter VIP home page Giter VIP logo

Comments (15)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 21, 2024
This is an issue with the default GLSurfaceView implementation (which 
CCGLSurfaceView derives from). When an activity pauses, if you call 
GLSurfaceView.onPause, the GL context is lost, along with your textures.

A (potentially slow) workaround is to reload textures in onResume. You can also 
modify GLSurfaceView to not destroy the context on pause. See Replica Island's 
source code for an example.

Original comment by [email protected] on 6 Oct 2010 at 10:52

from cocos2d-android.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 21, 2024
[deleted comment]

from cocos2d-android.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 21, 2024
I'm not sure how you're fixing the problem in that template. Is there some code 
in Director.onPause/onResume? I checked your recent updates on git hub and I 
don't see the changes. 

As for the Replica Island code, they have a custom version of GLSurfaceView 
which fixes the problem. I don't know the details of the fix, but I think there 
are some changes to guardedRun(). 

Original comment by [email protected] on 13 Oct 2010 at 10:26

from cocos2d-android.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 21, 2024
[deleted comment]

from cocos2d-android.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 21, 2024
I think even with the GLSurfaceView changes, you might need to have similar 
code to what you've implemented to reload textures. I used the modified 
GLSurfaceView in my app, and although everything seems to work fine when 
pausing and resuming the activity, I'm still seeing issues when trying to share 
textures between activities, possibly because the surface is being destroyed?

I'd be interested in seeing your changes to Director and CCTextureCache. Are 
you planning on submitting them to github anytime soon?

Original comment by [email protected] on 15 Oct 2010 at 7:56

from cocos2d-android.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 21, 2024
I've been searching around, and it appears that most Android devices don't 
support context sharing, even though it's part of the OpenGL ES 1.0 spec. So in 
theory what the modified GLSurfaceView is doing is correct i.e. holding onto 
one context and passing that in to all eglCreateSurface calls, but it doesn't 
work on most devices. 

I think some sort of hybrid approach would be best, i.e. still not destroying 
the context on pause, but reloading textures when surfaces are lost and created 
(between activities).

Original comment by [email protected] on 15 Oct 2010 at 8:47

from cocos2d-android.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 21, 2024
[deleted comment]

from cocos2d-android.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 21, 2024
tested the github version and it seems to have solved the problem on my galaxy 
S. Thanks zhouweikuan and shashachu. Can I ask why all the differences in 
naming conventions in that version? 


Original comment by [email protected] on 27 Oct 2010 at 2:30

from cocos2d-android.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 21, 2024
No real reason... zhouweikuan is starting an Android port of a newer version of 
Cocos2D for iPhone (.99.4 I think?). Objective-C doesn't have real namespacing, 
so the iPhone code prefixes most classes with CC. Since Java does have 
namespacing, I guess Laurent decided to remove the CC prefix when he started 
his port since it's unnecessary. In theory, we should be merging these two 
versions into one, but that's a pretty monumental task; not sure when it will 
actually happen. (I don't lead either project.)

Original comment by [email protected] on 27 Oct 2010 at 2:34

from cocos2d-android.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 21, 2024
[deleted comment]

from cocos2d-android.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 21, 2024
[deleted comment]

from cocos2d-android.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 21, 2024
It certainly could be. The problem was that some graphics chips can return a 
negative number from glGenTextures, so in Texture2D, the test to reload the 
texture from the Bitmap when name <= 0 meant that we were trying to reload a 
recycled Bitmap. This resulted in generally corrupted textures, so it's 
possible that has fixed issue 10.

Original comment by [email protected] on 5 Nov 2010 at 7:02

from cocos2d-android.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 21, 2024
[deleted comment]

from cocos2d-android.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 21, 2024
Hey guys,
Thanks for the useful discussion.:) I am new to opengl and android programming 
and currently i am stuck with "no context issue". Could you please be specific 
about how you uprooted the problem? I'll be grateful.

Original comment by [email protected] on 10 Jun 2011 at 5:04

from cocos2d-android.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 21, 2024
Hi guys!

has somebody got a work around whit this?

Original comment by [email protected] on 23 Feb 2013 at 2:42

from cocos2d-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.