Changes in mygame.cpp [1f63bdb:92bc4fe] in opengl-game


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • mygame.cpp

    r1f63bdb r92bc4fe  
     1// Include standard headers
    12#include <stdio.h>
    23#include <stdlib.h>
     
    56using namespace std;
    67
     8// Include GLEW
    79#include <GL/glew.h>
    810
     11// Include GLFW
    912#include <GLFW/glfw3.h>
    1013GLFWwindow* window;
    1114
     15// Include GLM
    1216#include <glm/glm.hpp>
    1317#include <glm/gtc/matrix_transform.hpp>
     
    1721#include "common/controls.hpp"
    1822
    19 int main(int argc, char* argv[]) {
    20         if (!glfwInit()) {
    21                 cerr << "Failed to initialize GLFW" << endl;;
     23int main( void )
     24{
     25        // Initialise GLFW
     26        if( !glfwInit() )
     27        {
     28                fprintf( stderr, "Failed to initialize GLFW\n" );
    2229                getchar();
    2330                return -1;
     
    3441  // Open a window and create its OpenGL context
    3542  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" );
    3845                getchar();
    3946                glfwTerminate();
     
    4653        glewExperimental = true; // Needed for core profile
    4754        if (glewInit() != GLEW_OK) {
    48                 cout << "Failed to initialize GLEW\n" << endl;
     55                fprintf(stderr, "Failed to initialize GLEW\n");
    4956                getchar();
    5057                glfwTerminate();
     
    214221  do {
    215222
     223    // Clear the screen
    216224    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    217225
     226    // Use our shader
    218227    glUseProgram(programID);
    219228
     
    223232    glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.0f);
    224233
     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    */
    225242    glm::mat4 View = getViewMatrix();
    226243
Note: See TracChangeset for help on using the changeset viewer.