So I have two different textures that are supposed to be rendered. One is called multiple times in the same frame, while the other only once. However, whenever the call for the second texture to render is made, the first texture appears on screen. Does anyone has any idea what could be happening here?
Here’s a bit of my code for reference (with some names changed to make the problem more general):
Code:
for(int i = 0; i < maxX; i++)
{
for(int j = 0; j < maxY; j++)
{
if(m_Tiles[i][j].m_Type == Tile::FLOOR1) //m_Tiles is a double vector containing objects called “Tile”, that have (among other things) a type (enum) and an Entity class
texture1.Render(20 * i - camera_pos.x, 20 * j - camera_pos.y); //Camera is a simple struct with 2 integers that represents a (x, y) position
if(m_Tiles[i][j].m_Ent.isLoaded) //isLoaded (bool) becomes true when the Entity class loads an image. The next function is called, so isLoaded is true (but only one tile has a loaded Entity)
m_Tiles[i][j].m_Ent.m_Texture.Render(0, 0); //This is texture2, and whenever this is rendered, the image of texture1 appears on screen, when it should be another texture (the texture is loaded correctly, and the image file is even in a different directory than the one for texture one
}
}
Any kind of help would be extremely appreciated. If you need more information about my code or if you don’t understand something, please do not hesitate to ask