Texture error in opengl

0

I'm trying to do some things in C using SDL and opengl, and when it comes to drawing textures I can easily if I only want 1 texture object but when trying to put a texture in the background and another to any object both textures are being rendered with the background texture, wanted to know if anyone knows why and can help me with it.

code at link .

    
asked by anonymous 11.06.2017 / 22:14

1 answer

0

unsigned int object; // cria textura glGenTextures(1, &object); // gera textura

In this section the 'glGenTextures' function generates a reference to a storage area for a texture, whenever you call its function of allocating texture, it overrides the reference to that storage area.

To solve you need a data structure (list or array for example) to save all the references generated by 'glGenTextures'.

    
12.06.2017 / 14:45