axmol icon indicating copy to clipboard operation
axmol copied to clipboard

Drawnode issue on Android 4.2.x

Open appakabar opened this issue 3 years ago • 9 comments

  • adxe version: 1
  • devices test on: Asus ME173X (Android 4.2.2)
  • developing environments
    • NDK version: r19c
    • Xcode version: 12.4
    • VS/msvctools version: Visual Studio 2019(16.11)/14.29.30133
    • cmake version: 3.23.0-rc1 Steps to Reproduce:
  1. Copy paste this code in HelloWorld
  2. Test under iOS or Mac
  3. See the difference on Android 4.2.x (nothing is drawn)

// testDrawNode
void HelloWorld::testDrawNode()
{
    
    //
    log(" - works on MacOs 11+ but not on Android 4.2.2");
    log(" - should trace some drawings in the scene");
    
    //
    auto size = Director::getInstance()->getVisibleSize();
    auto origin = Director::getInstance()->getVisibleOrigin();
    float scaleFactor = Director::getInstance()->getContentScaleFactor();
    log(" - size: %.0fx%.0fpx", size.width, size.height);
    log(" - scaleFactor: %.2f", scaleFactor);
    
    //
    float pad = 40.0f;
   
    auto pointBL = Vec2(pad, pad);
    auto pointTR = Vec2(size.width-pad, size.height-pad);
    
    auto pointA = Vec2(pad, size.height-2*pad);
    auto pointB = Vec2(2*pad, size.height-2*pad);
    auto pointC = Vec2(2*pad, size.height-pad);
    auto pointD = Vec2(pad, size.height-pad);
    
    auto draw = DrawNode::create();
    draw->setContentSize(size);
    draw->setPosition(origin);
    
    // draw a rectangle
    draw->drawSolidRect(pointBL, pointTR, Color4F(1.0f,1.0f,1.0f,0.20f));
    
    // draw a rectangle
    draw->drawSolidRect(pointA, pointC, Color4F(1.0f,1.0f,1.0f,1.0f));
    
    // drawQuadBezier
    draw->drawQuadBezier(pointA, pointB, pointC, 10, Color4F(1.0f,1.0f,1.0f,1.0f));
    
    // draw polygons
    Vec2 points[] = { pointA, pointB, pointC, pointD };
    draw->drawPolygon(points, sizeof(points)/sizeof(points[0]), Color4F(1.0f,0.3f,0.0f,1.0f), 4, Color4F(0.0f,1.0f,1.0f,0.3f));

    // draw segment
    draw->drawSegment(pointA, pointC, 10, Color4F(0.0f, 1.0f, 0.0f, 1.0f));
    
    addChild(draw, 50);
}

appakabar avatar Mar 22 '22 13:03 appakabar

I have no android 4.2.2 device, does the virtual device also have this issue?

halx99 avatar Mar 22 '22 13:03 halx99

No, the emulator is working fine under Jelly Bean 4.2 API 17. Note that is also working on Cocos v3.17.2 on physical devices.

appakabar avatar Mar 22 '22 14:03 appakabar

Does other android physical devices with different Android version have the issue, It is difficult to diag the problem reason, because I have no Android 4.2.2 physical device. And does there have any avaiable logcat for this issue?

halx99 avatar Mar 23 '22 02:03 halx99

I think everything under SDK 17 - include - is having the issue. Min SDK is already 17 in adxe, if I test under SDK 15, I also have the issue. Nothing relevant in logcat. Can't test SDK 18. SDK 19 is fine.

appakabar avatar Mar 23 '22 07:03 appakabar

Note: under cocos v3 last version, I'm able to have Min SDK 14 without any known issue.

appakabar avatar Mar 23 '22 07:03 appakabar

