Research:
Some important tips about loading textures in shaders:
- Remember to glDeleteTextures(1, &texId) in each cycle. Otherwise, it will cause memory overflow.
- GLuint textureId must be initialized to different numbers, if there are 2 textures:
- GLuint textureId[2];
- It will load the second texture for BOTH textures, the first texture will disappear.
- GLuint textureId[2] = {0,0};
- It will load the second texture for BOTH textures, the first texture will disappear.
- GLuint textureId[2] = {0,1};
- Good! This is the correct way!
- GLuint textureId[2];
- GL_PIXEL_UNPACK_BUFFER