Loading 1D fpoint texture - some pixels blacken

Hello everyone,

I have a very nasty problem when trying to load floating point textures. Basically, some of the vertices turn black and remain such even if I change the shader. I provide below the (hopefully relevant) source code and some screenshots.

During initialization

   GLfloat tangents[TBL_SIZE*4];

    /* code filling this in omitted - I checked, it's non-zero */

    glGenTextures(1, &texTangents);
    glBindTexture(GL_TEXTURE_1D, texTangents);

    glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

    glTexImage1D(GL_TEXTURE_1D,
                 0, /* level = 0, no mipmap */
                 GL_RGBA32F_ARB,
                 TBL_SIZE, /* width */
                 0, /* no border */
                 GL_RGBA, /* format of pixel data */
                 GL_FLOAT, /* format */
                 tangents);

    

After the program is set


    GLint tangentMap = glGetUniformLocation(program, "tangentMap");
    if(tangentMap != -1) {
        glActiveTexture(GL_TEXTURE1);
        glBindTexture(GL_TEXTURE_1D, texTangents);
        glUniform1i(tangentMap, 1);
    } else {
        std::cerr << "can not set tangentMap
";
    }

And finally, in the shader

uniform sampler1D tangentMap;

...

/* I read it as follows */
texelFetch(tangentMap, 151, 0).rgb

The problem is that whenever I the texture is loaded (I am not using the values from the texture to set pixel colors, I am just conditioning on them so that the compiler won’t take the uniform out) part of the pixels blacken out. I have uploaded several shots on http://imgur.com/a/lO47U [ the shader is the third image from above, the fourth one is when I switch back to the shader used for the second image] . I have multiple different shaders, and even when I switch to another shader the effects remain (those parts remain black). Even if I rotate the teapot, only those vertices are visible. Anyone with an idea? I already lost almost two days with this.