4 #include "MyDisplayable.h"
12 /*----------------------------------------------------------------------*\
14 \*---------------------------------------------------------------------*/
16 /*--------------------------------------*\
18 \*-------------------------------------*/
20 /*----------------------*\
22 \*---------------------*/
24 MyDisplayable::MyDisplayable():variateur(IntervalF(0 ,1), 0.01)
29 MyDisplayable::~MyDisplayable()
34 /*----------------------*\
36 \*---------------------*/
45 void MyDisplayable::reshape(Panel_A
&panel
, int w
, int h
)
47 glViewport(0, 0, w
, h
);
50 glMatrixMode (GL_PROJECTION
);
59 gluPerspective(fovy
, ratio
, 1, 10);
62 glMatrixMode (GL_MODELVIEW
);
64 gluLookAt(0, 0, 3, 0, 0, 0, 0, 1, 0);
71 * Pour une animation, en fenetrage glut, il faut deriver de
75 * Puis redéfinir IdlFunc, et faire un repaint dedans
77 void MyDisplayable::display(Panel_A
&panel
)
79 glEnable (GL_DEPTH_TEST
);
80 glClear(GL_COLOR_BUFFER_BIT
| GL_DEPTH_BUFFER_BIT
);
94 void MyDisplayable::init(Panel_A
&panel
)
96 // Create OpenGL resources here (Textures,VBO,PBO,Shaders...)
102 void MyDisplayable::release(Panel_A
&panel
)
104 //Freen OpenGL resources here!
107 /*--------------------------------------*\
109 \*-------------------------------------*/
111 void MyDisplayable::drawScene3D()
113 glBegin (GL_TRIANGLES
);
116 glVertex3f(-1, -1, 0);
118 glVertex3f(1, -1, 0);
120 glVertex3f(0, py
, 0);
125 void MyDisplayable::animationStep()
127 py
=variateur
.varierAndGet();
129 // cout<<"[MyDisplayable] : py = "<<py<<endl;
132 /*----------------------------------------------------------------------*\
134 \*---------------------------------------------------------------------*/