Jump to content

[SOLVED] Unigine::Texture::copy2D()


photo

Recommended Posts

Posted

Hi!

I've been trying to merge multiple textures through this code:

render_state->saveState();
render_state->clearStates();
texture_render->setColorTexture(0, src);
texture_render->enable();
{
  dest->copy2D(x0, y0, x1, y1, w, h);
}
texture_render->disable();
texture_render->unbindColorTexture();
render_state->restoreState();

The problem is: I can't copy the copied texture, i.e.:

1. copy texture_0 into texture_1

output: texture_0 == texture_1

2. copy texture_1 into texture_2

output: texture_1 != texture_2

 

Maybe I'm missing some steps? Thank you for your help in advance!

Posted (edited)

I need to create a texture (3) which consists of centers from camera images. So each frame I need to "take a snapshot" from camera (1), crop the middle area (2), create temp texture to copy into it old result texture (with an Y offset size of crop space), then copy the new crop into it, and finaly copy temp texture into result texture (3).

But now I can only "take a snapshot" from camera and crop the center from it. When I try to merge this center into temporary texture it won't copy (temporary texture remains blank). Though when I try to copy the snapshot into this temp texture (for debug reasons, to check whether I created this temp texture right) it copies no problems.

Hope that this explanation is clear :)

image.thumb.png.05e4d61419017a36f6a5a58250b54bcf.png

Edited by naumova.natalya
Posted

All the cropping I'm doing through that piece of code that I've shown before

Posted

Natalya,

To get this work you need to have texture with the same format (if you are grabbing RGBA8 and then combining to a final texture - it should be also a RGBA8). 

Could you please prepare a small test sample (it can be even based on already existing sample from C++ API section) so we can check in details what is going on?

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted

Here is the 7z archive. The copying mechanism is in the TextureHandler::add_chunk_to_result_texture()

TestCopy2D.7z

Posted

this is exactly what i wanted, thank you!!

  • silent changed the title to [SOLVED] Unigine::Texture::copy2D()
×
×
  • Create New...