Dolda2000
Dolda2000

Reputation: 25855

Does glTexImage* use the external format parameters when no data is passed?

When calling glTexImage* with a null pointer to merely allocate the texture but not specify any data, are the pixel format parameters (format and type from the manpage, that is) used at all? I don't find any explicit explanation of this in the manpage.

I figure that they aren't actually used, but are they so completely ignored that I can just pass nonsense (like zero, for instance) to them, or do I have to specify something that makes sense somehow? If the latter, are they subject to any kind of constraints depending on the internal format, or can I just pass any valid constant and have it work, like GL_RGBA even though I'm creating a texture with GL_DEPTH_COMPONENT internal format?

Upvotes: 0

Views: 151

Answers (1)

keltar
keltar

Reputation: 18399

GL_INVALID_ENUM is generated if type is not a type constant.

GL_INVALID_OPERATION is generated if internalFormat is GL_DEPTH_COMPONENT, DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, or GL_DEPTH_COMPONENT32F, and format is not GL_DEPTH_COMPONENT.

So yes, you still have to specify correct values. Even if some implementation will ignore it, other may issue an error.

Upvotes: 3

Related Questions