Skip to main content
gamedev.net
🔒 Locked

Creating an empty texture.

Started by bluntman 2 replies 550+ views
Original Post
bluntman
bluntman
How can I create a texture with specific dimensions, but not actually upload any data to it during the glTexImage2D call? I want to fill in the texture later, not during initialisation, and I don't want to waste time uploading a blank texture in the glTexImage2D call. At the moment I am calling with 0 (zero) as the source data in the call, and it isn't breaking my texture, but I don't know if its doing what I want (spec doesn't help here), or if its sending a full size garbage texture to vid mem.
Brother Bob
Brother Bob
The specification does mention it. Page 158 in the 2.0 specification.
Quote:

If the data argument of TexImage1D, TexImage2D, or TexImage3D is a null pointer (a zero-valued pointer in the C implementation), a one-, two-, or threedimensional texture array is created with the specified target, level, internalformat, width, height, and depth, but with unspecified image contents. In this case no pixel values are accessed in client memory, and no pixel processing is performed.

So a texture object is properly setup, ignoring the actual data of course, when you pass a null pointer.
Brother Bob
Brother Bob
That quote is present in all specifications down to version 1.1.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.