source: opengl-game/new-game.cpp@ 5272b6b

feature/imgui-sdl points-test
Last change on this file since 5272b6b was 5272b6b, checked in by Dmitry Portnoy <dmp1488@…>, 7 years ago

Start building a new game from Anton Gerdelan's tutorials

  • Property mode set to 100644
File size: 866 bytes
RevLine 
[5272b6b]1#include <cstdio>
2#include <iostream>
3
4#include <GL/glew.h>
5#include <GLFW/glfw3.h>
6
7using namespace std;
8
9int main(int argc, char* argv[]) {
10 cout << "New OpenGL Game" << endl;
11
12 if (!glfwInit()) {
13 fprintf(stderr, "ERROR: could not start GLFW3\n");
14 return 1;
15 }
16
17 GLFWwindow* window = glfwCreateWindow(640, 480, "Hello Triangle", NULL, NULL);
18 if (!window) {
19 fprintf(stderr, "ERROR: could not open window with GLFW3\n");
20 glfwTerminate();
21 return 1;
22 }
23 glfwMakeContextCurrent (window);
24 glewExperimental = GL_TRUE;
25 glewInit();
26
27 const GLubyte* renderer = glGetString(GL_RENDERER);
28 const GLubyte* version = glGetString(GL_VERSION);
29 printf("Renderer: %s\n", renderer);
30 printf("OpenGL version supported %s\n", version);
31 glEnable(GL_DEPTH_TEST);
32 glDepthFunc(GL_LESS);
33 glfwTerminate();
34 return 0;
35}
Note: See TracBrowser for help on using the repository browser.