which is just one float.
Evewy texture function returns vec4 - if you want to use just one value, then you must specify which one - in this case it’s R.
If this is used with the same shaders as above it’s because you have not specified gl_TexCoord[1] data inside your program and all four vertices of your quad use the default 0.0 to lookup the color in the 1D texture.
But that’s hard to say if you continue to present incomplete code snippets.
Studying some OpenGL tutorials will help.
At least skim over the OpenGL specs and GLSL specs first. They are more complicated than books on OpenGL, but it helps knowing what’s available.
I’m not sure what you mean with “render a quad which is transparent in the middle” but if you mean transparent in the center of a single quad and differently opaque at its edges, that won’t work with a 1D texture and four texture coordinates using linear interpolation.
it’s because you have not specified gl_TexCoord[1] data inside your program and all four vertices of your quad use the default 0.0 to lookup the color in the 1D texture.
Relic, you are right.The problem is in my vert shader as below:
I thought “gl_TexCoord[0] = gl_MultiTexCoord0” is unuseful .So I do not make it work.But it is very important.And “gl_TexCoord[1] = gl_MultiTexCoord1” is really unuseful. 1DTexture and 2D Texture should use the same TextureCoordinate. Is it right?
“1DTexture and 2D Texture should use the same TextureCoordinate. Is it right?”
I have no idea what your test should look like but right, it doesn’t make sense in context of your other questions about volume rendering and color tables on all forums. (Edit: Just saw that you figured it out in the other thread.)
For the usual case of one-component density data stored as luminance values in a 3D texture you don’t need a second texture coordinate for the dependent lookup into the 1D texture, because the result of the 3D texture lookup is the 1D coordinate then. That had been explained before.
For RGB data and programmable alpha it’s either the same if you calculate the 1D s-coord inside the fragment shader from these RGB values, or if it is constant like in your current example it’s not needed anyway and can be done with the quad’s color and texture modulation.