Question on glTexImage2D()


I have a question regarding glTexImage2D().

When we use “glTexImage2D (GL_TEXTURE_RECTANGLE_NV, 0, GL_FLOAT_RGBA32_NV, width, height, 0, GL_RGBA, GL_FLOAT, NULL);”, does anything gets downloaded across the bus or nothing gets downloaded from CPU->GPU.

I know for sure that data is transferred when used “glTexImage2D (GL_TEXTURE_RECTANGLE_NV, 0, GL_FLOAT_RGBA32_NV, width, height, 0, GL_RGBA, GL_FLOAT, &texture);”

Any explanation is appreciated.


What would you expect if one call gets a null pointer for the data and the other gets a pointer to a huge chunk of data?

glTexImage() is malloc().

glTexSubImage() (preferred way on NVIDIA) or glDrawBuffer()/glDrawPixels() (preferred way on ATI) is download(). This applies to FBO float texture attachments only (but that’s what you are doing anyway!).

You have absolutely no guarantee when the actual chunk of data is really going over the bus, it’s up to the GL to decide. Right after the call? Upon first usage? I’ve seen benchmarks than indicate it all, and it even changed from driver to driver on the same piece of HW. All you can be sure about is that the GL has finished a memcpy() once glTex(Sub)Image() returns.