I’m attempting to set up and use a DXT5 texture but my call to glCompressedTextureSubImage2D comes back with the following:
GL_INVALID_ENUM error generated. <target> enum is invalid.
GLuint texture;
glCreateTextures( GL_TEXTURE_2D, 1, &texture );
glTextureStorage2D( texture, 1, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, width, height );
glCompressedTextureSubImage2D( texture, 0, 0, 0, width, height, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, size, data ); // Error occurs when attempting to make this call
Any thoughts on what would cause this error?
For kicks I tried using the bind method and everything seems to work fine with that version. Although I would like to understand why my original version doesn’t work.
GLuint texture;
glGenTextures( 1, &texture );
glBindTexture( GL_TEXTURE_2D, texture );
glTexStorage2D( GL_TEXTURE_2D, 1, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, width, height );
glCompressedTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, width, height, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, size, data );
glBindTexture( GL_TEXTURE_2D, 0 );