cropping a hardware pixel buffer

Problems building or running the engine, queries about how to use features etc.
Post Reply
andreahmed
Kobold
Posts: 38
Joined: Wed Dec 31, 2014 2:26 am
x 2

cropping a hardware pixel buffer

Post by andreahmed »

Hi
I'm trying to take a portion of a hardware pixel buffer, but all I get are scanlines... I wonder why

here is my attempt

int min_x = 0;
int min_y = 0;
int max_x = 0;
int max_y = 0;



Core::Resolution screenRes = Core::EnvironmentInformation::getSingleton()->getScreenResolution();

float screenPositionX = (screenPosition.x / screenRes.width) * (pixelBuffer->getWidth());
float screenPositionY = (screenPosition.y / screenRes.height) * (pixelBuffer->getHeight());

min_x = std::max( 0, (int) screenPositionX - radius );
min_y = std::max( 0, (int) screenPositionY - radius);
max_x = std::min( (int)512, (int) screenPositionX + radius );
max_y = std::min( (int)1024, (int) screenPositionY + radius );
// Get the pixelbox within the radius.
Ogre::PixelBox pixelBoxTexture = pixelBuffer->lock(Ogre::Image::Box(min_x, min_y, 0,
max_x,
max_y, 1), Ogre::HardwareBuffer::HBL_READ_ONLY);
andreahmed
Kobold
Posts: 38
Joined: Wed Dec 31, 2014 2:26 am
x 2

Re: cropping a hardware pixel buffer

Post by andreahmed »

please help :(
tlogre
Gnoblar
Posts: 18
Joined: Tue Oct 03, 2017 7:27 pm
x 1

Re: cropping a hardware pixel buffer

Post by tlogre »

I have a similar need. Did you ever resolve your issue?
Post Reply