GL shading language

Started by kramer, March 12, 2006, 12:27:10

Previous topic - Next topic

kramer

Hi All,

Does anyone have a simple example of using GLSL with LWJGL that they'd be willing to share?

If it's too long to post here, please email it to kramer99@gmail.com

Thanks for your help.

spasi

See the org.lwjgl.test.opengl.shaders package in the LWJGL source. It contains a simple GLSL example. Note that it uses the ARB interface and not the GL2.0 one, though it's easy to convert if you wish so.

kramer

Ahh, thanks spasi...
so the GLSL one is the "FSH" one, and the others are the more primitive card specific versions that you need to precompile yourself - have i got that right?

spasi

Yes, but let me explain further, just to be clear:

The vp/fp are low-level vertex & fragment programs using the (old) ARB_vertex/fragment_program extensions.

GLSL is used by the vsh/fsh ones, which are high-level vertex & fragments shaders. These examples use the (newer) ARB_vertex_shader, ARB_fragment_shader and ARB_shader_objects extensions, which expose the initial GLSL API. Most recent drivers support GL version 2.0 though, which exposes a (newest) slightly different API for GLSL and is what you'd probably want to use.

kramer

Thanks for the explanation.

Do you find RenderMonkey to be of any use for this sort of stuff at all?

spasi

It's very good for quick tests and learning. It would be good for production shaders too, but unfortunately it doesn't support multiple shader objects per program (at least it didn't last time I checked). By this I mean linking a number of "utility" shaders to a main vertex/fragment shader pair, to produce the final shader program. This is what we do extensively in Marathon (lower complexity, higher reusability).