Skip to content

Sprite line thickness is strange. And then disappear (v3.17) #18873

@seventhrank

Description

@seventhrank

https://discuss.cocos2d-x.org/t/the-thickness-of-the-line-falls-apart/42712

cocos2dx 3.17 (C++)
NDK r16b
Android 6.0 (huawei vns-l22)

I draw lines with Sprite.
After updating to v3.17, the thickness of lines become disjointed with some Android.
It is beautifully lined up in v3.14.1.

Sprite line code.

for (int x = 0; x <= size.width*0.5f; x++) {
	Rect rect_x = Rect( 0.0f, 0, 1.0f, 200.0f);
	Sprite* line_x = Sprite::create();
	line_x->setTextureRect( rect_x );
	line_x->setPosition( x*2 , 400);
	line_x->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT);
	line_x->setOpacity(255);
	this->addChild(line_x);

	Rect rect_x2 = Rect( 0.0f, 0, 1.0f, 200.0f);
	Sprite* line_x2 = Sprite::create();
	line_x2->setTextureRect( rect_x2 );
	line_x2->setPosition( (x*2+1) , 800);
	line_x2->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT);
	line_x2->setOpacity(255);
	this->addChild(line_x2);
}

for (int x = 0; x <= size.height*0.5f; x++) {
	Rect rect_y = Rect( 0.0f, 0, 200.0f, 1.0f);
	Sprite* line_y = Sprite::create();
	line_y->setTextureRect( rect_y );
	line_y->setPosition( 0  , x*2 );
	line_y->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT);
	line_y->setColor(Color3B::WHITE);
	line_y->setOpacity(255);
	this->addChild(line_y);

	Rect rect_y2 = Rect( 0.0f, 0, 200.0f, 1.0f);
	Sprite* line_y2 = Sprite::create();
	line_y2->setTextureRect( rect_y2 );
	line_y2->setPosition( 400  , (x*2+1) );
	line_y2->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT);
	line_y2->setColor(Color3B::WHITE);
	line_y2->setOpacity(255);
	this->addChild(line_y2);
}

3.17

3.14.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions