| 269 | } |
| 270 | |
| 271 | void TextureMapDraw(XnTextureMap* pTex, IntRect* pLocation) |
| 272 | { |
| 273 | // set current texture object |
| 274 | glBindTexture(GL_TEXTURE_2D, pTex->nID); |
| 275 | |
| 276 | // turn on texture mapping |
| 277 | glEnable(GL_TEXTURE_2D); |
| 278 | |
| 279 | glEnable(GL_BLEND); |
| 280 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
| 281 | |
| 282 | // set drawing mode to rectangles |
| 283 | glBegin(GL_QUADS); |
| 284 | |
| 285 | // set the color of the polygon |
| 286 | glColor4f(1, 1, 1, 1); |
| 287 | |
| 288 | // upper left |
| 289 | glTexCoord2f(0, 0); |
| 290 | glVertex2f(pLocation->uLeft, pLocation->uBottom); |
| 291 | // upper right |
| 292 | glTexCoord2f((float)pTex->OrigSize.X/(float)pTex->Size.X, 0); |
| 293 | glVertex2f(pLocation->uRight, pLocation->uBottom); |
| 294 | // bottom right |
| 295 | glTexCoord2f((float)pTex->OrigSize.X/(float)pTex->Size.X, (float)pTex->OrigSize.Y/(float)pTex->Size.Y); |
| 296 | glVertex2f(pLocation->uRight, pLocation->uTop); |
| 297 | // bottom left |
| 298 | glTexCoord2f(0, (float)pTex->OrigSize.Y/(float)pTex->Size.Y); |
| 299 | glVertex2f(pLocation->uLeft, pLocation->uTop); |
| 300 | |
| 301 | glEnd(); |
| 302 | |
| 303 | // turn off texture mapping |
| 304 | glDisable(GL_TEXTURE_2D); |
| 305 | |
| 306 | glDisable(GL_BLEND); |
| 307 | } |
| 308 | |
| 309 | // -------------------------------- |
| 310 | // Code |
no outgoing calls
no test coverage detected