Sampler information

Hi all!

I’ve got the following problem:
I want to get all samplers out of a program object. But how can I do that? If I loop through all uniform I’m not able to seperate an integer from a sampler. Furthermore I’m not able to find out which sampler type it is.
Ok, I can write my own source which scans the whole GLslang source code but this is REALLY messy.
But is there any other possibility?

Thanks a lot
Florian Rudolf

What do you mean by “loop through uniforms”?

Anyway, you could do a sub-string search or have a higher level file that describes the uniforms.

The sub-string search will cost you 10 or 20 lines of code. That’s a problem?

Originally posted by V-man:
What do you mean by “loop through uniforms”?

By using glGetActiveUniform and scanning all active uniforms.

Originally posted by V-man:
[b]
Anyway, you could do a sub-string search or have a higher level file that describes the uniforms.

The sub-string search will cost you 10 or 20 lines of code. That’s a problem?[/b]

That would be an idea, yeah. But it is quite messy too.

Originally posted by Corrail:
[b]Hi all!

I’ve got the following problem:
I want to get all samplers out of a program object. But how can I do that? If I loop through all uniform I’m not able to seperate an integer from a sampler. Furthermore I’m not able to find out which sampler type it is.
Ok, I can write my own source which scans the whole GLslang source code but this is REALLY messy.
But is there any other possibility?

Thanks a lot
Florian Rudolf[/b]

This is unfortunately a known issue. The resolution is in process. It may include additional types representing the different samplers (from Sampler1D through Sampler2DShadow) returned by the <type> parameter of GetActiveUniformARB, which is precisely what you want.

Another alternative to consider until (if) this change is approved is to establish a naming convention for sampler names between application programmers and shader writers. For example:

uniform sampler2D s2Dbase; // a terse convention
uniform sampler2D sampler2D_basemap; // a less terse convention

-mr. bill

Originally posted by mrbill:
[b]

This is unfortunately a known issue. The resolution is in process. It may include additional types representing the different samplers (from Sampler1D through Sampler2DShadow) returned by the <type> parameter of GetActiveUniformARB, which is precisely what you want.[/b]

Yes, that’s exactly what I want. Do you know how/when this will be included in shader objects extension?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.