-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
91 lines (65 loc) · 1.87 KB
/
main.cpp
File metadata and controls
91 lines (65 loc) · 1.87 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include "tardis.h"
#include "vortex.h"
#include "MVPprovider.h"
#include "helpers.h"
#include <Windows.h>
#include <GL\glfw.h>
const int FPS = 30;
int initializeWindow()
{
if( !glfwInit() )
{
fprintf( stderr, "Failed to initialize GLFW\n" );
return -1;
}
glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 4);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 1);
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
if( !glfwOpenWindow( 1024, 768, 0,0,0,0, 32,0, GLFW_WINDOW ) )
{
fprintf( stderr, "Failed to open GLFW window\n" );
glfwTerminate();
return -1;
}
if (glewInit() != GLEW_OK) {
fprintf(stderr, "Failed to initialize GLEW\n");
return -1;
}
glfwSetWindowTitle( "Time and Relative Dimension In Space" );
glfwEnable( GLFW_STICKY_KEYS );
glClearColor(0.22f, 0.49f, 0.83f, 1.0f);
glDepthFunc(GL_LESS);
glEnable(GL_CULL_FACE);
//glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
return 0;
}
int main(int agrc, char** argv)
{
initializeWindow();
MVPprovider* mvp = MVPprovider::Instance();
mvp->setScreenSize(1024, 768);
Tardis* m_tardis;
m_tardis = new Tardis();
Vortex* m_vortex;
m_vortex = new Vortex();
m_vortex->initialize(NULL, "clouds.dds");
m_tardis->initialize();
//double thisRedraw, lastRedraw = glfwGetTime();
do
{
//mvp->calculateMatrices();
computeMatricesFromInputs();
m_vortex->process();
m_tardis->process();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
m_vortex->render();
m_tardis->render();
glfwSwapBuffers();
//thisRedraw = glfwGetTime() - lastRedraw;
//printf("%d", 1000/FPS - thisRedraw*1000);
//if (thisRedraw > 0) Sleep(1000/FPS - thisRedraw*1000);
} while( glfwGetKey( GLFW_KEY_ESC ) != GLFW_PRESS && glfwGetWindowParam( GLFW_OPENED ) );
return 0;
}