Recommended Posts

Hi all.
How is a texture stage bound to the uniform inputs of a pixel shader? As far as I get it the order of the uniform decls in the pshader represent the texture stages...
I use DX8 and Cg.
If so, how can the following pshader change output if the texture stage 0 is changed?

the function name should be pretty much the same for D3D... try looking in cgD3D.h (or something like that, for OpenGL it''s cgGL.h)or just go download and read the CG programmer manual, it will be much better

0

Share this post

Link to post

Share on other sites

Now, let''s just assume I don''t use the Cg library for some reason and I have to bind the textures in the fragment program to numerically counted texture stages in the API? How does DirectX handle that texture binding?

edit: for your last question... I don't know, but you probably don't need the answer any more, as you now know you've got a nice header file containing all the prototypes of the functions you seek... and that people took time to write a documentation for CG...

Share this post

Link to post

Share on other sites

Well, either it''s that dumb and nobody wants to answer my original question (in that case - shame on me) OR maybe it isn''t and nobody (including you sBibi ) could answer it until now...

Thanks for your answers sBibi and yes, I do make it a habit before posting something in the forums. I find those posts annoying myself.

Specifying my original question again (which was probably not clear enough in the first post - sorry about that):Now, assuming I don''t use the Cg runtime library, how is a texture bound to a sampler2D in Cg / Dx8? Anyone?

Thanks,Alex

0

Share this post

Link to post

Share on other sites

Even NVIDIA themselves use the SetTexture() function of DX8 in their shadow mapping sample! Yet I don''t fully grasp that OR I do have a serious problem! I have a fragmen program (see original posting) that uses 2 sampler2D parameters and I set two textures with SetTexture(). Then the fragment program uses the 2nd sampler (AND NOTHING ELSE) to generate the output color. Now, if samplers are bound to texture stage indexes by the order they appear in the declaration then that''d mean that changing the first texture stage doesn''t change a thing!But it does!!!