Jump to content

[SOLVED] Unigine::Texture::getImage throws error on DX9


photo

Recommended Posts

Posted

Hello

 

Using Unigine::Texture::getImage with DX9 cause the following error:

 

22:20:40 Direct3D9 error: invalid call
22:20:40 D3D9Texture::getImage(): can't lock RGBA8 1000x800 2D texture

 

Code snipped to reproduce:

Unigine::TexturePtr texture;
Unigine::ImagePtr image;

texture = Unigine::Texture::create();
image = Unigine::Image::create();

// Create and set image
if(!texture->create2D(_width, _height, Unigine::Texture::FORMAT_RGBA8)) // This works
{
    Log::error( "Error while creating 2D texture!\n" );
}

if(!texture->getImage(image)) // Error is thrown
{
    Log::error( "Can't access image!\n" );
}

The above code works well for DX11 and OpenGL.

 

 

Thanks

Manuel

Posted

You should add managed flag during texture creation.

Posted

Hello Frustum

 

Added Texture::USAGE_MANAGED as flag but same error as before.

 

Greets

Manuel

Posted

Thank you a lot, it's working now! :)

×
×
  • Create New...