Changes in mygame.cpp [1f63bdb:92bc4fe] in opengl-game
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mygame.cpp
r1f63bdb r92bc4fe 1 // Include standard headers 1 2 #include <stdio.h> 2 3 #include <stdlib.h> … … 5 6 using namespace std; 6 7 8 // Include GLEW 7 9 #include <GL/glew.h> 8 10 11 // Include GLFW 9 12 #include <GLFW/glfw3.h> 10 13 GLFWwindow* window; 11 14 15 // Include GLM 12 16 #include <glm/glm.hpp> 13 17 #include <glm/gtc/matrix_transform.hpp> … … 17 21 #include "common/controls.hpp" 18 22 19 int main(int argc, char* argv[]) { 20 if (!glfwInit()) { 21 cerr << "Failed to initialize GLFW" << endl;; 23 int main( void ) 24 { 25 // Initialise GLFW 26 if( !glfwInit() ) 27 { 28 fprintf( stderr, "Failed to initialize GLFW\n" ); 22 29 getchar(); 23 30 return -1; … … 34 41 // Open a window and create its OpenGL context 35 42 window = glfwCreateWindow(mode->width, mode->height, "My Space Game", glfwGetPrimaryMonitor(), NULL); 36 if (window == NULL){37 cerr << "Failed to open GLFW window. If you have an Intel GPU, they are not 3.3 compatible. Try the 2.1 version of the tutorials." << endl;43 if( window == NULL ){ 44 fprintf( stderr, "Failed to open GLFW window. If you have an Intel GPU, they are not 3.3 compatible. Try the 2.1 version of the tutorials.\n" ); 38 45 getchar(); 39 46 glfwTerminate(); … … 46 53 glewExperimental = true; // Needed for core profile 47 54 if (glewInit() != GLEW_OK) { 48 cout << "Failed to initialize GLEW\n" << endl;55 fprintf(stderr, "Failed to initialize GLEW\n"); 49 56 getchar(); 50 57 glfwTerminate(); … … 214 221 do { 215 222 223 // Clear the screen 216 224 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 217 225 226 // Use our shader 218 227 glUseProgram(programID); 219 228 … … 223 232 glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.0f); 224 233 234 // Camera matrix 235 /* 236 glm::mat4 View = glm::lookAt( 237 glm::vec3(4,3,-3), // Camera is at (4,3,-3), in World Space 238 glm::vec3(0,0,0), // and looks at the origin 239 glm::vec3(0,1,0) // Head is up (set to 0,-1,0 to look upside-down) 240 ); 241 */ 225 242 glm::mat4 View = getViewMatrix(); 226 243
Note:
See TracChangeset
for help on using the changeset viewer.