Changeset 1f63bdb in opengl-game for mygame.cpp
- Timestamp:
- Jun 30, 2017, 3:14:17 PM (7 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- 11a48af
- Parents:
- 4813066
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mygame.cpp
r4813066 r1f63bdb 1 // Include standard headers2 1 #include <stdio.h> 3 2 #include <stdlib.h> … … 6 5 using namespace std; 7 6 8 // Include GLEW9 7 #include <GL/glew.h> 10 8 11 // Include GLFW12 9 #include <GLFW/glfw3.h> 13 10 GLFWwindow* window; 14 11 15 // Include GLM16 12 #include <glm/glm.hpp> 17 13 #include <glm/gtc/matrix_transform.hpp> … … 21 17 #include "common/controls.hpp" 22 18 23 int main( void ) 24 { 25 // Initialise GLFW 26 if( !glfwInit() ) 27 { 28 fprintf( stderr, "Failed to initialize GLFW\n" ); 19 int main(int argc, char* argv[]) { 20 if (!glfwInit()) { 21 cerr << "Failed to initialize GLFW" << endl;; 29 22 getchar(); 30 23 return -1; … … 41 34 // Open a window and create its OpenGL context 42 35 window = glfwCreateWindow(mode->width, mode->height, "My Space Game", glfwGetPrimaryMonitor(), NULL); 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" );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; 45 38 getchar(); 46 39 glfwTerminate(); … … 53 46 glewExperimental = true; // Needed for core profile 54 47 if (glewInit() != GLEW_OK) { 55 fprintf(stderr, "Failed to initialize GLEW\n");48 cout << "Failed to initialize GLEW\n" << endl; 56 49 getchar(); 57 50 glfwTerminate(); … … 221 214 do { 222 215 223 // Clear the screen224 216 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 225 217 226 // Use our shader227 218 glUseProgram(programID); 228 219 … … 232 223 glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.0f); 233 224 234 // Camera matrix235 /*236 glm::mat4 View = glm::lookAt(237 glm::vec3(4,3,-3), // Camera is at (4,3,-3), in World Space238 glm::vec3(0,0,0), // and looks at the origin239 glm::vec3(0,1,0) // Head is up (set to 0,-1,0 to look upside-down)240 );241 */242 225 glm::mat4 View = getViewMatrix(); 243 226
Note:
See TracChangeset
for help on using the changeset viewer.