33 files changed, 530 insertions, 113 deletions
diff --git a/src/view/view.c b/src/view/view.c new file mode 100644 index 0000000..db3be6d --- a/dev/null +++ b/src/view/view.c @@ -0,0 +1,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; +} |