c++ - Why is texelFetch always returning 0 for a 1D single channel texture? -
I am using the 1D texture to store single-channel integer data, which is accessed by piece shader is required. Coming from the application, the integer data type is GLubyte and it needs to be accessed in the shader as an unsigned integer. Textures have been made (note that other textile units are also bound after being bound, which I hope is no relation to this problem):
Glutton's amacquisition [2]; Std :: vector & lt; GLubyte & gt; Information; /// ... populate with 289 elements, all with the value of 1 glacactivate (GL_TEXTURE0); {Glag Texture (1, and mixing [0]); Glybenetic (GL_VInterDDD, MTtext [0]); {GlTexImage1D (GL_TEXTURE_1D, 0, GL_R8UI, data.Size (), 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, and data [0]); } GlBindTexture (GL_TEXTURE_1D, 0); } Glovective Contection (GL_Special 1); Other textures using the {// setup architecture [1]}: The piece shader looks like this:
# 435 in core vec2 TC Smooth; Vec4 color out; Layout (binding = 0) Uniform UEmpler 1D buffer; Layout (binding = 1) Uniform Sampler 2 ADRRA Sampler; Uniform float spacing; Zero main () {vec3 pos; Pos.x = tc.x; Pos.y = tc.y; If (texcelfet (buffer, 0, 0). R == 1) pos.z = 3.0; Else pos.z = 0.0; Color = texture (sampler, pause); } In this example, the value from Texfet defines the texture layer using the 2D array for the final output color by default. I want to return it 1 value, but it always returns to 0 and hits the second segment in the piece shader. Using NVIDIA's Nsight tool, I can see that the value includes 1, 289 times in the texture:
Comments
Post a Comment