ScrollView limitations?

Hey,

I’m currently trying to display a larger text inside the ui::ScrollView, but it seems like it doesn’t display anything if it’s size is too large.

I’ve just quickly took a look into the implementation but couldn’t find any limitations.
Not sure if the scroller works with some kind of Framebuffer where the limitation is the texture size supported of the gpu? But its still trange because some devices where I’m kind of sure have 4k limit in texture size can display it.

Has anyone any idea what the issue could be?

How exactly are you trying to display the text in the ui::ScrollView? If you paste the snippet of code that you’re using then someone here may be able to test it out.

Just adding a Label to it.
> > auto text_ = Label::create();
> > auto scrollView_ = ui::ScrollView::create();
> > addChild(scrollView_);
> > scrollView_->addChild(text_);
> > text_->setString(LONGTEXT); //add text here
> > scrollView_->setInnerContainerSize(Size(0, text_->getContentSize().height));
> > scrollView_->setContentSize(Size(1140, 760));

it looks something like this.
The text is over 5000px in height for the text content size

I’ve tried to set the innercontainer size to something much smaller but didn’t help.

Maybe I’m still using the scroller incorrectly idk, but everything seems to work find once I reduce the text content size.

(my code highlighting seems to be messed up somehow)

Just a wild guess, but perhaps it’s based on what the GPU can handle in terms of maximum texture size, since, for instance, mobile devices can handle a maximum of 2048x2048 (or 4096x4096 for some newer devices).

When you create a label that ends up generating a texture of 5000px, then you have gone over the maximum texture size that the GPU can handle, which would indicate that it is not a problem with the ui::ScrollView. You could easily test for this by changing the font size to go a bit under and a bit over 4096 (or 2048), and see what happens when you do so in each case.

I would suggest to split the text into smaller parts and then add them to scrollview. In this way invisible parts can be hidden (not rendered). It will work on any device and will be much faster.

I think @R101 and @kds have the right idea here. A lot of devices are around a max of 4096 texture size.

@slackmoehrle @kds @R101

Oh, right, I was concerned about the the ScrollViews texturesize, totally forgot it could be the Label itself.
Seems like the qualcomm gpus can handle really big texture sizes.

btw does anyone know statistics about devices and their texture sizes for Android API 16+.
Are there still a lot of devices that only support 2048x2048? or is it fine nowadays to go with 4096, I totally lost track about this

I don’t know for Android devices because there are many vendors, but here is a reference for ios devices just in case.

yeah for ios its easy, I’ve just seen one statistic from 2017 somewhere, where it says the % for devices that only support 2048 or lower is extremely low. I remember back in 2015 the rule was definitely to not go over 2048.