POSITIVE-MENTAL-ATTITUDE 8 years ago
parent
commit
5e13641609
2 changed files with 14 additions and 15 deletions
  1. 1 0
      src/Context.hpp
  2. 13 15
      src/Triangles.cpp

+ 1 - 0
src/Context.hpp

@@ -31,6 +31,7 @@ struct Context
 	bool needsUpdate;
 	bool needsUpdate;
 	bool running;
 	bool running;
 	bool nevermore;
 	bool nevermore;
+	bool mustRecreate;
 	
 	
 	Assets* assets;
 	Assets* assets;
 	TrianglesWindow* window;
 	TrianglesWindow* window;

+ 13 - 15
src/Triangles.cpp

@@ -16,15 +16,14 @@
  */
  */
 
 
 #include <sstream>
 #include <sstream>
-#ifdef __linux__
 #include <thread>
 #include <thread>
-#endif
 #include <fstream>
 #include <fstream>
 #include <iomanip>
 #include <iomanip>
 #include "Triangles.hpp"
 #include "Triangles.hpp"
 #include "IngameState.hpp"
 #include "IngameState.hpp"
 #include "MenuState.hpp"
 #include "MenuState.hpp"
 #include "Utility.hpp"
 #include "Utility.hpp"
+#include <GL/gl.h>
 
 
 Triangles::Triangles(int argc, char** argv):
 Triangles::Triangles(int argc, char** argv):
 	_returnCode(0),
 	_returnCode(0),
@@ -43,11 +42,18 @@ Triangles::Triangles(int argc, char** argv):
 	_variables.assets = &_assets;
 	_variables.assets = &_assets;
 	_variables.core = this;
 	_variables.core = this;
 	_variables.foreground = nullptr;
 	_variables.foreground = nullptr;
+	/**
+	 * Shintel has bugs, so we detect if the graphics card is shintel iGPU.
+	 */
+	if(glGetString(GL_VENDOR)[0] == (unsigned char)'I')
+		_variables.mustRecreate = true;
+	else
+		_variables.mustRecreate = false;
 	
 	
 	passArguments(argc, argv);
 	passArguments(argc, argv);
 	
 	
 	if(_variables.running)
 	if(_variables.running)
-	{
+	{ 
 		init();
 		init();
 		refresh();
 		refresh();
 		load(_initialState);
 		load(_initialState);
@@ -260,27 +266,19 @@ void Triangles::load(int stateType)
 	_window.lockFramerate(true);
 	_window.lockFramerate(true);
 	_window.setActive(false);
 	_window.setActive(false);
 
 
-	#ifdef __linux__
 	std::thread t1(&Triangles::loadingRender, this);
 	std::thread t1(&Triangles::loadingRender, this);
 	std::thread t2(&State::init, _current);
 	std::thread t2(&State::init, _current);
 	
 	
 	t1.join();
 	t1.join();
 	t2.join();
 	t2.join();
-	#else 
-	sf::Thread t1(&Triangles::loadingRender, this);
-	sf::Thread t2(&State::init, _current);
-
-	t1.launch();
-	t2.launch();
-
-	t1.wait();
-	t2.wait();
-	#endif
 	
 	
 	_window.lockFramerate(false);
 	_window.lockFramerate(false);
 	
 	
 	_current->refresh();
 	_current->refresh();
 
 
+	if(_variables.mustRecreate)
+		_window.recreate();
+
 	Echo::debug("Done.");
 	Echo::debug("Done.");
 }
 }
 
 
@@ -291,7 +289,7 @@ int Triangles::run()
 	
 	
 	if(_context.running)
 	if(_context.running)
 	{
 	{
-		Echo::out(Echo::Empty, "Triangles version 0.0.5");
+		Echo::out(Echo::Empty, "Triangles version 0.0.6");
 		Echo::out(Echo::Empty, "Copyright (C) 2016 POSITIVE MENTAL ATTITUDE");
 		Echo::out(Echo::Empty, "Copyright (C) 2016 POSITIVE MENTAL ATTITUDE");
 		Echo::out(Echo::Empty, "This program comes with ABSOLUTELY NO WARRANTY;");
 		Echo::out(Echo::Empty, "This program comes with ABSOLUTELY NO WARRANTY;");
 		Echo::out(Echo::Empty, "This is free software, and you are welcome to redistribute it");
 		Echo::out(Echo::Empty, "This is free software, and you are welcome to redistribute it");