kerocode / cocos2d-android

Automatically exported from code.google.com/p/cocos2d-android
Other
0 stars 0 forks source link

White screen after sub intent finish #21

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Start new screen activity from CocosScene
Example:
 Intent myIntent = new Intent(Director.sharedDirector().getActivity(), ReadmeGallery.class);
 Director.sharedDirector().getActivity().startActivity(myIntent);
2. Finish it.

What is the expected output? What do you see instead?
White screen appears instead of cocos scene, but the scene is working(issue 
with drawing only), menu still works and acts on touch

What version of the product are you using? On what operating system?
The issue can be reproduced on some new phones with 2 SDK, it is ok on ADP2

The problem is that i have no such phone( HTC hero ) to reproduce it directly, 
i'v got the issue from angry clients. Maybe there is some way to fix redraw 
issue. Currently starting new Activity is used because i need to use "Gallery" 
widget, which as i know can not be integrated into cocos scene.

Original issue reported on code.google.com by webdev.p...@gmail.com on 14 Aug 2010 at 3:33

GoogleCodeExporter commented 9 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

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
Hi guys!

has somebody got a work around whit this?

Original comment by aries.su...@gmail.com on 23 Feb 2013 at 2:42