GLSL and low level shaders
Hi, I'm working on integrating shaders into my engine, but there's a question:
Can GLSL shaders (i.e. shader objects and program objects) be used concurrently with low level extensions?
The purpose is to use GLSL as much as possible but provide support for low level shaders for fallback / performance reasons. My ShaderManager class will handle parameters, so it would be able to deal with named and indexed parameters.
Thanks for your help.
Quote:Original post by Lord_Evil
Can GLSL shaders (i.e. shader objects and program objects) be used concurrently with low level extensions?
Depends what you mean by 'low level extensions' and 'concurrently'.
If you want to write a GLSL path and a fallback fixed function path that'll work fine (assuming that only one path is actually rendering at any one time). Some extensions are ignored when you switch to using shaders, some aren't.
Well I mean using a GLSL program object in one render pass and using low level shaders (GL_ARB_vertex_program etc.) in another pass.
Does binding the low level shaders unbind the program object?
When shaders and/or glsl aren't available, fixed function fallback passes will be used. The ShaderManager will be online anyway but report that shaders aren't available for use.
Does binding the low level shaders unbind the program object?
When shaders and/or glsl aren't available, fixed function fallback passes will be used. The ShaderManager will be online anyway but report that shaders aren't available for use.
If you will use both, you need to disable one and also unbind before using the other.
Like glDisable(GL_VERTEX_PROGRAM_ARB)
glDisable(GL_FRAGMENT_PROGRAM_ARB)
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, 0);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0);
glUseProgram(MyShader);
and then
glUseProgram(0);
glEnable(GL_VERTEX_PROGRAM_ARB)
glEnable(GL_FRAGMENT_PROGRAM_ARB)
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, MyVertex);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, MyFrag);
and I suggest you test on all hw and drivers.
Like glDisable(GL_VERTEX_PROGRAM_ARB)
glDisable(GL_FRAGMENT_PROGRAM_ARB)
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, 0);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0);
glUseProgram(MyShader);
and then
glUseProgram(0);
glEnable(GL_VERTEX_PROGRAM_ARB)
glEnable(GL_FRAGMENT_PROGRAM_ARB)
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, MyVertex);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, MyFrag);
and I suggest you test on all hw and drivers.
Quote:Original post by OrangyTangQuote:Original post by Lord_Evil
Can GLSL shaders (i.e. shader objects and program objects) be used concurrently with low level extensions?
Depends what you mean by 'low level extensions' and 'concurrently'.
If you want to write a GLSL path and a fallback fixed function path that'll work fine (assuming that only one path is actually rendering at any one time). Some extensions are ignored when you switch to using shaders, some aren't.
That's because shaders override of some of the pipeline. Vertex shader takes some of it and fragment shader takes control of some other.
Things like blending will work as usual. Alpha testing works as usual, Stencil, depth, etc.
So, in order to use high level shaders and low level programs together, would you suggest using CG?
Afaik, CG compiles highlevel and lowlevel shaders. Ok, in CG they're all high level, but in terms of profiles you have 'low level' profiles and 'high level' profiles. But you wouldn't have to worry about whether GLSL is supported or not (as long as you're using only basic instructions).
Afaik, CG compiles highlevel and lowlevel shaders. Ok, in CG they're all high level, but in terms of profiles you have 'low level' profiles and 'high level' profiles. But you wouldn't have to worry about whether GLSL is supported or not (as long as you're using only basic instructions).
Cg provides profiles. It used to be ARB_vp/fp, NV stuff
Now they added GLSL support, which I assume means you can convert Cg code to GLSL.
I don't know what happens if you want to use multiple profiles.
Now they added GLSL support, which I assume means you can convert Cg code to GLSL.
I don't know what happens if you want to use multiple profiles.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement