Open GoogleCodeExporter opened 8 years ago
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 shasha...@gmail.com
on 6 Oct 2010 at 10:52
[deleted comment]
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 shasha...@gmail.com
on 13 Oct 2010 at 10:26
[deleted comment]
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 shasha...@gmail.com
on 15 Oct 2010 at 7:56
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 shasha...@gmail.com
on 15 Oct 2010 at 8:47
[deleted comment]
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 aamus...@gmail.com
on 27 Oct 2010 at 2:30
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 shasha...@gmail.com
on 27 Oct 2010 at 2:34
[deleted comment]
[deleted comment]
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 shasha...@gmail.com
on 5 Nov 2010 at 7:02
[deleted comment]
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 mudassir...@gmail.com
on 10 Jun 2011 at 5:04
Hi guys!
has somebody got a work around whit this?
Original comment by aries.su...@gmail.com
on 23 Feb 2013 at 2:42
Original issue reported on code.google.com by
webdev.p...@gmail.com
on 14 Aug 2010 at 3:33