PDA

View Full Version : About texImage2D



oak3d
06-07-2011, 12:54 AM
I am confused why this interface needs the parameter "format":
void texImage2D(GLenum target, GLint level, GLenum internalformat,GLenum format, GLenum type, ImageData pixels);
I can not find a way to get the format of a Image object using javascript.
So to load a Image into a texture I have to assume the image has a specified format.
Why not remove the parameter "format" from the interface and just let the browser implementation to check it automatically so that the developers can load any supported format into one texture.

oak3d
06-07-2011, 03:14 AM
PS: I'm talking about:
void texImage2D(GLenum target, GLint level, GLenum internalformat, GLenum format, GLenum type, ImageData pixels);

not the following one(this interface does need a parameter to indicate the format of the pixel data):
void texImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, ArrayBufferView pixels);