Different texture rendering on the screen

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Different texture rendering on the screen

TheOmegaFire
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

_______________________________________________
SDL mailing list
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Reply | Threaded
Open this post in threaded view
|

Re: Different texture rendering on the screen

TheOmegaFire
Well, I managed to fix the problem. Just for future reference, I had certain problem with an Entity assignment and with it, some problems with the SDL_Texture pointer. However, I'm still confused as to why the image being rendered into the screen was texture1, instead of just a mess of pixels or something like that. I'd appreciate some insight as to why that particular outcome would happen, but the main problem is otherwise solved. Thanks in advance guys

_______________________________________________
SDL mailing list
[hidden email]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org