Jump to content

how to get image buffer from Unigine::TexturePtr?


photo

Recommended Posts

i use this code to add image in my Material

material->setTextureImage(diffId, img);

but when i use 

_textures = material->getTexture(diffId)

ID3D11Texture2D *texture = (ID3D11Texture2D*)_textures->getD3D11Texture();

then i found it's black in my d3d texture.

is anybody kown how to get my image in my d3d texture?

i want do render to texture to do some postprocess on my d3d texture?

Link to comment

Hi,

You can only set textures for editable materials, please check if material is editable (Material::isEditable()). Currently there is a mistake in that method's return value, it always returns 0.

If material is not editable, texture isn't created in setTextureImage and dummy texture is returned in getTexture.

Link to comment
×
×
  • Create New...