Hello, I am new here so bear with me
I have some questions which I’d like to get answered. They are all about JComponent.getGraphics() (Graphics.XXX()) function calls. I am making a 3d engine so I’d like the most efficient solutions.
- How does Java handle drawing outside of a component’s boundaries? I’d like to know this so I can decide if it’s more efficient to write a clipping function to remove the data outside the boundaries or just let Java draw outside the boundaries. There are three scenarios as far as I can see:
*) Java clips automatically and skips the drawing instruction - thus rendering the need of a separate clipping function in the XY-plane unnecessary. I find this most probable.
*) Java tries to draw outside the boundaries with the same speed as drawing inside the boundaries.
*) Java tries to draw outside the boundaries with an impact on speed, thus validating the use of a separate clipping function.
**** EDIT ****
After some testing, I found out JComponents are almost certainly clipped by Java. That’s good news…
-
How does Java fill shapes; does it use some sort of scan conversion algorithm or a flood filling algorithm?
If the later is correct; how fast is it? Would a custom made filling function for filling shapes speed up things? -
How does Java double buffer JComponents? Is it acceptable to use the built in double buffering or should you make an own function for it?
Any more things I should take into account? I have got a wireframe 3d engine to work, and am in the process of adding support for solid shapes.
**** EDIT ****
It now supports solid shapes and lightning
Sincerely,
Tommi Kiviniemi from Luleå, Sweden