-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathmain.hpp
More file actions
99 lines (82 loc) · 2.34 KB
/
Copy pathmain.hpp
File metadata and controls
99 lines (82 loc) · 2.34 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
92
93
94
95
96
97
98
99
/**
* @file main.hpp
* @brief Main file for CUDA rasterizer. Handles CUDA-GL interop for display.
* @authors Skeleton code: Yining Karl Li, Kai Ninomiya
* @date 2012-2015
* @copyright University of Pennsylvania
*/
#pragma once
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <cuda_gl_interop.h>
#include <cuda_runtime.h>
#include <glm/glm.hpp>
#include <util/glslUtility.hpp>
#include <util/utilityCore.hpp>
#include <util/objloader.hpp>
#include "rasterize.h"
using namespace std;
//-------------------------------
//------------GL STUFF-----------
//-------------------------------
int frame;
int fpstracker;
double seconds;
int fps = 0;
GLuint positionLocation = 0;
GLuint texcoordsLocation = 1;
const char *attributeLocations[] = { "Position", "Tex" };
GLuint pbo = (GLuint)NULL;
GLuint displayImage;
uchar4 *dptr;
GLFWwindow *window;
//-------------------------------
//----------CUDA STUFF-----------
//-------------------------------
int width = 800;
int height = 800;
//-------------------------------
//-------------MAIN--------------
//-------------------------------
int main(int argc, char **argv);
//-------------------------------
//---------RUNTIME STUFF---------
//-------------------------------
void runCuda();
void setupCamera();
#ifdef __APPLE__
void display();
#else
void display();
void keyboard(unsigned char key, int x, int y);
#endif
//-------------------------------
//----------SETUP STUFF----------
//-------------------------------
bool init(obj *mesh);
void initPBO();
void initCuda();
void initTextures();
void initVAO();
GLuint initShader();
//-------------------------------
//---------CLEANUP STUFF---------
//-------------------------------
void cleanupCuda();
void deletePBO(GLuint *pbo);
void deleteTexture(GLuint *tex);
//------------------------------
//-------GLFW CALLBACKS---------
//------------------------------
void mainLoop();
void errorCallback(int error, const char *description);
void keyCallback(GLFWwindow *window, int key, int scancode, int action, int mods);
void mouseButtonCallback(GLFWwindow* window, int button, int action, int mods);
void mouseMotionCallback(GLFWwindow* window, double xpos, double ypos);
void mouseWheelCallback(GLFWwindow* window, double xoffset, double yoffset);