| 288 | |
| 289 | |
| 290 | void SceneDrawer::InitTexture() |
| 291 | { |
| 292 | XnUInt16 g_nXRes; |
| 293 | XnUInt16 g_nYRes; |
| 294 | m_pUserTrackerObj->GetImageRes(g_nXRes,g_nYRes); |
| 295 | |
| 296 | // get the width and height of the texture as the nearest power of two larger than the |
| 297 | // x/y resolution respectively. |
| 298 | texWidth = 2; |
| 299 | while(texWidth < g_nXRes) texWidth<<=1; |
| 300 | texHeight = 2; |
| 301 | while(texHeight < g_nYRes) texHeight<<=1; |
| 302 | |
| 303 | // initialize the texture |
| 304 | depthTexID = 0; |
| 305 | glGenTextures(1,&depthTexID); |
| 306 | pDepthTexBuf = new unsigned char[texWidth*texHeight*4]; |
| 307 | glBindTexture(GL_TEXTURE_2D,depthTexID); |
| 308 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 309 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
| 310 | |
| 311 | |
| 312 | memset(texcoords, 0, 8*sizeof(float)); |
| 313 | texcoords[0] = (float)g_nXRes/texWidth; |
| 314 | texcoords[1] = (float)g_nYRes/texHeight; |
| 315 | texcoords[2] = (float)g_nXRes/texWidth; |
| 316 | texcoords[7] = (float)g_nYRes/texHeight; |
| 317 | } |
| 318 | |
| 319 | |
| 320 | void SceneDrawer::glutDisplay (void) |
nothing calls this directly
no test coverage detected