mphanke
06-14-2002, 01:52 AM
Hi,
I know it is little offtopic but not really. I have to implement a livepic in my OpenGL app. But the camera gives me a 320x240 bmp. I need to turn it 90° to get a 240x320 rect. What is the fastest way to do it to keep it in real time?
This is what I have:
tagBITMAPFILEHEADER *bfh = (tagBITMAPFILEHEADER*) pBuf;
tagBITMAPINFOHEADER *bih = (tagBITMAPINFOHEADER*)((LPBYTE)pBuf + sizeof(tagBITMAPFILEHEADER));
LPBYTE pPixels = (LPBYTE)pBuf + bfh->bfOffBits;
CanonClass *lthis = (CanonClass*)Context;
if( Format == 1 )
{
//Need to rotate somewhere in here! memcpy( (lthis->m_BMP.vpBits) , pPixels, bih->biSizeImage);
DCDst = GetDC(lthis->m_pViewFinder);
DCSrc = CreateCompatibleDC(DCDst);
SelectObject(DCSrc, (lthis->m_BMP.hBmp));
BitBlt(DCDst, 8, 8, 320, 240, DCSrc, 8, 8, SRCCOPY);
DeleteDC(DCSrc);
ReleaseDC( lthis->m_pViewFinder, DCDst );
}
I know it is little offtopic but not really. I have to implement a livepic in my OpenGL app. But the camera gives me a 320x240 bmp. I need to turn it 90° to get a 240x320 rect. What is the fastest way to do it to keep it in real time?
This is what I have:
tagBITMAPFILEHEADER *bfh = (tagBITMAPFILEHEADER*) pBuf;
tagBITMAPINFOHEADER *bih = (tagBITMAPINFOHEADER*)((LPBYTE)pBuf + sizeof(tagBITMAPFILEHEADER));
LPBYTE pPixels = (LPBYTE)pBuf + bfh->bfOffBits;
CanonClass *lthis = (CanonClass*)Context;
if( Format == 1 )
{
//Need to rotate somewhere in here! memcpy( (lthis->m_BMP.vpBits) , pPixels, bih->biSizeImage);
DCDst = GetDC(lthis->m_pViewFinder);
DCSrc = CreateCompatibleDC(DCDst);
SelectObject(DCSrc, (lthis->m_BMP.hBmp));
BitBlt(DCDst, 8, 8, 320, 240, DCSrc, 8, 8, SRCCOPY);
DeleteDC(DCSrc);
ReleaseDC( lthis->m_pViewFinder, DCDst );
}