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

Method InitTexture

Samples/NiUserSelection/SceneDrawer.cpp:290–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288
289
290void 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
320void SceneDrawer::glutDisplay (void)

Callers

nothing calls this directly

Calls 1

GetImageResMethod · 0.80

Tested by

no test coverage detected