PDA

View Full Version : Sampler information



Corrail
02-24-2004, 06:35 PM
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

V-man
02-24-2004, 07:34 PM
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?

Corrail
02-25-2004, 07:08 AM
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:

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?

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

mrbill
02-25-2004, 03:40 PM
Originally posted by Corrail:
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

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

Corrail
02-25-2004, 04:40 PM
Originally posted by mrbill:
[CODE]
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.

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