RFR: 8217472: Add attenuation for PointLight [v5]

Nir Lisker nlisker at openjdk.java.net
Tue Sep 1 10:57:16 UTC 2020

On Fri, 7 Aug 2020 22:37:15 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> Given that we don't have any automated tests for lighting (we have a couple that verify that we can take a snapshot and
>> get the same result, but that isn't testing the lighting itself), probably the most we can expect is a simple test of a
>> large quad with a light fairly close to the object, such that the difference with / without attenuation is noticeable.
>> Then you could sample the center and near the corners of the object for both the attenuated and unattenuated cases.
> The performance tests need a standard GPLv2+classpath copyright header. I haven't tested them yet, but will do that
> next week.

I've written a simple draft for the automated test:

        PointLight light = new PointLight(Color.BLUE);
        var box = new Box(100, 100, 1);
        var root = new Group(light, box);
        var scene = new Scene(root);
        var image = box.snapshot(null, null);
        var nonAttenColor = image.getPixelReader().getColor(1, 1);
        image = box.snapshot(null, null);
        var attenColor = image.getPixelReader().getColor(1, 1);
        assertTrue("Attenuation color should be less than non-attenuated", nonAttenColor.getBlue() > attenColor.getBlue());

However, I'm getting the error:

	at javafx.graphics/test.com.sun.javafx.pgstub.StubToolkit.renderToImage(StubToolkit.java:719)
	at javafx.graphics/javafx.scene.Scene.doSnapshotTile(Scene.java:1383)
	at javafx.graphics/javafx.scene.Scene.doSnapshot(Scene.java:1319)
	at javafx.graphics/javafx.scene.Node.doSnapshot(Node.java:2136)
	at javafx.graphics/javafx.scene.Node.snapshot(Node.java:2214)
Where is the test that takes the snapshot? I am missing something in my setup.


PR: https://git.openjdk.java.net/jfx/pull/43

More information about the openjfx-dev mailing list