feature suggestions: utility class for shaders

hello guys,

you know what would be a nice feature for jogl? a utility class to load and apply GLSL shaders. it would work similar to the TextRenderer class. it could load fragment or pixel shaders from file and do all the hardware-checking if a certain shader version is available etc.

then in the code we would just call
myShader.bind();
to start the shader and
myShader.release();
to end the shader.

what do you think?

done ;D

we have some shader utility classes in the NetBeans OpenGL Pack project
https://netbeans-opengl-pack.dev.java.net/source/browse/netbeans-opengl-pack/trunk/jogl-utils/src/com/mbien/engine/glsl/

i think JOGL’s minimum-scene-graph project has also glsl utilities…

Indeed, see:
https://joglutils.dev.java.net/source/browse/joglutils/trunk/src/net/java/joglutils/msg/misc/Shader.java?rev=64&view=markup

We decided to check it in as part of the MSG sources for now, but the Shader class is self contained (no dependencies other than JOGL), so feel free to take it and use it in your projects. I was going to write a blog about it months ago, but that hasn’t happened yet, unfortunately.

Chris

thank you very much! this class looks very interesting!

just out of couriosity, why is there no constructor with vertexCode only?