# how to set all the value of vtkTextureObject to an init value, eg. 0 or 1 ?

**URL:** https://discourse.vtk.org/t/how-to-set-all-the-value-of-vtktextureobject-to-an-init-value-eg-0-or-1/12194
**Category:** Support
**Created:** [August 24, 2023, 7:06am UTC](https://discourse.vtk.org/t/how-to-set-all-the-value-of-vtktextureobject-to-an-init-value-eg-0-or-1/12194 "2023-08-24T07:06:39Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![gpu](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/e47c2d/32.png) [@gpu](https://discourse.vtk.org/u/gpu)
#### Post date: [August 24, 2023, 7:06am UTC](https://discourse.vtk.org/t/how-to-set-all-the-value-of-vtktextureobject-to-an-init-value-eg-0-or-1/12194/1 "2023-08-24T07:06:39Z")

</div>

how to set all the value of vtkTextureObject to an init value, eg. 0 or 1 ?

---

<div class="post-metadata">

### Author: ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)
#### Post date: [August 26, 2023, 3:34pm UTC](https://discourse.vtk.org/t/how-to-set-all-the-value-of-vtktextureobject-to-an-init-value-eg-0-or-1/12194/2 "2023-08-26T15:34:51Z")

</div>

Hello @gpu

Simply use one of these methods to fill the texture with your data at the time of creation.

For 1D textures, [vtkTextureObject::Create1DFromRaw(…)](https://vtk.org/doc/nightly/html/classvtkTextureObject.html#af5e1872ac9e1b5e5d127cf79a7f775fb)  
For 2D textures, [vtkTextureObject::Create2DFromRaw(…)](https://vtk.org/doc/nightly/html/classvtkTextureObject.html#a0e56fe426cb0e6749cc6f2f8dbf53ed7)  
For 3D textures, [vtkTextureObject::Create3DFromRaw(…)](https://vtk.org/doc/nightly/html/classvtkTextureObject.html#aa374b1697dbd2e220f15b9cfff066b94)  
For cube maps, [vtkTextureObject::CreateCubeFromRaw(…)](https://vtk.org/doc/nightly/html/classvtkTextureObject.html#a6ebccfa8c59ca55340f955a3310fe740)

Instead, If you want to initialize existing texture objects, use the vtkTextureObject::Download method which gives you a `vtkPixelBufferObject`. You can then write content into that PBO using `vtkPixelBufferObject::MapBuffer` functions
