ZhouWeikuan / cocos2d

cocos2d for android, based on cocos2d-android-0.82, and now ported from cocos2d-iphone 0.99.4. The googlecode address is here: http://code.google.com/p/cocos2d-android-1/ . There are several demos to watch.
610 stars 291 forks source link

Black Screen on Asus TF700 and NEXUS10 #65

Open Trurl101 opened 11 years ago

Trurl101 commented 11 years ago

Several users reported problems with my Apps on a Asus TF700. Update: AND Nexus10

The game starts, but the screen is black. But it seems the game is running. If they touch the black screen, where normally the start button would be, they see the replaceScene animation, but only on one half of the screen, the other half is black, after the replaceScene is finished the screen goes fully black again.

I don't have a TF700 to investigate this error and Asus refused my mail request to lend me a test device for a few days.

Has anyone an idea whats wrong with this device?

Trurl101 commented 11 years ago

This black screen problem seems to appear on every android device with high resolutions, like nexus10. Perhaps some parameters of cocos2d could be adjusted to work with such high resolutions?

Trurl101 commented 11 years ago

It seems that the screen only goes black if you start the app in portrait mode CCDirector.sharedDirector().setLandscape(false);, landscape mode works fine. This is true for my app (which is always in portrait mode) but also the cocos2d-test scripts. At the moment i don't know how to fix this. Anyone has an idea?

tianzc commented 11 years ago

this prolbem is appera in htc butterfly when set Landscape(false), show black but is works however,set Landscape(true),works fine

ZhouWeikuan commented 11 years ago

you should set orientation in androidManifest.xml but not in the code.

2013/1/16 tianzc notifications@github.com

this prolbem is appera in htc butterfly when set Landscape(false), show black but is works however,set Landscape(true),works fine

— Reply to this email directly or view it on GitHubhttps://github.com/ZhouWeikuan/cocos2d/issues/65#issuecomment-12301127.

tianzc commented 11 years ago

i tried,but doesn't work screen always show black

Trurl101 commented 11 years ago
    app.metric = 1;
    CGSize s = CCDirector.sharedDirector().winSize();
    if (s.height > 1280) {
        app.metric = s.height / 1280;
        s.height = s.height / app.metric;
        s.width = s.width / app.metric;
        CCDirector.sharedDirector().setScreenSize((int) s.width, (int) s.height);
    }

This works for me. But I don't know exactly why :)

It seems that cocos2d fails if the screen resolution is to high. But if I set the screen size manually with this function it works and I can use the whole device resolution anyway. The "setScreenSize" only seems to fix some internal things in cocos2d so that it works in all resolutions.

At the moment I don't have the time to dig deeper in this problem.

tianzc commented 11 years ago

According to what you said,it doesn't work however, i modify class CCDirector like:

change

   public static final int kCCDirectorProjectionDefault = kCCDirectorProjection3D;

to public static final int kCCDirectorProjectionDefault = kCCDirectorProjection2D;

problem is resolve,but i don't know why? Is it does not support3D?

ZhouWeikuan commented 11 years ago

It might be because texture max size is 1024 for height and width? You can adjust it higher and try again.

2013/1/16 tianzc notifications@github.com

According to what you said,it doesn't work however, i modify class CCDirector like:

change

public static final int kCCDirectorProjectionDefault = kCCDirectorProjection3D;

to public static final int kCCDirectorProjectionDefault = kCCDirectorProjection2D;

problem is resolve,but i don't know why? Is it does not support3D?

— Reply to this email directly or view it on GitHubhttps://github.com/ZhouWeikuan/cocos2d/issues/65#issuecomment-12319445.

tianzc commented 11 years ago

it doesn't works,too

pareshrathod commented 10 years ago

Solution to above mentioned problem is: In CCDirector's setProjection Method - Change gluPerspective to 2000 instead of 1500 New Line will be like this - GLU.gluPerspective(gl, 60, size.width/size.height, 0.5f, 2000.0f);

It works!