Comments (15)
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.
[deleted comment]
from cocos2d-android.
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.
[deleted comment]
from cocos2d-android.
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.
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.
[deleted comment]
from cocos2d-android.
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.
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.
[deleted comment]
from cocos2d-android.
[deleted comment]
from cocos2d-android.
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.
[deleted comment]
from cocos2d-android.
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.
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)
- How to add VideoView or TextView or android native component HOT 2
- Minor Box2d Intergration on demos.
- Cannot found getFixtureList for android cocos2d engine
- Image Pixelation
- How to set the background on CCGLSurfaceView?
- Missing org.cocos2d.R class file in source code repository HOT 1
- Image Banding in the Gradient
- Cocos 2d for android - SurfaceTexture error - lilke breaking layout
- WATCH A GOOD DAY TO DIE HARD ONLINE FREE | DOWNLOAD DIE HARD 5 MOVIE
- WATCH WARM BODIES ONLINE | DOWNLOAD WARM BODIES MOVIE | FREE OFFER
- WATCH ESCAPE FROM PLANET EARTH ONLINE FREE | DOWNLOAD MOVIE | FREE OFFER
- WATCH A GLIMPSE INSIDE THE MIND OF CHARLES SWAN III ONLINE FREE | DOWNLOAD MOVIE A Glimpse Inside the Mind of Charles Swan III
- WATCH SAFE HEAVEN ONLINE | DOWNLOAD SAFE HEAVEN 2013 MOVIE | FREE OFFER
- WATCH BEAUTIFUL CREATURES ONLINE FREE | DOWNLOAD BEAUTIFUL CREATURES MOVIE | FREE NOW
- WATCH SILVER LININGS PLAYBOOK ONLINE FREE | DOWNLOAD MOVIE | HD QUALITY
- particle effects
- particle smallfirework.plist
- crash on android 4.x.x HOT 1
- This doesn't really fall under the game engine category. How do I make a game with it?
- Move project to Github
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cocos2d-android.