Hi,
so basically what the problem is when I start my level, the first thing that I see are kinda random sprites for no reason. It happens only for a split second.
I tried to make a screenshot, but in that screen shot I couldn’t see what I saw seeing on the screen. I thought I failed to make a screenshot, so I recorded everything. It didn’t show up on the recording as well.
What might be causing this? I’m using VBO to render this. What might be causing this strange thing? I wanted to make a screenshot or something, but as stated above it doesn’t really work like that
I don’t even know what to ask. Why would stuff be appearing on the screen and not on the Print Screen or recorded video?
EDIT_1:
It seems like tile sprites are being replaced by one of the animation sprites. It happens for 2 game ticks (60/s). I just don’t get it. If I was swapping sprites by mistake or something it would show up on the screen i think. This is like an error with opengl or something.
EDIT_2:
I tried recording few more times using different frame rates. I managed to record the problem. My recorder probably wasn’t catching the game once it was running at 60 fps. So now this is a problem with my rendering or something. That is a relief Now I can fix it somehow!
This is how it looks like
EDIT_3:
The problem occurs when I spawn zombies! The problem only lasts one frame.
EDIT_4:
I could just spawn 1 zombie behind the scenes before the game even starts rendering, but that wouldn’t really solve the problem. This is just kinda strange.
EDIT_5:
My Zombie class has static SpriteSheet which is just an opengl texture basically. It isn’t used anywhere. I think the problem is with texture binding. When I create 1st zombie, static texture get created, therefore binding itself to opengl. I still need to confirm this, but problem is probably with texture binding. My Tile sprite seems to be rendering at the same coordinates but from the other texture.
EDIT_6:
Yeap the problem is with binding. I have this “abstract” kinda class for rendering called screen. When I render a sprite, I try to set current texture to that of sprite. If the texture is already the same, I don’t do anything. If it is different, I have a reference to the last spritesheet I set. When I create textures, I don’t use screen class to set textures at all, therefore breaking it. In the other words, this is just an error of binding textures properly.