Can anyone help me understand how to use a displayList inside processing to decrease the total number of buffer flushes/method calls etc so I can get my graphics running at a reasonable speed? (I'm not an OpenGL expert)
I'm in the process of writing a 2d game. For a while I was using P2D for rendering. But, some of my special effects (in particular smoke effects) require writing a LOT of pixels and I really need some hardware acceleration. So, I'm switching to OpenGL.
When I render in OpenGL what I find is that the frame rate is determined almost entirely by the number of images/lines/points drawn and has almost nothing to do with the total number of pixels written. On the other hand P2D speed is determined primarily by the total number of pixels written. The result: in OpenGL I'm getting a pretty consistent 30fps (too slow for my tastes) whereas with P2D I'm getting 100+fps usually, but it plummets to 10-15fps when large portions of the screen have to be repeatedly rewritten (e.g. smoke effects).
What I want is to be able to queue up a LOT of OpenGL calls (basically I need to draw rectangular images and lines and that's about it). Then, I want OpenGL to "go to town" drawing these ALL AT ONCE. I'm convinced that if I can do this correctly, my FPS should jump enormously (probably 200+fps).
I'm working on a project which draws some objects on the screen. I need to generate thumbnails of some of the objects. So, obviously I'd like to use the same code which draws the objects to draw the thumbnails. Can anyone help me figure out how to do this elegantly?
I'm aware that I can draw on a PImage pic by saying something like
But when I want to draw on the screen I just say
Obviously I don't want to duplicate my draw routine if I don't have to. What should I do? Is there a PImage that points to the screen? If so I could always use pic.line(x1,y1,x2,y2); and occasionally allow pic = screen. If not, is there a pointer I can change to control where method calls like line(x1,y1,x2,y2); actually draw?