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

Method DrawDepthMapTexture

Samples/NiUserSelection/SceneDrawer.cpp:127–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125
126
127void SceneDrawer::DrawDepthMapTexture()
128{
129 XnUInt16 g_nXRes;
130 XnUInt16 g_nYRes;
131 m_pUserTrackerObj->GetImageRes(g_nXRes,g_nYRes);
132
133 if (g_bDrawPixels)
134 {
135 m_pUserTrackerObj->FillTexture(pDepthTexBuf,texWidth,texHeight,g_bDrawBackground);
136 }
137 else
138 {
139 xnOSMemSet(pDepthTexBuf, 0, 3*2*g_nXRes*g_nYRes); // makes the texture empty.
140 }
141
142 // makes sure we draw the relevant texture
143 glBindTexture(GL_TEXTURE_2D, depthTexID);
144 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, texWidth, texHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, pDepthTexBuf);
145
146 // Display the OpenGL texture map
147 glColor4f(0.75,0.75,0.75,1);
148
149 glEnable(GL_TEXTURE_2D);
150
151 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
152 glTexCoordPointer(2, GL_FLOAT, 0, texcoords);
153
154 GLfloat verts[8] = { g_nXRes, g_nYRes, g_nXRes, 0, 0, 0, 0, g_nYRes };
155 glVertexPointer(2, GL_FLOAT, 0, verts);
156 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
157
158 //TODO: Maybe glFinish needed here instead - if there's some bad graphics crap
159 glFlush();
160 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
161
162 glDisable(GL_TEXTURE_2D);
163}
164
165#define MAX_USER_LABEL_LEN 50
166#define MAX_ID_LABEL_LEN 120

Callers 1

glutDisplayMethod · 0.80

Calls 3

GetImageResMethod · 0.80
FillTextureMethod · 0.80
xnOSMemSetFunction · 0.50

Tested by

no test coverage detected