Custom shaders for JavaFX

Joe Andresen joseph.andresen at
Fri Jun 21 10:06:10 PDT 2013

It's great to see this being requested.

There are a few things that need to be considered when providing the ability to do custom shaders in any API.

1) With what API will this be applied to. Materials? RenderToImage? CSS? etc.

2) We need to make sure our material API is up to par (not a big deal).

3) How will these shaders be exposed. We have a lot of different approaches to consider.
    -GLSL and convert it to HLSL
    -extend JSL (which is pretty much like GLSL)
    -Let the user provide the correct kind of shader.
    -Some other language (Cg).

4) I'm also reluctant to provide just vanilla vertex and pixel shaders. Some API's out there like Unity, for example, provide hybrids called "surface shaders" that can automatically configure a lot of the stuff people take for granted.

I agree that it would be great to have this in an update release.

-Joe Andresen
Graphics Engineer, JFX

----- Original Message -----
From: herve.girod at
To: richard.bair at
Cc: openjfx-dev at
Sent: Friday, June 21, 2013 3:03:10 AM GMT -08:00 US/Canada Pacific
Subject: Re: Custom shaders for JavaFX

It's already possible to do this in Swing usine JOGL, and draw a swing hierarchy in an external OpenGL context, but its still *lot* of work to do, and it involve some amount of tricks to lure swing that it is drawing in its own context. Still it would be great to be able to do it "put of the box" in JavaFX.


Sent from my iPhone

On 21 juin 2013, at 09:41, Richard Bair <richard.bair at> wrote:

>> 1.       What are Oracle's plans (if any) for custom shader support in
>> future versions of JavaFX?
> What we've been looking at is not custom shaders, but the ability to allow an application to do all its own OpenGL and give it back to us. Custom shaders might be viewed as a separate issue, such as a way to do custom Effects (which is another long-standing wouldn't-it-be-great-if). Which one are you looking for specifically?
>> 2.       Is such support planned for FX9?
> I'm hoping before that, in an 8 update release.
>> 3.       How will the issues of supporting both OpenGL and Direct3D be
>> overcome?
> Don't know. One idea is to just expose a way for applications to give us a texture, and leave it up to them to give us the right kind. Sort of lame. Another is to only expose OpenGL and then have a way to use OpenGL on windows. You'd probably have to opt-in to this so that if it crashes because of bad drivers it isn't our bad. Another way is to use a mapping layer like WebGL does.
> My personal view is that we only expose OpenGL and have a way to map from OpenGL to D3D on Windows.
>> 4.       If any of the above are answered, has a "language" been chosen for
>> defining shaders (e.g. OSL)?
> I would like to be able to just use OpenGL and say GLSL is our language.
> Richard

More information about the openjfx-dev mailing list