Comments (7)
I can confirm that 50k characters long text using PFont (that is if you apply for example .setFont(createFont("arial",12)) to a textarea) and the default renderer results in slow scrolling.
Fix:
Changing PFont to the default controlP5 pixel font gives me smooth scrolling (mousewheel and scrollbar) for 400k+ characters. When changing the default renderer to P3D or P2D, both, the pixel font as well as PFont give me smooth scrolling results for 400k+ characters. (I am using a modified version of the ControlP5Textarea example that comes with controlP5 where I append 50k junks of lorem ipsum text read from a file on keyPressed).
from controlp5.
Changing PFont to the default controlP5 pixel font gives me smooth scrolling (mousewheel and scrollbar) for 400k+ characters.
Indeed this works, thanks for the suggestion! However, the default font has a couple of disadvantages:
- It’s tiny.
- It’s not fixed width.
Can it be swapped for another font?
When changing the default renderer to P3D or P2D, both, the pixel font as well as PFont give me smooth scrolling results for 400k+ characters.
Doesn’t work for me, i.e. with fonts set by PFont
scrolling is painfully slow also for P3D
and P2D
. I’m using:
PFont font = createFont("Consolas", 12);
from controlp5.
Can it be swapped for another font?
you can manually set the font with cp5.setFont()
for all controllers.
PFont font = createFont("Consolas", 12);
ControlP5 cp5 = ControlP5(this);
cp5.setFont(font);
Doesn’t work for me
Do you have more details about your os, processing version, controlP5 version. A working example which only highlights the issue you are encountering would be useful.
from controlp5.
since there was no follow up, closing issue.
from controlp5.
Example code:
import controlP5.*;
void setup() {
size(800, 600);
Textarea ta = new ControlP5(this).addTextarea("").setSize(800, 600);
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 1000; j++) {
ta.append(" " + i);
}
ta.append("\n");
}
}
void draw() {
background(0);
}
Here a scroll bar appears, but scrolling does not work at all.
Memory consumption is insane. For one line, I have two Java processes, each using about 100,000 MB. For ten lines, one of the processes uses about 300,000 MB.
Environment: Processing 3.0.1 (same with 3.0.1), Windows 7 x64
from controlp5.
Hi, I dont find the memory behavior surprising, a lot more characters have to be drawn per frame which consequently will consume more memory. For example the following code consumes ~750MB right after running the sketch for rendering text across the window (I am on osx, Processing's maximum available memory is set to 2048MB):
String txt;
void setup() {
size(800,600);
txt = "";
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 1000; j++) {
txt += (" " + i);
}
txt += ("\n");
}
}
void draw() {
background(0);
text(txt,0,0,800,600);
}
your given example starts with consuming 250MB for me and increases when scrolling, though settles at ~770MB after continuously scrolling up and down. This is not an unusual memory management behaviour, if memory is available it will be used. Try to decrease the allocated memory for a sketch inside Processing's preferences and you will see that memory usage will behave differently.
Again, scrolling works well for me in both P3D/P2D and default JAVA mode.
from controlp5.
no follow up, closing issue.
from controlp5.
Related Issues (20)
- SOME WORNG
- How to properly stop ControlP5
- How to extend the Slider
- All my buttons press themselves once on startup HOT 1
- How to change text size HOT 1
- Slider2D: Make cursorWidth height editable
- When using 2 RadioButtons it does not like the fact that addItems are the same
- How to call textbox HOT 1
- mouse-over detection not working for repsonsive window layout
- The function "tab(String)" does not exist HOT 1
- How to run a processing script using controlp5 button
- Library not working correctly in Android Mode HOT 2
- Examples don't work under Android
- Processing ControlP5 Issue - no other term for it
- slider.FLEXIBLE with more than 11 tick marks no longer aligns the pointer with the marks
- I can't use certain functions like ".setColorForeground(color)" , ".setColorCaptionLabel(color)" or ".setRadius(radius)"
- I'm trying to create a custom rounded toggle switch, but the program says the function doesn't exist
- Text doesn't delete itself after sliding.
- Can it handle multitouches
- How to Highlight text in a Textfield?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from controlp5.