I need create a mini screenshot.
For example my screen 1024*768 and i am getting screenshot 1024*768, but i need 100*80.
I am add in Irrlicht source:
COpenGLDriver.cpp:
Code: Select all
IImage* COpenGLDriver::createScreenShot(int width,int height)
{
IImage* newImage = new CImage(ECF_R8G8B8, core::dimension2d<u32>(width,height));
u8* pixels = static_cast<u8*>(newImage->lock());
if (!pixels)
{
newImage->drop();
return 0;
}
// allows to read pixels in top-to-bottom order
#ifdef GL_MESA_pack_invert
if (FeatureAvailable[IRR_MESA_pack_invert])
glPixelStorei(GL_PACK_INVERT_MESA, GL_TRUE);
#endif
// We want to read the front buffer to get the latest render finished.
glReadBuffer(GL_FRONT);
glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels);
glReadBuffer(GL_BACK);
#ifdef GL_MESA_pack_invert
if (FeatureAvailable[IRR_MESA_pack_invert])
glPixelStorei(GL_PACK_INVERT_MESA, GL_FALSE);
else
#endif
{
// opengl images are horizontally flipped, so we have to fix that here.
const s32 pitch=newImage->getPitch();
u8* p2 = pixels + (height - 1) * pitch;
u8* tmpBuffer = new u8[pitch];
for (u32 i=0; i < height; i += 2)
{
memcpy(tmpBuffer, pixels, pitch);
memcpy(pixels, p2, pitch);
memcpy(p2, tmpBuffer, pitch);
pixels += pitch;
p2 -= pitch;
}
delete [] tmpBuffer;
}
newImage->unlock();
if (testGLError())
{
newImage->drop();
return 0;
}
return newImage;
}
but i getting a small part screenshot, instead of all screenshot.
My knowledge in OpenGL and DirectX is very small! please help
Sorry, my english is very bad. | I use minGW+CodeBlocks+Irrlicht 1.7.1(1.6,1.5)