We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, Im working on a webdesigner program and in processing the program doesnt have much involved other than a Y tracking ruler mark, a x/y coord box. but for some reason when i add a image the y tracker starts to get some seriously bad lag. Im running on a amd 6-core with 8gb ram and a pretty good amd graphics card... so i dont think my system is the issue. maybe memory management or something? it didnt seem to be eatting up alot of ram or anything.
Answers
some code would help to find the error maybe
https://www.dropbox.com/sh/csb1iiayaoh4ixq/AAA6DmnWTPgINbm0luJfl7sna?dl=0
in edu.mass.necc.processing look at inkWDStartwindow2. if i add a workspace.image() with all the other code required for an image in lines 52-69, everything works but slows down and lags a ton.
okay ill mess with that. should i take everything that stays the same and put it inside the setup()? or should i just incorporate all the elements of the editor itself in a Pgraphics? I know how to
Thankyou!
is it possible that using import processing.core.*; (importing all of processing) could also be causing lag? or that its running within an ide rather than something like a .jar file?
go to loop i know this question is totally different than the topic but taking my current files and making a jar wouldnt cause any issues in processing would it? i tried to create a jar with netbeans, it worked without errors but now when i try to run it nothing happens at all. I know how to run .jars just fine (im using ubuntu).
I just ran the .jar via terminal and i get this
since the PDE uses java i may just move all my code to it. altho i did try compiling in the PDE with a test program and i had issues running on my system
I do wish there were more good processing video tutorials... maybe when I get some experience ill have to make some :). theres just alot to be understood in processing and I can get a little confusing trying to figure stuff out in the examples. I hate asking so many questions. thanks so much GoToLoop and and anyone else who helped me out. everyone has been more than helpful!
http://forum.processing.org/two/discussion/9419/daniel-s-processing-in-eclipse-tutorial-no-longer-works#latest
Okay you convinced me to switch over to PDE for sure. i got it to work. one thing tho... ive done what you advised. still having major lag issues. i think processing is trying to use each pixel specifically when i use a image (if that makes sence). is there any way to flatten or rasterize the image. or make it so processing uses less data in the pic? like it seems like its cant handle when i include a large/multicolored png. I have no idea how to fix this. its a major issue for me because this program will often be using and resizing images. (its a html/css editor)
W/o checking on your most current code it's just blind guesses!
Your Dropbox link still points to your old NetBeans code!
W/o checking on your most current code it's just blind guesses!
Your Dropbox link still points to your old NetBeans code!
okay ill change it for ya in a bit
I feel like processing is doing way to much with the pixels of the image... i just need the image to be displayed and resizable, thats it.
By the looks of it, seems like you didn't quit NetBeans! ;)
But you're still loading resources after setup() has finished: #-o
I havent completely changed the code over to where it needs to be for pde. busy last few days because im building a 3d printer. I will have to load images into the workspace often as this is a tool sorta like photoshop in some ways... is there any way that this can be helped? is there another way to get images into processing i havent found yet?
Things like buttons (that have onPress animations/ mash buttons) wouldn't be put in setup right?
okay so in that case this is fine. the image that you noticed was an example of loading a image into the workspace. the workspace is completely dynamic until save() and exit(). Im looking through everything involved in processing to find a fix with little luck. maybe i should look into some java thread or memory management?
thats a good idea... im not sure what you mean. but the workspace is a specific box-like area inside the program where shapes, images, buttons, text etc and created, edited and then saved to a file. i will have to experiment with the thread management your talking about
requestImage() is to load in another thread right?
can you explain? im a little confused... what this program is doing is as follows: the user can create/manipulate objects within the workspace, as each object is created or changed its attributes are written to a text file and saved periodically. then when upon user request (export button) the text file will be read and based on the contents will be essentially giving commands to the program on what HTML/CSS code to write to .html. does that make sense?
test = loadImage("image.png");
has anything to do w/ your "text" workspace?yes , image.png is being dynamically modified... im gonna mess with threading a bit. 30 fps is all i would need... actually now that i think of it is there a way to limit the max FPS? that would probably help a bit because the system would only have to render at the needed speed
Certainly! Just use frameRate(): https://processing.org/reference/frameRate_.html
But by "whom"? The sketch itself or from another program as I had already asked you from my previous post?
Reiterating, if it's the sketch itself which is saving the PImage to disk, I can't envision why you couldn't access that very same PImage from a variable and instead would prefer to load it from disk again inside draw(), making the whole sketch lose performance awaiting for that constant loading @ 60x per second (60 FPS)?
Now if that happens to come from somewhere else, you're gonna need a separate Thread to deal w/ pre-loading it at a fixed time.
Gonna need 2 variables. 1 to store the current PImage being displayed and another to keep the pre-loaded 1 until it's finally assigned to current 1!
Some boilerplate code for the draw() and the pre-load Thread to deal w/ all that!
I hope you now have a better idea what's need to be done in each case. Good luck! O:-)
the sketch its self... or i should say it will be. at this moment its just displayed. but it needs to be dynamic so that a user could move its position or resize it.
I do, and thanks for all the help. its very appriciated! :).