Texture error in opengl

Asked

Viewed 86 times

0

I’m trying to do some things in C using SDL and opengl, and at the time of drawing textures I can easily if you want only 1 object with texture but when trying to put a texture in the background and another for any object both textures are being rendered with the texture of the background, I wonder if anyone knows why and can help me with this.

code in https://codeshare.io/jogo_andrew:main. c .

1 answer

0

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

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

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

  • I could give you an example of what it would look like ?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.