Hi
I have to read a value, in the fragment shader, using texture coordinates.
They exist the following command: TEX (e.g TEX result.depth, fragment.texcoord[1], texture[0], 3D; )
Definitin of TEX:
TEX v,u,t v texture sample
“v” indicates a floating-point vector input or output
“u” indicates a texture image unit identifier, and “t” indicates a texture target.
It means, fragment.texcoord[1] is the position in the texture where I want to read.
3D means that I’m working with a 3D texture
But what is texture[0]? How can I use it? How can I load data in the texture?
texture[0] is the texture currently bound to the first texturing unit.
It is read only, therefore you can’t possibly write anything to it. Having said that, a solution to write into your texture would be to normaly render your scene before copying it using one of the several available methods (FBO, glCopy etc…)
Originally posted by Overmind: glActiveTexture(GL_TEXTURE0);
glBindTexture(…);
No… BindTexture works in 1D and 2D. And here, I don’t really have a texture. I simply use a 3D texture to pass information to the Fragment program. And I have no idea how I can “fill” the 3D texture with data.
Thanks
Ok
The probleme is simply that this texture is not a real texture, that I want to display. It’s simply data (a 3D structure, containing values) that I want to read in the fragment program. The problem is I have no idea of how to load my, e.g, 3D arrays, in a 3D structure (as if it was an image).
Thanks