MCPcopy Create free account
hub / github.com/OpenNI/OpenNI / drawFrame

Function drawFrame

Samples/NiViewer/Draw.cpp:1510–1634  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1508}
1509
1510void drawFrame()
1511{
1512 // calculate locations
1513 g_DrawConfig.DepthLocation.uBottom = 0;
1514 g_DrawConfig.DepthLocation.uTop = WIN_SIZE_Y - 1;
1515 g_DrawConfig.DepthLocation.uLeft = 0;
1516 g_DrawConfig.DepthLocation.uRight = WIN_SIZE_X - 1;
1517
1518 g_DrawConfig.ImageLocation.uBottom = 0;
1519 g_DrawConfig.ImageLocation.uTop = WIN_SIZE_Y - 1;
1520 g_DrawConfig.ImageLocation.uLeft = 0;
1521 g_DrawConfig.ImageLocation.uRight = WIN_SIZE_X - 1;
1522
1523 if (g_DrawConfig.Streams.ScreenArrangement == SIDE_BY_SIDE)
1524 {
1525 g_DrawConfig.DepthLocation.uTop = WIN_SIZE_Y / 2 - 1;
1526 g_DrawConfig.DepthLocation.uRight = WIN_SIZE_X / 2 - 1;
1527 g_DrawConfig.ImageLocation.uTop = WIN_SIZE_Y / 2 - 1;
1528 g_DrawConfig.ImageLocation.uLeft = WIN_SIZE_X / 2;
1529 }
1530
1531 // Texture map init
1532 const DepthMetaData* pDepthMD = getDepthMetaData();
1533 if (isDepthOn())
1534 {
1535 g_nMaxDepth = getDepthGenerator()->GetDeviceMaxDepth();
1536 TextureMapInit(&g_texDepth, pDepthMD->FullXRes(), pDepthMD->FullYRes(), 4, pDepthMD->XRes(), pDepthMD->YRes());
1537 fixLocation(&g_DrawConfig.DepthLocation, pDepthMD->FullXRes(), pDepthMD->FullYRes());
1538 }
1539
1540 const MapMetaData* pImageMD = NULL;
1541
1542 if (isImageOn())
1543 {
1544 pImageMD = getImageMetaData();
1545 }
1546 else if (isIROn())
1547 {
1548 pImageMD = getIRMetaData();
1549 }
1550
1551 if (pImageMD != NULL)
1552 {
1553 TextureMapInit(&g_texImage, pImageMD->FullXRes(), pImageMD->FullYRes(), 4, pImageMD->XRes(), pImageMD->YRes());
1554 fixLocation(&g_DrawConfig.ImageLocation, pImageMD->FullXRes(), pImageMD->FullYRes());
1555 }
1556
1557 // check if pointer is over a map
1558 bool bOverDepth = (pDepthMD != NULL) && isPointInRect(g_DrawUserInput.Cursor, &g_DrawConfig.DepthLocation);
1559 bool bOverImage = (pImageMD != NULL) && isPointInRect(g_DrawUserInput.Cursor, &g_DrawConfig.ImageLocation);
1560 bool bDrawDepthPointer = false;
1561 bool bDrawImagePointer = false;
1562 int imagePointerRed = 255;
1563 int imagePointerGreen = 0;
1564 int imagePointerBlue = 0;
1565
1566 IntPair pointerInDepth;
1567 IntPair pointerInImage;

Callers

nothing calls this directly

Calls 15

getDepthMetaDataFunction · 0.85
isDepthOnFunction · 0.85
getDepthGeneratorFunction · 0.85
TextureMapInitFunction · 0.85
fixLocationFunction · 0.85
isImageOnFunction · 0.85
getImageMetaDataFunction · 0.85
isIROnFunction · 0.85
getIRMetaDataFunction · 0.85
isPointInRectFunction · 0.85
calculateHistogramFunction · 0.85

Tested by

no test coverage detected