summaryrefslogtreecommitdiffstats
path: root/src/view/view.c (plain)
blob: db3be6d92c0b06517e2e858c0561912000ef205e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "../controller/callbacks/display.h"
#include "../controller/callbacks/keyboard.h"
#include "../controller/callbacks/mouse.h"
#include "../controller/callbacks/mouse_wheel.h"
#include "../controller/callbacks/reshape.h"
#include "../db/dbconnect.h"
#include "init.h"
#include "state0.h"
#include "view.h"
#include <GL/freeglut.h>
#include <GL/freeglut_ext.h>
#include <GL/glut.h>

void
view (void)
{
  // Connect to the database.
  dbconnect ();

  // GLUT Initialization
  glutInitWindowSize (500, 500);
  glutInitWindowPosition (100, 100);
  glutCreateWindow ("Exp004");

  // GL Initialization
  glClearColor (CLEAR_COLOR);
  glColor3f (DRAW_COLOR);
  glEnable (GL_AUTO_NORMAL);
  glDisable (GL_DEPTH_TEST);
  glEnable (GL_MAP1_VERTEX_3);
  glShadeModel (GL_SMOOTH);

  /* Buffer objects to use. */
  glEnableClientState (GL_COLOR_ARRAY);
  glEnableClientState (GL_VERTEX_ARRAY);

  /* Enable Antialiasing as described in "Antialiasing"
     [Shreiner,247]. */
  glEnable (GL_LINE_SMOOTH);
  glEnable (GL_BLEND);
  glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);

  // Initialize the model.
  init ();

  // Callbacks
  glutDisplayFunc (display);
  glutKeyboardFunc (keyboard);
  glutMouseFunc (mouse);
  glutMouseWheelFunc (mouse_wheel);
  glutReshapeFunc (reshape);

  return;
}

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.