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


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • mygame.cpp

    r92bc4fe r1f63bdb  
    1 // Include standard headers
    21#include <stdio.h>
    32#include <stdlib.h>
     
    65using namespace std;
    76
    8 // Include GLEW
    97#include <GL/glew.h>
    108
    11 // Include GLFW
    129#include <GLFW/glfw3.h>
    1310GLFWwindow* window;
    1411
    15 // Include GLM
    1612#include <glm/glm.hpp>
    1713#include <glm/gtc/matrix_transform.hpp>
     
    2117#include "common/controls.hpp"
    2218
    23 int main( void )
    24 {
    25         // Initialise GLFW
    26         if( !glfwInit() )
    27         {
    28                 fprintf( stderr, "Failed to initialize GLFW\n" );
     19int main(int argc, char* argv[]) {
     20        if (!glfwInit()) {
     21                cerr << "Failed to initialize GLFW" << endl;;
    2922                getchar();
    3023                return -1;
     
    4134  // Open a window and create its OpenGL context
    4235  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;
    4538                getchar();
    4639                glfwTerminate();
     
    5346        glewExperimental = true; // Needed for core profile
    5447        if (glewInit() != GLEW_OK) {
    55                 fprintf(stderr, "Failed to initialize GLEW\n");
     48                cout << "Failed to initialize GLEW\n" << endl;
    5649                getchar();
    5750                glfwTerminate();
     
    221214  do {
    222215
    223     // Clear the screen
    224216    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    225217
    226     // Use our shader
    227218    glUseProgram(programID);
    228219
     
    232223    glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.0f);
    233224
    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     */
    242225    glm::mat4 View = getViewMatrix();
    243226
Note: See TracChangeset for help on using the changeset viewer.