allocate-texture ( tdt level dim data -- )
GPU-accelerated rendering > Texture objects
Prev:texture-data
Next:update-texture ( tdt level loc dim data -- )


Vocabulary
gpu.textures

Inputs and outputs
tdta texture-data-target
levelan integer
diman integer or sequence of integers
dataa texture-data or f


Word description
Allocates a new block of GPU memory for the levelth level of detail of a texture-data-target. If data is not f, the new data is initialized from the given texture-data object; otherwise, the new image is left uninitialized.

Notes
Using a buffer-ptr as the ptr of a texture-data object requires OpenGL 2.1 or later or the GL_ARB_pixel_buffer_object extension.

See also
allocate-compressed-texture, allocate-texture-image

Definition
IN: gpu.textures

GENERIC# allocate-texture 3 ( tdt level dim data -- )


Methods
USING: gpu.textures gpu.textures.private opengl.gl ;

M: texture-1d-data-target allocate-texture
[ ] [ glTexImage1D ] (allocate-texture) ;


USING: gpu.textures gpu.textures.private opengl.gl sequences ;

M: texture-2d-data-target allocate-texture
[ first2 ] [ glTexImage2D ] (allocate-texture) ;


USING: gpu.textures gpu.textures.private opengl.gl sequences ;

M: texture-3d-data-target allocate-texture
[ first3 ] [ glTexImage3D ] (allocate-texture) ;