Skip to content

Instantly share code, notes, and snippets.

@MORTAL2000
Last active August 3, 2016 22:08
Show Gist options
  • Save MORTAL2000/7088b100d9e90344c6e94c37cedcaa5a to your computer and use it in GitHub Desktop.
Save MORTAL2000/7088b100d9e90344c6e94c37cedcaa5a to your computer and use it in GitHub Desktop.
#include <SFML/Window.hpp>
#include <GL/glew.h>
#include <iostream>
#include <cassert>
#include <iostream>
#include <stdexcept>
#include <cmath>
void application()
{
sf::ContextSettings settings;
settings.depthBits = 24;
settings.stencilBits = 8;
settings.antialiasingLevel = 4;
settings.majorVersion = 4;
settings.minorVersion = 4;
sf::Window window({ 800, 600 }, "opengl template", sf::Style::Close, settings);
if (glewInit() != GLEW_OK) {
throw std::runtime_error("Failed to initialize GLEW\n");
}
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.display();
}
}
int main()
{
try
{
application();
}
catch (std::runtime_error& e)
{
std::cerr << "Exception: " << e.what() << std::endl;
std::cin.ignore();
return 1;
}
//std::cin.ignore();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment