@Qtro wrote:
Hi devs,
I'm having a bit of a deal breaker problem with cocos2dx regarding visual performances.I'm developing in C++ for win32 using fullscreen mode.
I have a ScrollView with a consistent amount of images inside it (20 or so), and when I scroll the images have a really annoying flikering problem.I have made a simple code that I have tested and it reproduces the bug consistently, mine is much more articulated, but the general idea is this:
m_scrollView = ui::ScrollView::create(); m_scrollView->setContentSize(Size(visibleSize.width, visibleSize.height*0.8)); m_scrollView->setAnchorPoint(Vec2(0.5, 0.5)); m_scrollView->setDirection(ScrollView::Direction::HORIZONTAL); m_scrollView->setPosition(Vec2(visibleSize.width*0.5, visibleSize.height*0.5)); this->addChild(m_scrollView, 0); m_mainLayout = Layout::create(); m_scrollView->addChild(m_mainLayout); Size scrollViewContentSize = m_scrollView->getContentSize(); m_subLayout = Layout::create(); m_mainLayout->addChild(m_subLayout, 0); float imgWidth; for (int i = 0; i < 30; i++) { ImageView* img = ImageView::create("HelloWorld.png"); if (i == 0) { imgWidth = img->getContentSize().width; } img->setPositionX(imgWidth * i); m_subLayout->addChild(img, 0); m_topImages.push_back(img); } float totalWidth = imgWidth * (m_topImages.size() - 1); m_subLayout->setPositionX(-totalWidth*0.5); m_scrollView->setInnerContainerSize(Size(totalWidth + imgWidth, visibleSize.height*0.8)); m_mainLayout->setPosition(Vec2(m_scrollView->getInnerContainerSize().width*0.5, m_scrollView->getInnerContainerSize().height*0.5)); m_scrollView->scrollToPercentHorizontal(50.0,0,false);
Keep in mind that the problem appears only in fullscreen mode.
Searching around the forum I've found out about flickering problems being solved specifing the layer when adding children (parent->addChild(child, int)) or disabling depthTest (setDepthTest(false) in AppDelegate) but doing that doesn't solve.
Please help, this is really unbearable!!
Posts: 2
Participants: 2