Texture management and textures affecting colours
So, I've tried to find these answers in the red book, the superbible, and in a bazillion samples, I hope someone can help me out:
1) How do you unload textures? I couldn't find a way, so I made a texture manager that keeps a record of how many times a texture is referenced, and when it tries to load a new texture, if it finds a record with no more references, it glBind's to that texture, and replaces it with the new one. Is this in any way correct?Or do I just keep generating textures and hope my card has the memory
2) I set my glClear colour at the top of my render function, I draw a grid of light grey lines, and a blue cube on a dark gray background. Everything works fine until I texture map one triangle of the cube, then the lines and the block become black. What's weird is that when I change the texture, if eg: a colour on the border of the texture is red, everything becomes red. (and I haven't set a border value for the texture)
3) Also, I've seen on this website that you mustn't use GL_DECAL when describing a texture, but GL_MODULATE instead. When I use GL_MODULATE, the colours of my texture seem to swap from RGB to BGR, but if I use GL_DECAL, the colours are fine.
Thanks in advance, I know these are long questions, but I've really tried finding some of this myself, to no avail.