The reason I ask is because my code generates points that travels in a 3d trajectory within and outside of the screen coordinates. (Please note that I’m not using translate()).
Currently, the point() method - that handles the actual drawing to screen - is called regardless of whether the coordinates are within the screen boundaries or not. This had me thinking if my code could be optimized by restricting calling point() only for the points whose coordinates are within the bounds of the screen. Calling point() for coordinates outside of the screen seems superfluous and perhaps even wasteful in terms of processor resources.
Or is this is optimization handled automatically under the hood, so to speak?
You don’t say but I am assuming you are using the default JAVA2D mode and P3D. Both P2D and P3D use OpenGL for rendering graphics. Now OpenGL is a very powerful rendering engine that will handle coordinates outside the display area seamlessly.
The GPU (graphics processing unit) is heavily optimized for handling rendering and will handle coordinates outside the display area much faster than anything we can do to avoid them.