Subversion Repositories gelsvn

Rev

Rev 10 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 10 Rev 12
Line 12... Line 12...
12
 
12
 
13
#include <GL/glut.h>
13
#include <GL/glut.h>
14
 
14
 
15
using namespace CGLA;
15
using namespace CGLA;
16
 
16
 
-
 
17
 
-
 
18
Mat4x4f perspective_Mat4x4f(float d)
-
 
19
{
-
 
20
  Mat4x4f m(0.0f);
-
 
21
  
-
 
22
  /* Eye at the origin, looking down the negative z axis */
-
 
23
 
-
 
24
  m[0][0] = 1.0;
-
 
25
  m[1][1] = 1.0;
-
 
26
  m[2][2] = 1.0;
-
 
27
  m[3][2] = -1.0/d;
-
 
28
   
-
 
29
  return m;
-
 
30
}
-
 
31
 
-
 
32
 
17
static void display( void )
33
static void display( void )
18
{
34
{
19
 
35
 
20
  // ----------------------------------------
36
  // ----------------------------------------
21
  // 0. Set up viewing parameters
37
  // 0. Set up viewing parameters
Line 144... Line 160...
144
  // Initialize GL, i.e. setup projection
160
  // Initialize GL, i.e. setup projection
145
  // and possibly other things as well
161
  // and possibly other things as well
146
  glClearColor(1,1,1,1);
162
  glClearColor(1,1,1,1);
147
  gluOrtho2D(-3,3,-3,3);    
163
  gluOrtho2D(-3,3,-3,3);    
148
}
164
}
149
 
-
 
150
// static void idle()
-
 
151
// {
-
 
152
//   glutPostRedisplay();
-
 
153
// }
-
 
154
 
-
 
155
static void init_GLUT(int argc, char *argv[])
165
static void init_GLUT(int argc, char *argv[])
156
{
166
{
157
  // Initialize glut, open and create window.
167
  // Initialize glut, open and create window.
158
  glutInit( &argc, argv );
168
  glutInit( &argc, argv );
159
  glutInitWindowSize( 400 , 400 );
169
  glutInitWindowSize( 400 , 400 );
Line 161... Line 171...
161
 
171
 
162
  // Register callback functions
172
  // Register callback functions
163
  glutReshapeFunc( reshape );
173
  glutReshapeFunc( reshape );
164
  glutKeyboardFunc( key );
174
  glutKeyboardFunc( key );
165
  glutDisplayFunc( display );
175
  glutDisplayFunc( display );
166
  // glutIdleFunc( idle );
-
 
167
 
-
 
168
}
176
}
169
 
177
 
170
int main( int argc, char *argv[] )
178
int main( int argc, char *argv[] )
171
{
179
{
172
  init_GLUT(argc, argv);
180
  init_GLUT(argc, argv);