Shader/Quad/Texture random color of texture

Constructor for texture

glTexture2d::glTexture2d(const uint32_t w, const uint32_t h): w(w), h(h) {
        iF = GL_RGBA8, dF = GL_RGBA;
        c = 4;
        glCreateTextures(GL_TEXTURE_2D, 1, &id);
        glTextureStorage2D(id, 1, iF, w, h);
        glTextureParameteri(id, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
        glTextureParameteri(id, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        glTextureParameteri(id, GL_TEXTURE_WRAP_S, GL_REPEAT);
        glTextureParameteri(id, GL_TEXTURE_WRAP_T, GL_REPEAT);
    }

texture creation assignment

    sData->whiteTexture = texture2d::create(1, 1);
//        uint32_t whiteTextureData = 0xffffffff;
        GLubyte whiteTextureData[] = {255, 255, 255, 255};
        unsigned char pData[4];
        sData->whiteTexture->setData(&whiteTextureData, sizeof(whiteTextureData));

shader, dont think its the shader but for context,
color = texture(u_Texture, v_TexCoord * u_Scale) * u_Color;

this is the function call that loads data into shader

        sData->shader_->setFloat("u_Scale", sl);
        sData->shader_->setFloat4("u_Color", c);
        tx->bind();
        glm::mat4 transform = glm::translate(glm::mat4(1.0f), p)
                * glm::rotate(glm::mat4(1.0f), r, {0.0f, 0.0f, 1.0f})
                * glm::scale(glm::mat4(1.0f), {sz.x, sz.y, 1.0f});
        sData->shader_->setMat4("uTransform", transform);
        sData->vao->bind();
        renderCommand::drawObjects(sData->vao);
    }

draw objects

    void glRendererApi::drawObjects(const std::shared_ptr<vertexArray>& va) {
        glDrawElements(GL_TRIANGLES, va->getIndexBuffer()->getCount(), GL_UNSIGNED_INT, nullptr);
        glBindTexture(GL_TEXTURE_2D, 0);
    }

In the end if i print out the whiteTexture color after creations(what is at the top)

       sData->whiteTexture->bind();
        glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, pData);
        PWE_CORE_INFO("Pixel Data: R={0}, G={1}, B={2}, A={3}",
              (int)pData[0], (int)pData[1], (int)pData[2], (int)pData[3]);
        glBindTexture(GL_TEXTURE_2D, 0);

i get sometimes random values, it should be white, it sometimes is white. but there isnt any hyme or reason to when it does, i also find if i run in debug mode, it seems to happen less, but doesnt explicitly fix it, i have tried running glfinish and glflush, and also doing a sync function. on another note, if i use ‘stbi’, and load a texture, and i have no issues with using the same shader, and also, draw functions. not sure where to go here or how to solve this.

just for refence that the following works, no color issues even when setting the color explicitly

glTexture2d::glTexture2d(const std::string& p): p(p){
        int width, height, channels;
        stbi_set_flip_vertically_on_load(true);
        stbi_uc *data = nullptr;
        data = stbi_load(p.c_str(), &width, &height, &channels, 0);
        w = width; h = height; c = channels;
        switch (channels) {
            case 1: iF = GL_RED; dF = GL_RED; break;
            case 3: iF = GL_RGB8; dF = GL_RGB; break;
            case 4: iF = GL_RGBA8; dF = GL_RGBA; break;
        }
        glCreateTextures(GL_TEXTURE_2D, 1, &id);
        glTextureStorage2D(id, 1, iF, w, h);
        glTextureParameteri(id, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
        glTextureParameteri(id, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        glTextureParameteri(id, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
        glTextureParameteri(id, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
        glTextureSubImage2D(id, 0, 0, 0, w, h, dF, GL_UNSIGNED_BYTE, data);
        stbi_image_free(data);
    }

and additionally,

    void glTexture2d::setData(void *d, uint32_t s) {
        glTexImage2D(id, 0, 0, 0, w, h, dF, GL_UNSIGNED_BYTE, d);
    }

    void glTexture2d::bind(uint32_t u) const {
        glBindTextureUnit(u, id);
    }

//is where draws are called in the render loop
//first three will cause issues with colors, but not always, the texture_ is a stbi loaded texture
//the other three are using "whiteTexture"
        project_wolf_engine::renderer2d::drawQuad({-3.0, 3.0}, {2.0f, 2.0f});
        project_wolf_engine::renderer2d::drawQuad({-1.0f, 0.0f}, {0.8f, 1.0f}, {1.0f, 0.0f, 0.0f, 1.0f});
        project_wolf_engine::renderer2d::drawRotatedQuad({0.5f, -0.5f}, {1.0f, 1.0f}, glm::radians(45.0f), {0.0f, 0.0f, 1.0f, 1.0f});
        project_wolf_engine::renderer2d::drawQuad({1.01f, -1.01f}, {1.0f, 1.0f}, texture_, {1.0f, 0.0f, 0.0f, 1.0f}, 1.0f);
        project_wolf_engine::renderer2d::drawQuad({1.0f, -1.0f}, {1.0f, 1.0f}, texture_);


// these are just the other draw quad functions that all end up just calling the one above
// i do plan on changing this to be a structure but, im learning
 void renderer2d::drawQuad(const glm::vec2 &p, const glm::vec2 &sz, const glm::vec4& c, const float& sl) {
        drawQuad({p.x, p.y, 0.0f}, sz, c, sl);
    }

    void renderer2d::drawQuad(const glm::vec3 &p, const glm::vec2 &sz, const glm::vec4& c, const float& sl) {
        drawQuad(sData->whiteTexture, p, sz, c, sl);
    }

    void renderer2d::drawQuad(const glm::vec2 &p, const glm::vec2 &sz, const ref<texture2d> &tx, const glm::vec4& c, const float& sl) {
        drawQuad({p.x, p.y, 0.0f}, sz, tx, c, sl);
    }

    void renderer2d::drawQuad(const glm::vec3 &p, const glm::vec2 &sz, const ref<texture2d> &tx, const glm::vec4& c, const float& sl) {
        drawQuad(tx, p, sz, c, sl);
    }


    void renderer2d::drawRotatedQuad(const glm::vec2 &p, const glm::vec2 &sz, float r, const glm::vec4 &c, const float &sl) {
        drawRotatedQuad({p.x, p.y, 0.0f}, sz, r, c, sl);
    }

    void renderer2d::drawRotatedQuad(const glm::vec3 &p, const glm::vec2 &sz, float r, const glm::vec4 &c, const float &sl) {
        drawRotatedQuad(sData->whiteTexture, p, sz, r, c, sl);
    }

    void renderer2d::drawRotatedQuad(const glm::vec2 &p, const glm::vec2 &sz, const ref <texture2d> &tx, float r, const glm::vec4 &c, const float &sl) {
        drawRotatedQuad({p.x, p.y, 0.0f}, sz, tx, r, c, sl);
    }

    void renderer2d::drawRotatedQuad(const glm::vec3 &p, const glm::vec2 &sz, const ref <texture2d> &tx, float r, const glm::vec4 &c, const float &sl) {
        drawRotatedQuad(tx, p, sz, r, c, sl);
    }

    void renderer2d::drawQuad(const ref <texture2d> &tx, const glm::vec3 &p, const glm::vec2 &sz, const glm::vec4 &c,  const float &sl) {
        drawRotatedQuad(tx, p, sz, 0.0f, c, sl);
    }