Quite a complicated one, I’m trying to render graphics with the CPU pixel by pixel. I would love to use the GPU for such things but lack the know how. Any recommendations?
BufferedImage image = "theGraphics;"
int pixels = new int[width*height];
for(int x = 0; x < width; x++){
for(int y = 0; y < height; y++){
screenPixels[x + y * width] = pixels[x + y * width];
}
}
I’m trying to find another way as I’m discovering that this isn’t very efficient the more I use it :(. I’ve tried many methods of updating the screen, refreshing only sections of the screen that change, creating a pixel array that gets updated with smaller previously generated pixels. It always takes chunks from the fps every time i add something like a menu with buttons. What could i be doing wrong :emo: ? I’ve uploaded it to github if anyone wants a gander? Stealth is just a genre not the name. Thank you!
Shows what I’m trying.
GameWindow.java
ButtonInterface.java