Identical matrix yields diffrent result to vertice shader?

So i sort my “sprites” in the depth buffer. I had trouble with poor performance and tought i caculate the model matrix in my Texture class instead for every time i call drawsprite.

But when using the model matrix in my texture class, my sprite shows on top on all other graphics. But when i use the model matric calculated just before sending it to the shader, the sorting works?? even though they are calculated the same…

To check the matrices, i print them out (and they show excatly the same), and then send it to the shader like so:

if(texture->name == "player") {
      std::cout << "textu: " << glm::to_string(texture->model) << std::endl;
      std::cout << "local: " << glm::to_string(localModel) << std::endl;
      std::cout << std::endl;
}

glUniformMatrix4fv(glGetUniformLocation(texture->shader->ID, "model"), 1, GL_FALSE, glm::value_ptr(texture->model)); // Dosent work!?

// glUniformMatrix4fv(glGetUniformLocation(texture->shader->ID, "model"), 1, GL_FALSE, glm::value_ptr(localModel)); // works ..

Any ide why two identical matrix gives diffrent results? ( btw, i’m new to opengl)

Well, found the problem. When i moved the calculation from every drawSprite call to letting each Texture class do the calculation them self, i missed to make each new Texture initial caculate its own matrix.

…my bad. Maybe delete this thread? Stupid misstake by me