Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SceneGlutPrimitives.cpp
1 #include "SceneGlutPrimitives.hh"
2 
3 #include <Gui/biasgl.h>
4 #include <Base/Math/Vector3.hh>
5 #include <Utils/GlutInitWrapper.hh>
6 
7 using namespace BIAS;
8 using namespace std;
9 
12  bTeapot_ = true;
13  bCube_ = false;
14  bIcosahedron_ = false;
15  bTetrahedron_ = false;
16  fCubeSize_ =0.3;
17  fTeapotSize_=0.3;
18 }
19 
22  BIAS::Vector3<double> & themax)
23 {
24  themin = BIAS::Vector3<double>(-fTeapotSize_, -fTeapotSize_, -fTeapotSize_);
25  themax = BIAS::Vector3<double>(fTeapotSize_, fTeapotSize_, fTeapotSize_);
26 }
27 
28 
30 {
32 
33  float colorBronzeDiff[4] = { 0.8, 0.6, 0.0, 1.0 };
34  float colorBronzeSpec[4] = { 1.0, 1.0, 0.4, 1.0 };
35  float colorBlue[4] = { 0.0, 0.2, 1.0, 1.0 };
36  float colorBlueSpec[4] = { 1.0, 1.0, 0.2, 1.0 };
37  float colorNone[4] = { 0.0, 0.0, 0.0, 0.0 };
38  glMatrixMode(GL_MODELVIEW);
39  glPushMatrix();
40 
41  if(bCube_){
42  glMaterialfv(GL_FRONT, GL_DIFFUSE, colorBlue);
43  glMaterialfv(GL_FRONT, GL_SPECULAR, colorNone);
44  glMaterialf(GL_FRONT, GL_SHININESS, 50.0);
45  glColor4fv(colorBlue);
46 
47  glFrontFace(GL_CW);
48  glutSolidCube(fCubeSize_);
49  glFrontFace(GL_CCW);
50  }
51  if(bTeapot_){
52  glMaterialfv(GL_FRONT, GL_DIFFUSE, colorBronzeDiff);
53  glMaterialfv(GL_FRONT, GL_SPECULAR, colorBronzeSpec);
54  glMaterialf(GL_FRONT, GL_SHININESS, 50.0);
55  glColor4fv(colorBronzeDiff);
56 
57  glFrontFace(GL_CW);
58  glutSolidTeapot(fTeapotSize_);
59  glFrontFace(GL_CCW);
60  }
61 
62  if(bIcosahedron_){
63  glMaterialfv(GL_FRONT, GL_DIFFUSE, colorBronzeDiff);
64  glMaterialfv(GL_FRONT, GL_SPECULAR, colorBronzeSpec);
65  glMaterialf(GL_FRONT, GL_SHININESS, 50.0);
66  glColor4fv(colorBronzeSpec);
67  glFrontFace(GL_CW);
68  glutSolidIcosahedron();
69  glFrontFace(GL_CCW);
70  }
71  if(bTetrahedron_){
72  glMaterialfv(GL_FRONT, GL_DIFFUSE, colorBronzeDiff);
73  glMaterialfv(GL_FRONT, GL_SPECULAR, colorBronzeSpec);
74  glMaterialf(GL_FRONT, GL_SHININESS, 50.0);
75  glColor4fv(colorBlueSpec);
76  glFrontFace(GL_CW);
77  glutSolidTetrahedron();
78  glFrontFace(GL_CCW);
79  }
80 
81  glPopMatrix();
82 }
virtual void GetBoundingBox(BIAS::Vector3< double > &themin, BIAS::Vector3< double > &themax)
Determine and return the bouning box of all elements of the scene.
static GlutInitWrapper * GetInstance()
virtual void Draw()
To do anything usefull, overload this method, assume context is ready and draw.