I tried out of pure free time on my old galaxy note 3 (which I didn't update and it's still on 4.2.2) And yes it has the issue surprisingly! It also happens with the godot engine when drawing lines except that they stutter (some frames they show and sometimes they don't, sometimes they show artifacts) I'm starting to suspect that it's an OpenGL ES issue Kinda weird that godot has the same issue lol

DelinWorks avatar Mar 23 '22 10:03 DelinWorks

It's very rare that anyone still uses these devices cuz they're OLD AS TIME

DelinWorks avatar Mar 23 '22 11:03 DelinWorks

Yes, the min sdk have maybe to be raised up. Anyway, I've notified this DrawNode issue, I will notify some others.

appakabar avatar Mar 23 '22 21:03 appakabar

I will notify one here as it also concern the same versions of Android:

ScrollView issue on Android SDK 17-

  • adxe version: 1
  • devices test on: Asus ME173X (Android 4.2.2)
  • developing environments
  • NDK version: r19c
  • Xcode version: 12.4
  • VS/msvctools version: Visual Studio 2019(16.11)/14.29.30133
  • cmake version: 3.23.0-rc1

Steps to Reproduce:

  1. Copy paste this code in HelloWorld
  2. Test under iOS or Mac or Android > SDK 19
  3. See the difference on Android 4.2.x (nothing is drawn)

    //
    float pad = 20.0f;
    //
    auto origin = Director::getInstance()->getVisibleOrigin();
    //
    auto size = Director::getInstance()->getVisibleSize();
    auto sizeScroll = Size(size.width*0.33f, size.height-2*pad);
    auto sizeVeryHigh = Size(size.width*0.33f, size.height*4.0f);
    
    // Create the scrollview by vertical
    //ui::ScrollView* scrollView = ui::ScrollView::create();
    ScrollView* scrollView = ScrollView::create();
    scrollView->setContentSize(sizeScroll);
    scrollView->setInnerContainerSize(sizeVeryHigh);
    scrollView->setScrollBarWidth(4);
    scrollView->setScrollBarPositionFromCorner(Vec2(2, 2));
    scrollView->setScrollBarColor(Color3B::WHITE);
    scrollView->setGlobalZOrder(200);
    addChild(scrollView, 10);
    
    //
    scrollView->setPosition(Vec2(size.width*0.66f - pad, pad) + origin);
    
    //
    LayerColor *layerColor = LayerColor::create(Color4B(155, 255, 255, 255));
    layerColor->setContentSize(sizeVeryHigh);
    layerColor->setPosition(sizeVeryHigh/2.0f);
    scrollView->addChild(layerColor, 10);
    
    for (int i=0; i<12; i++) {
        Sprite* sprite = Sprite::create("HelloWorld.png");
        sprite->setPosition(Vec2(sprite->getContentSize().width/2, sizeVeryHigh.height - (i+0.7f) * sprite->getContentSize().height));
        scrollView->addChild(sprite, 2);
    }

appakabar avatar Mar 23 '22 21:03 appakabar

Yes, the min sdk have maybe to be raised up. Anyway, I've notified this DrawNode issue, I will notify some others.

@appakabar Have you the same behavior using cocos2d-x 4.0?

@appakabar Another question:

Can you see any other stuff if you put it on the center of the screen?

aismann avatar Sep 12 '22 12:09 aismann

@aismann

Have you the same behavior using cocos2d-x 4.0?

Yes.

Can you see any other stuff if you put it on the center of the screen?

If you mean a DrawNode, no those are not drawn at all. For the ScrollView issue I think my test is already in the center of the screen.

appakabar avatar Sep 16 '22 13:09 appakabar

So nothing is drawing? Do you think this is really a axys/cocos2dx 4.0 issue? I think your device is too old.

aismann avatar Sep 16 '22 16:09 aismann

So nothing is drawing? -> for the Drawnode, yes nothing is drawn. Pretty sure that the other issue (Scrollview) is related.

Do you think this is really a axys/cocos2dx 4.0 issue? -> yes, 100% sure. Related to the changes on the renderer engine I think.

I think your device is too old. -> yes, those are (I've 2 or 3 like that), it's something like 1 or 2% of Android users I think. So not a big issue at all. But If the issue is not fixed, the min SDK have to be raised for a better engine quality.

Bigger issue I have with axys/cocos2dx 4.0 is the fact that third libs are not precompiled for Mac OS Silicon/Mx chip series... Do you think I should open a ticket about this or some guy is already working on it? (I've already work a bit on it but I'm not good a that).. Thank you!

appakabar avatar Sep 17 '22 10:09 appakabar

Bigger issue I have with axys/cocos2dx 4.0 is the fact that third libs are not precompiled for Mac OS Silicon/Mx chip series... Do you think I should open a ticket about this or some guy is already working on it?

-> Thats the sense of an issue. Write one and hope it will answered or better send the fix with a PR from you.

aismann avatar Sep 17 '22 11:09 aismann

The Apple M1 already supported, see also: https://github.com/axys1/axys/issues/803

halx99 avatar Sep 17 '22 15:09 halx99

Do you think this is really a axys/cocos2dx 4.0 issue? -> yes, 100% sure. Related to the changes on the renderer engine I think.

@appakabar Use cocos2dx 3.1x for this device plz. Can we close this issue?

aismann avatar Sep 19 '22 09:09 aismann

Use cocos2dx 3.1x for this device plz.

ok noted

Can we close this issue?

Yes for sure. Thank you for all.

appakabar avatar Sep 19 '22 10:09 appakabar

@halx99 plz close

aismann avatar Sep 19 '22 11:09 aismann