Create texture w/o copying pixel data to it?

Can you allocate a texture without copying ‘pixels’ data to it? i.e. call glTexImage* with a NULL value for the ‘pixels’ parameter?

The ‘Why?’ is to handle tiled image data without having to create an intermediate buffer in main memory. Pbuffers would do the trick too but wondering if it can be done with just textures.

yep, you can do that. You might encounter some bugs in the driver, but thats perfectly legit (might not be in old versions of OpenGL?). If you encounter problems, you can always initialize your texture to garbage and simply fill it in as needed.

Supplying NULL for pixels is core OpenGL 1.1

also, you could get pixels from the the framebuffer with glCopyTexImage2D: no need for a starting sysram buffer then.

Originally posted by Foxbat:
[b]Can you allocate a texture without copying ‘pixels’ data to it? i.e. call glTexImage* with a NULL value for the ‘pixels’ parameter?

The ‘Why?’ is to handle tiled image data without having to create an intermediate buffer in main memory. Pbuffers would do the trick too but wondering if it can be done with just textures.[/b]
I have done this with glTexImage2D for the same reason you suggested. I was suprised when it failed for glCompressTexImage2D. The specification for glCompressTexImage2D does not explicitly allow a NULL pointer.

Originally posted by Foxbat:
Can you allocate a texture without copying ‘pixels’ data to it? i.e. call glTexImage* with a NULL value for the ‘pixels’ parameter?

Yes you can, but I tried about 2 years ago and the nVidia driver was crashing, while it was working fine with ATI. I didn’t rechecked since if they fixed it.