Hi there,
My first question so please dismiss any silly mistakes with my wording. I am developing a knock off of Photoshop, suitably named ‘Fotoshop’, as a part of my 2nd year university graphics coursework. I am doing fine at the moment developing all the features but I came across a alarming fact, when running the program and displaying an image it appears, according to task manager, that the program is using around 15% of my GPU on load - just to clarify, I have a 3060ti so I assume Processing using 15-20 percent of that GPU to display an image is not right.
My image displaying code is simple as can be in order to minimise it but I cant seem to avoid it. The best I can think of is to make a variable boolean to keep track of when there needs to be a change to the image (like a greyscale function for example) and then update only when it needs to be updated in order to avoid draw the image every single frame even though nothing has changed.
Heres the code;
void draw(){
println((int) frameRate, "frames per second");
background(bgColour[0], bgColour[1], bgColour[2]);
// ===== DRAWING IMAGE (EITHER LOADED OR LIVE DEPENDING ON WHETHER showOriginalImage IS TRUE OR NOT) =====
showCorrectImage();
myUI.update();
}
You can ignore the FPS readings and the myUI stuff, we are using a SimpleUI library made by my lecturer.
Oh and heres the showCorrectImage() code…
void showCorrectImage() {
if (loadedImage != null && showLoadedImage == true) {
showLoadedImage();
}
else if (loadedImage != null && showLoadedImage == false) {
showLiveImage();
}
}
Anddd then finally both the showLoadedImage() and showLiveImage() code…
void showLiveImage() {
if (liveImage != null) {
image(liveImage, windowWidth/2 - liveImage.width/2, windowHeight/2 - liveImage.height/2);
}
}
void showLoadedImage() {
if (loadedImage != null) {
image(loadedImage, windowWidth/2 - loadedImage.width/2, windowHeight/2 - loadedImage.height/2);
}
}