| 689 | | { |
| | 690 | #if 1 |
| | 691 | { |
| | 692 | osg::Geometry* geom = new osg::Geometry; |
| | 693 | |
| | 694 | osg::Vec3Array* coords = new osg::Vec3Array(8); |
| | 695 | (*coords)[0].set(0,0,0); |
| | 696 | (*coords)[1].set(1,0,0); |
| | 697 | (*coords)[2].set(1,1,0); |
| | 698 | (*coords)[3].set(0,1,0); |
| | 699 | (*coords)[4].set(0,0,1); |
| | 700 | (*coords)[5].set(1,0,1); |
| | 701 | (*coords)[6].set(1,1,1); |
| | 702 | (*coords)[7].set(0,1,1); |
| | 703 | geom->setVertexArray(coords); |
| | 704 | |
| | 705 | osg::Vec3Array* tcoords = new osg::Vec3Array(8); |
| | 706 | (*tcoords)[0].set(0,0,0); |
| | 707 | (*tcoords)[1].set(1,0,0); |
| | 708 | (*tcoords)[2].set(1,1,0); |
| | 709 | (*tcoords)[3].set(0,1,0); |
| | 710 | (*tcoords)[4].set(0,0,1); |
| | 711 | (*tcoords)[5].set(1,0,1); |
| | 712 | (*tcoords)[6].set(1,1,1); |
| | 713 | (*tcoords)[7].set(0,1,1); |
| | 714 | geom->setTexCoordArray(0,tcoords); |
| | 715 | |
| | 716 | osg::Vec4Array* colours = new osg::Vec4Array(1); |
| | 717 | (*colours)[0].set(1.0f,1.0f,1.0,1.0f); |
| | 718 | geom->setColorArray(colours); |
| | 719 | geom->setColorBinding(osg::Geometry::BIND_OVERALL); |
| | 720 | |
| | 721 | osg::DrawElementsUShort* drawElements = new osg::DrawElementsUShort(GL_QUADS); |
| | 722 | // bottom |
| | 723 | drawElements->push_back(0); |
| | 724 | drawElements->push_back(1); |
| | 725 | drawElements->push_back(2); |
| | 726 | drawElements->push_back(3); |
| | 727 | |
| | 728 | // bottom |
| | 729 | drawElements->push_back(3); |
| | 730 | drawElements->push_back(2); |
| | 731 | drawElements->push_back(6); |
| | 732 | drawElements->push_back(7); |
| | 733 | |
| | 734 | // left |
| | 735 | drawElements->push_back(0); |
| | 736 | drawElements->push_back(3); |
| | 737 | drawElements->push_back(7); |
| | 738 | drawElements->push_back(4); |
| | 739 | |
| | 740 | // right |
| | 741 | drawElements->push_back(2); |
| | 742 | drawElements->push_back(1); |
| | 743 | drawElements->push_back(5); |
| | 744 | drawElements->push_back(6); |
| | 745 | |
| | 746 | // front |
| | 747 | drawElements->push_back(0); |
| | 748 | drawElements->push_back(1); |
| | 749 | drawElements->push_back(5); |
| | 750 | drawElements->push_back(4); |
| | 751 | |
| | 752 | // top |
| | 753 | drawElements->push_back(6); |
| | 754 | drawElements->push_back(7); |
| | 755 | drawElements->push_back(4); |
| | 756 | drawElements->push_back(5); |
| | 757 | |
| | 758 | geom->addPrimitiveSet(drawElements); |
| | 759 | |
| | 760 | geode->addDrawable(geom); |
| | 761 | |
| | 762 | } |
| | 763 | #else |