I wonder if anyone else tried solving this problem or if there is any approach I missed. I'm especially confused about the performance difference between a single call to glTexImage2D and calling it multiple times:
Code: Select all
GLuint tex;
glGenTextures(1, &tex);
glBindTexture0IB(tex);
// this call takes 35ms...
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1920, 1080, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
Code: Select all
GLuint tex;
glGenTextures(1, &tex);
glBindTexture0IB(tex);
// These 3 calls only take 6ms. why?
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 512, 512, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1024, 1024, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1920, 1080, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);