| 424 | }; |
| 425 | } |
| 426 | int OpenGLGuiHelper::createCheckeredTexture(int red, int green, int blue) |
| 427 | { |
| 428 | int texWidth = 1024; |
| 429 | int texHeight = 1024; |
| 430 | btAlignedObjectArray<unsigned char> texels; |
| 431 | texels.resize(texWidth * texHeight * 3); |
| 432 | for (int i = 0; i < texWidth * texHeight * 3; i++) |
| 433 | texels[i] = 255; |
| 434 | |
| 435 | for (int i = 0; i < texWidth; i++) |
| 436 | { |
| 437 | for (int j = 0; j < texHeight; j++) |
| 438 | { |
| 439 | int a = i < texWidth / 2 ? 1 : 0; |
| 440 | int b = j < texWidth / 2 ? 1 : 0; |
| 441 | |
| 442 | if (a == b) |
| 443 | { |
| 444 | texels[(i + j * texWidth) * 3 + 0] = red; |
| 445 | texels[(i + j * texWidth) * 3 + 1] = green; |
| 446 | texels[(i + j * texWidth) * 3 + 2] = blue; |
| 447 | // texels[(i+j*texWidth)*4+3] = 255; |
| 448 | } |
| 449 | /*else |
| 450 | { |
| 451 | texels[i*3+0+j*texWidth] = 255; |
| 452 | texels[i*3+1+j*texWidth] = 255; |
| 453 | texels[i*3+2+j*texWidth] = 255; |
| 454 | } |
| 455 | */ |
| 456 | } |
| 457 | } |
| 458 | |
| 459 | int texId = registerTexture(&texels[0], texWidth, texHeight); |
| 460 | return texId; |
| 461 | } |
| 462 | |
| 463 | void OpenGLGuiHelper::createCollisionShapeGraphicsObject(btCollisionShape* collisionShape) |
| 464 | { |