Documentation


myGLBbox.cpp

Go to the documentation of this file.
00001 #include "myGLBbox.h"
00002 
00003 #include <GL/glut.h>
00004 #include <iostream>
00005 
00006 using namespace std;
00007 
00008 namespace X3DTK {
00009 namespace GL {
00010 
00011 MyGLBboxDrawArray MyGLBbox::bbox_array = MyGLBboxDrawArray();
00012 
00013 MyGLBbox::MyGLBbox()
00014 : X3DTK::BBox()
00015 {
00016 }
00017 
00018 MyGLBbox::MyGLBbox(const X3DTK::BBox &BB)
00019 : X3DTK::BBox(BB)
00020 {
00021 }
00022 
00023 MyGLBbox::MyGLBbox(const SFVec3f &min, const SFVec3f &max)
00024 : X3DTK::BBox(0.5f*(min + max), max - min)
00025 {
00026 }
00027 
00028 void MyGLBbox::draw() const
00029 {
00030   SFVec3f center = getCenter();
00031   SFVec3f size = getSize();
00032   
00033   glPushAttrib(GL_ALL_ATTRIB_BITS);
00034   glMatrixMode(GL_MODELVIEW);
00035   glEnable(GL_COLOR_MATERIAL);
00036   glDisable(GL_LIGHTING);
00037   glColor3f(1.0f, 1.0f, 1.0f);
00038   glPushMatrix();
00039   
00040   glTranslatef(center.x, center.y, center.z);
00041   glScalef(0.5f*size.x, 0.5f*size.y, 0.5f*size.z);
00042   
00043   glInterleavedArrays(GL_V3F, 0, bbox_array.getBboxVertexArrayAddress());
00044   glDrawElements(GL_LINES, bbox_array.getBboxSize(), GL_UNSIGNED_INT,  bbox_array.getBboxIndexArrayAddress());
00045 
00046   glPopMatrix();
00047   glPopAttrib();
00048 }
00049 
00050 }
00051 }

Generated on Thu Dec 23 13:52:26 2004 by doxygen 1.3.6