Chris Campbell wrote:
Hi Mark,
On Mar 1, 2007, at 6:30 AM, Mark McKay wrote:
I've been following the thread on OpenGL fragment shaders, and am
wondering how I might play around with these on my own. Can I create
any arbitrary fragment shader? Gaussian blurs? Embossing?
Non-tileable patterns? Animated images? Can I pass attributes to
them? What about samplers? If so, fragment shaders have a lot of
potential.
Yes, all of the above (and more) are do-able using fragment shaders in
OpenGL.
(Just to be clear, the stuff I've been doing recently involves getting
Java 2D's OGL pipeline to use fragment shaders as an *implementation
detail* only, e.g. speeding up existing operations such as gradient
paints and various BufferedImageOps. We are not exposing any new API
that would allow developers to write their own shaders for use by Java
2D, although that would be a cool enhancement for the future.)
Aw. Well, I hope that you're able to expose the 2D pipeline to
arbitrary shaders soon. There are a lot of cool realtime effects I
could apply to my vector graphics if I could write hardware level
shaders. Are OpenGL shaders going to be incorporated into JAI?
If there is an introduction to using fragment shaders for 2D, please let
me know!
If you're interested in writing fragment shaders in OpenGL, I'd highly
recommend the OpenGL "Orange Book":
http://www.3dshaders.com/joomla/
There are other various tutorial scattered about the internet. Romain
Guy did a nice write-up recently about how to use shaders in JOGL for
2D image processing purposes (you might need to email him for the
source code though, not sure why):
http://www.curious-creature.org/2007/02/20/fast-image-processing-with-jogl/
Writing shaders often involves huge amounts of boilerplate code, which
is frustrating for a newcomer. Therefore, we're thinking of whipping
up some convenience APIs for JOGL that will make it easy for folks to
start playing around with shaders without getting bogged down in the
details. More on that later.
Hope this helps,
Chris
I have the book, and it is quite useful. I've written shaders for
OpenGL/JOGL which is why I was getting excited about the possibility of
using them directly on Java2D. Romain's example is pretty nifty - I'm
presuming he did it using pbuffers? Still, I imagine a solution
integrated into Java2D itself that does not require JOGL explicitly
would be more user friendly.
Convenience shader APIs for JOGL would be welcome, as I am currently
combing through the SVG filters to deduce the various special effects
algorithms. It would be great if you were to include the shader source
in the documentation so that I might hand tweak it to create custom shaders.
Thanks,
Mark McKay
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".