So I have a piece of code that decides if it should create a render buffer or texture buffer; and my question focuses on this part of it:
glTexImage2D(GL_TEXTURE_2D, 0, m_internalFormat, m_width, m_height, 0, type(), format(), nullptr);
My question is: does specifying a type
/format
do anything if the data is NULL, and i’m basically just mallocing some stuff? I already found out that i can’t use 0L for them, so it seems like they must do something.
I thought it just had to match internal_format, but the wiki page specifies GL_R11F_G11F_B10F needs to function for both renderbuffers and textures, but there’s no corresponding type
for that. Does it not really matter what the type is, and the format just has to match? or what’s the deal?
This for example:
glTexImage2D(GL_TEXTURE_2D, 0, DEPTH_COMPONENT, m_width, m_height, 0, GL_RED, GL_UNSIGNED_BYTE, nullptr);
Will create an error code, because it can’t do the conversion. So it seems like i can’t always use the same values for all internalFormats; or is it safe to just ignore that error code?