naumova.natalya Posted January 29, 2019 Share Posted January 29, 2019 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! Link to comment
silent Posted January 30, 2019 Share Posted January 30, 2019 Natalya, What kind of task you are trying to achieve with that? Can you show us what input you have and what output you want to get? Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
naumova.natalya Posted January 30, 2019 Author Share Posted January 30, 2019 (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 :) Edited January 30, 2019 by naumova.natalya Link to comment
naumova.natalya Posted January 30, 2019 Author Share Posted January 30, 2019 All the cropping I'm doing through that piece of code that I've shown before Link to comment
silent Posted January 30, 2019 Share Posted January 30, 2019 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: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
naumova.natalya Posted January 30, 2019 Author Share Posted January 30, 2019 Here is the 7z archive. The copying mechanism is in the TextureHandler::add_chunk_to_result_texture() TestCopy2D.7z Link to comment
silent Posted January 30, 2019 Share Posted January 30, 2019 Thanks for the test scene! We will take a closer look during this week. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
naumova.natalya Posted January 30, 2019 Author Share Posted January 30, 2019 OK, thank you! Link to comment
silent Posted January 31, 2019 Share Posted January 31, 2019 Natalya, Please, check modified TextureHandler.cpp in attachment. Here is the result of rendering of a single camera: TextureHandler.cpp Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
naumova.natalya Posted January 31, 2019 Author Share Posted January 31, 2019 this is exactly what i wanted, thank you!! Link to comment
Recommended Posts