stb_image and GLFW, texture not loading.

I’ve been trying to get this to work for a while now, there are seemingly no errors in the program but the texture does not load, I have confirmed that the program can access the texture and have checked stbi_failure_reason (which is null), could anyone please help me get the texture to render on the screen, the format of the image I’m trying to load is .png.

Texture.h

#pragma once

#include <string>
#include "stb_image.h"

class Texture {
public:
   Texture(std::string filename);
   ~Texture();
   void Use(int unit);
   private:
   unsigned int handle;
};

Texture.cpp

#include "Texture.h"
#define GLEW_STATIC
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#include "glewinc/glew.h"
#include <glfw3.h>

Texture::Texture(std::string filename) {
	int width, height, components;
	unsigned char* data = stbi_load(filename.c_str(), &width, &height, &components, STBI_rgb_alpha);//STBI_default);
	if(data == nullptr)
		throw(std::string("fail lol"));
	std::string TextFail = stbi_failure_reason();
	glGenTextures(1, &handle);
	glBindTexture(GL_TEXTURE_2D, handle);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
	stbi_image_free(data);
}
Texture::~Texture() { 
   glDeleteTextures(1, &handle);
}
void Texture::Use(int unit) {
	glActiveTexture(unit);
	glBindTexture(GL_TEXTURE_2D, handle);

	//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);	// Set texture wrapping to GL_REPEAT
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
}

Main.cpp

#include <iostream>
#include <ctime>
#include <cmath>
#include <math.h>
#define GLFW_DLL
#define pi 3.14159265
#define GLEW_STATIC
#include "glewinc\glew.h"
#define GLFW_INCLUDE_GLU
#include <glfw3.h>
//#include "stb_image.h"
#include "Texture.h"
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
//#define GLFONTSTASH_IMPLEMENTATION  // Expands implementation
//#include "glfontstash.h"
#include <string>

float gun_angle_1 = 0;

float gun_angle_2 = 0;

float gun_pos_x = 0;
float gun_pos_y = 0;

float gun_pos_x_2 = 0;
float gun_pos_y_2 = 0;

float x = -0.75;
float y = -0.5;

float x2 = 0.75;
float y2 = -0.5;

float bullet_x = gun_pos_x;
float bullet_y = gun_pos_y;

float bullet_x_2 = gun_pos_x_2;
float bullet_y_2 = gun_pos_y_2;

float bullet_v_x = 1;
float bullet_v_y = 1;

float bullet_v_x_2 = 1;
float bullet_v_y_2 = 1;

bool firing_1 = false;

bool firing_2 = false;

float CTime;
float LTime;

float speed = 50;
const float exp_speed = 500;

float terrain_y;
float GeneratedTerrain[11];

float exp_pos_x;
float exp_pos_y;
bool boom = false;
bool boom2 = false;
float exp_v = 5;
float exp_rad = 0;
bool expcont = false;

bool P1Turn = true;

bool tank1 = true;
bool tank2 = true;

float turretxpos1 = 0;
float turretypos1 = 0;

float turretxvel1 = 0;
float turretyvel1 = 0;

float turretxpos2 = 0;
float turretypos2 = 0;

float turretxvel2= 0;
float turretyvel2 = 0;

float exp_pos_x_t = 0;
float exp_pos_y_t = 0;

char mode = 'a';
// a = angle changes, b = innitial velocity changes
int stepper = 0;

float b_x_array[500];
float v_y_array[500];

std::string P1Name = " ";
std::string P2Name = " ";

int P1Shots;
int P2Shots;

bool changes = false;

static void error_callback(int error, const char* description)
{
    fputs(description, stderr);
}
float Noise1(int x) //noise start
{
	x = (x << 13) ^ x;
	return ( 1.0 - ( (x * (x * x * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0);
}
float SmoothedNoise_1(float x)
{
	return Noise1(x)/2  +  Noise1(x-1)/4  +  Noise1(x+1)/4;
}
float Cosine_Interpolate(float v1, float v2, float fractional_X)
{
	float ft = fractional_X * 3.14159265;
	float f = (1 - cos(ft)) * 0.5;

	return v1*(1-f) + v2*f;
}
float InterpolatedNoise_1(float x)
{
	int integer_X = floor(x);
	float fractional_X = x - integer_X;
	float v1 = SmoothedNoise_1(integer_X);
	float v2 = SmoothedNoise_1(integer_X + 1);

	return (Cosine_Interpolate(v1, v2, fractional_X));
}
float PerlinNoise_1D(float x)
{
	float total = 0;
	float p = 0.1;
	float n = (rand() % 100);
	
	for(int i = 0; i <= n; i++)
	{
		float frequency = pow((double)2,i);
		float amplitude = pow((double)p,i);

		total = total + InterpolatedNoise_1(x * frequency) * amplitude;
	}
	//std::cout << mode << ", " << speed << std::endl;
	return(total);
} //noise end
void CMDPrint(void)
{
	system("cls");
	if (P1Turn)
	{
		std::cout << "It is " << P1Name << "'s turn." << std::endl;
	}
	else
		std::cout << "It is " << P2Name << "'s turn." << std::endl;

	std::cout << "Horizontal distance " << (x2 - x)*100 << " metres." << std::endl;
	if (y > y2)
	{
		std::cout << "Vertical distance " << ((y - y2)*100) /(16/9) << " metres." << std::endl;
	}
	if (y < y2)
	{
		std::cout << "Vertical distance " << ((y2 - y)*100) /(16/9) << " metres." << std::endl;
	}
	if (P1Turn)
	{
		std::cout << "Angle " << gun_angle_1 * (180/pi) << std::endl;
	}
	else
		std::cout << "Angle " << 180 - (gun_angle_2 * (180/pi)) << std::endl;
	std::cout << "Speed " << speed << " metres per second." << std::endl;
}
/*void renderfps(int framerate) 
{ 
    currentTime = glfwGetTime(); 

    if(currentTime - lastTime >= 1.0 / framerate) 
    {
        lastTime = currentTime;
    }
}*/
/*GLuint LoadTexture(const char* TextureName)

{

   GLuint Texture;  //variable for texture

   glGenTextures(1,&Texture); //allocate the memory for texture

   glBindTexture(GL_TEXTURE_2D,Texture); //Binding the texture


   if(glfwLoadTexture2D(TextureName, GLFW_BUILD_MIPMAPS_BIT)){

      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

      glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);

      return Texture;

   }else return -1;

}*/
float shooting_1()
{
	//CTime = glfwGetTime();
	//float DTime = CTime - LTime;
	//LTime = CTime;
	if (P1Turn == true)
	{
		bullet_v_x = (speed/100.f) * cos(gun_angle_1);
		bullet_v_y = (speed/100.f) * sin(gun_angle_1) * 16/9;
		return(0);
	}
}
float shooting_2()
{
	if (P1Turn == false)
	{
		bullet_v_x = (speed/100.f) * cos(gun_angle_2);
		bullet_v_y = (speed/100.f) * sin(gun_angle_2) * 16/9;
		return(0);
	}
}
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
    if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
        glfwSetWindowShouldClose(window, GL_TRUE);

	if (action == GLFW_PRESS || action == GLFW_REPEAT)
	{
		if (tank1 == 1 && tank2 == 1)
		{
			if (key == GLFW_KEY_W) //up arrow
			{
				if (gun_angle_1 <= pi && P1Turn == true)
				{
					if (mode == 'a')
					{
						gun_angle_1 += pi / 360;
					}
					if (mode == 'p')
					{
						speed = speed + 0.1;
					}
				/*std::cout << "Angle " << gun_angle_1 * (180/pi) << std::endl;
				std::cout << "Speed " << speed << " metres per second." << std::endl;*/
					changes = true;
				}
				if (gun_angle_2 <= pi && P1Turn == false)
				{
					if (mode == 'a')
					{
						gun_angle_2 += pi / 360;
					}
					if (mode == 'p')
					{
						speed = speed + 0.1;
					}
				/*std::cout << "Angle " << 180 - (gun_angle_2 * (180/pi)) << std::endl;
				std::cout << "Speed " << speed << " metres per second." << std::endl;*/
					changes = true;
				}
			}
			else if (key == GLFW_KEY_A) //left arrow
			{
				if (x > -0.9 && P1Turn == true) 
				{
					if (x>0 && x < 0.01)
					{ 
						x = 0;
					}
					else
					{
						x = x - 0.003;
					}
				}

				if (x2 > -0.9 && P1Turn == false) 
				{
					if (x2>0 && x2 < 0.01)
					{ 
						x2 = 0;
					}
					else
					{
						x2 = x2 - 0.003;
					}
				}
				/*std::cout << "Horizontal distance " << (x2 - x)*100 << " metres." << std::endl;
				if (y > y2)
				{
					std::cout << "Vertical distance " << ((y - y2)*100) /(16/9) << " metres." << std::endl;
				}
				if (y < y2)
				{
					std::cout << "Vertical distance " << ((y2 - y)*100) /(16/9) << " metres." << std::endl;
				}*/
				changes = true;
			}
			else if (key == GLFW_KEY_D) //right
			{
				if (x < 0.9 && P1Turn == true)
				{
					if (x<0 && x > -0.01)
					{ 
						x = 0;
					}
					else
					{
						x = x + 0.003;
					}
				}

				if (x2 < 0.9 && P1Turn == false)
				{
					if (x2<0 && x2 > -0.01)
					{ 
						x2 = 0;
					}
					else
					{
						x2 = x2 + 0.003;
					}
				}
				/*std::cout << "Horizontal distance " << (x2 - x)*100 << " metres." << std::endl;
				if (y > y2)
				{
					std::cout << "Vertical distance " << ((y - y2)*100) /(16/9) << " metres." << std::endl;
				}
				if (y < y2)
				{
					std::cout << "Vertical distance " << ((y2 - y)*100) /(16/9) << " metres." << std::endl;
				}*/
				changes = true;
			}	
			else if (key == GLFW_KEY_S) //down
			{
				if (gun_angle_1 >= 0 && P1Turn == true)
				{
					if (mode == 'a')
					{
						gun_angle_1 -= pi / 360;
					}
					if (mode == 'p')
					{
						speed = speed - 0.1;
					}
				/*std::cout << "Angle " << gun_angle_1 * (180/pi) << std::endl;
				std::cout << "Speed " << speed << " metres per second." << std::endl;*/
					changes = true;
				}
				if (gun_angle_2 >= 0 && P1Turn == false)
				{
					if (mode == 'a')
					{
						gun_angle_2 -= pi / 360;
					}
					if (mode == 'p')
					{
						speed = speed - 0.1;
					}
				/*std::cout << "Angle " << gun_angle_2 * (180/pi) << std::endl;
				std::cout << "Speed " << speed << " metres per second." << std::endl;*/
					changes = true;
				}
			}
		
			else if (key == GLFW_KEY_SPACE)
			{
				if (P1Turn == true)
				{
					bullet_x = gun_pos_x + 0.07;
					bullet_y = gun_pos_y + 0.065;
					bullet_v_x = 0;
					bullet_v_y = 0;
					firing_1 = true;
					P1Shots+= 1;
					shooting_1();
				}
				if (P1Turn == false)
				{
					bullet_x = gun_pos_x_2 + 0.07;
					bullet_y = gun_pos_y_2 + 0.065;
					bullet_v_x = 0;
					bullet_v_y = 0;
					firing_2 = true;
					P2Shots += 1;
					shooting_2();
				}
				P1Turn = !P1Turn;

				changes = true;

				/*if (P1Turn)
				{
					std::cout << "It is " << P1Name << "'s turn." << std::endl;
					std::cout << "Horizontal distance " << (x2 - x)*100 << " metres." << std::endl;
					if (y > y2)
					{
						std::cout << "Vertical distance " << ((y - y2)*100) /(16/9) << " metres." << std::endl;
					}
					if (y < y2)
					{
						std::cout << "Vertical distance " << ((y2 - y)*100) /(16/9) << " metres." << std::endl;
					}
				}
				if (!P1Turn)
				{
					std::cout << "It is " << P2Name << "'s turn." << std::endl;
					std::cout << "Horizontal distance " << (x2 - x)*100 << " metres." << std::endl;
					if (y > y2)
					{
						std::cout << "Vertical distance " << ((y - y2)*100) /(16/9) << " metres." << std::endl;
					}
					if (y < y2)
					{
						std::cout << "Vertical distance " << ((y2 - y)*100) /(16/9) << " metres." << std::endl;
					}

				}*/
			}
		}

		if (key == GLFW_KEY_R)
		{
			for (int i = 0; i < 11; i++) //saving noise to array
			{
				GeneratedTerrain[i] = (0.2 * PerlinNoise_1D(rand()));
				x = -0.75;
				x2 = 0.75;
			}
			tank1 = true;
			tank2 = true;
		}
	}
	
}
#undef main
int main(void)
{
	std::srand(std::time(0));
    GLFWwindow* window;
    glfwSetErrorCallback(error_callback);
    if (!glfwInit())
        exit(EXIT_FAILURE);
    window = glfwCreateWindow(1600, 900, "Physics Tanks", NULL, NULL);
    if (!window)
    {
        glfwTerminate();
        exit(EXIT_FAILURE);
    }
    glfwMakeContextCurrent(window);
    glfwSetKeyCallback(window, key_callback);
	glewExperimental = GL_TRUE;
	GLenum err = glewInit();
	if( err != GLEW_OK )
	{
		printf("GlewInit error");
		exit(1);
	}
	for (int i = 0; i < 11; i++) //saving noise to array
	{
		GeneratedTerrain[i] = (0.2* PerlinNoise_1D(rand()));
	}

	if (P1Name == " ")
	{
		int NameEnter();

		system("cd");

		std::cout << "Enter your name: ";

		if (!std::getline(std::cin, P1Name))
		{ 
			/* I/O error! */ return -1;
		}

		if (!P1Name.empty())
		{
			std::cout << "Thank you, '" << P1Name << "', you can now do tank things." << std::endl;
		}
		else
		{
			std::cout << "That wasn't a name." << std::endl;
		}

	}
	if (P2Name == " ")
	{
		int Name2Enter();

		std::cout << "Enter your name: ";

		if (!std::getline(std::cin, P2Name))
		{ 
			/* I/O error! */ return -1;
		}

		if (!P2Name.empty())
		{
			std::cout << "Thank you, '" << P2Name << "', you can now do tank things." << std::endl;
		}
		else
		{
			std::cout << "That wasn't a name." << std::endl;
		}
	}

	Texture bitmapFont("TestImg.png");

    while (!glfwWindowShouldClose(window)) //render loop
    {
		if (changes)
		{
			system("cls");
			if (P1Turn)
			{
				std::cout << "It is " << P1Name << "'s turn." << std::endl;
			}
			else
				std::cout << "It is " << P2Name << "'s turn." << std::endl;

			std::cout << "Horizontal distance " << (x2 - x)*100 << " metres." << std::endl;
			if (y > y2)
			{
				std::cout << "Vertical distance " << ((y - y2)*100) /(16/9) << " metres." << std::endl;
			}
			if (y < y2)
			{
				std::cout << "Vertical distance " << ((y2 - y)*100) /(16/9) << " metres." << std::endl;
			}
			if (P1Turn)
			{
				std::cout << "Angle " << gun_angle_1 * (180/pi) << std::endl;
			}
			else
				std::cout << "Angle " << 180 - (gun_angle_2 * (180/pi)) << std::endl;
			std::cout << "Speed " << speed << " metres per second." << std::endl;
			changes = false;
		}
		if (stepper >= 75)
		{

		}
		else stepper ++;

		//glRotatef((float) glfwGetTime() * 50.f, 0.f, 0.f, 1.f);
		// Moved your shit
		CTime = glfwGetTime();
		if (LTime < 0)
			LTime = CTime;
		float DTime = CTime - LTime;
		LTime = CTime;

		glBegin(GL_QUADS); //background
		glColor3f(0.196078f, 0.6f, 0.8f);
		glVertex3f(-1.f,-1.f,0.f);
		glColor3f(0.196078f, 0.6f, 0.8f);
		glVertex3f(-1.f,1.f,0.f);
		glColor3f(1.f, 0.5f, 0.f);
		glVertex3f(1.f,1.f,0.f);
		glColor3f(0.196078f, 0.6f, 0.8f);
		glVertex3f(1.f,-1.f,0.f);
		glEnd();
		float lastNoise = GeneratedTerrain[0] -0.5;
		for(int i = 0; i < 10; i++) //terrain generation
		{
			glBegin(GL_QUADS);
			glColor3f(0.f,0.2f,0.f);
			glVertex3f(i * 0.2 - 1,-1.f,0.f);
			glColor3f(0.f,0.4f,0.f);
			glVertex3f(i * 0.2 - 1, lastNoise, 0.f);
			glVertex3f(i * 0.2 - 1 + 0.2, lastNoise = (GeneratedTerrain[i + 1]) -0.5, 0.f);
			glColor3f(0.f,0.2f,0.f);
			glVertex3f(i * 0.2 - 1 + 0.2,-1.f,0.f);
			glEnd();
		}
		//y = ((GeneratedTerrain[(int)ceil(((x+1)/2)*10)] - GeneratedTerrain[(int)ceil(((x+1)/2)*10)-1]) / 0.2)   -0.5;
		int index = (int)ceil(((x+1)/2)*10);
		int index2 = (int)ceil(((x2+1)/2)*10);
		float grad = (GeneratedTerrain[index] - GeneratedTerrain[index-1]) / 0.2;
		float grad2 = (GeneratedTerrain[index2] - GeneratedTerrain[index2-1]) / 0.2;
		float xDelta = std::fmod((float)x, (float)0.2);
		float xDelta2 = std::fmod((float)x2, (float)0.2);
		if (xDelta < 0.000001 && xDelta > 0.000001) 
		{
			xDelta=0;
		}
		if (xDelta2 < 0.000001 && xDelta2 > 0.000001) 
		{
			xDelta2=0;
		}
		int b_index = (int)ceil(((bullet_x+1)/2)*10);
		float b_grad = (GeneratedTerrain[b_index] - GeneratedTerrain[b_index-1]) / 0.2;
		float b_xDelta = std::fmod((float)bullet_x, (float)0.2);
		if (b_xDelta < 0.000001 && b_xDelta > 0.000001) 
		{
			b_xDelta=0;
		}


		if (x < 0)	//Set height start
		{
			y = (grad * (xDelta)) + GeneratedTerrain[(int)ceil(((x + 1) / 2) * 10)]- 0.525;
		}
		if ((x > 0) && (x != 0.2f))
		{
			y = (grad * (xDelta)) + GeneratedTerrain[(int)ceil(((x + 1) / 2) * 10) - 1]- 0.525;
		}
		if (x == 0)
		{
			y = GeneratedTerrain[(int)ceil(((x + 1) / 2) * 10)]- 0.525;
		}
		if (x < 0.21 && x > 0.19){
			y = GeneratedTerrain[(int)ceil(((x + 1) / 2) * 10)] -0.525;
		}	//Set height end


		if (x2 < 0)	//Set height start 2
		{
			y2 = (grad2 * (xDelta2)) + GeneratedTerrain[(int)ceil(((x2 + 1) / 2) * 10)]- 0.525;
		}
		if ((x2 > 0) && (x2 != 0.2f))
		{
			y2 = (grad2 * (xDelta2)) + GeneratedTerrain[(int)ceil(((x2 + 1) / 2) * 10) - 1]- 0.525;
		}
		if (x2 == 0)
		{
			y2 = GeneratedTerrain[(int)ceil(((x2 + 1) / 2) * 10)]- 0.525;
		}
		if (x2 < 0.21 && x2 > 0.19){
			y2 = GeneratedTerrain[(int)ceil(((x2 + 1) / 2) * 10)] -0.525;
		}	//Set height end 2


		if (firing_1 == true || firing_2 == true); //Fire
		{
			if ((bullet_x < x + 0.04 && bullet_x > x - 0.05) && (bullet_y < y + 0.05))
			{
				exp_pos_x = bullet_x;
				exp_pos_y = bullet_y;
					
				bullet_v_x = 0;
				bullet_v_y = 0;
				firing_1 = false;
				firing_2 = false;
				boom = true;
				std::cout << P2Name << " wins, and missed " << P2Shots - 1 << " times." << std::endl;
				tank1 = false;
			}

			else if ((bullet_x > x2 - 0.04 && bullet_x < x2 + 0.05) && (bullet_y < y2 + 0.05))
			{
				exp_pos_x = bullet_x;
				exp_pos_y = bullet_y;
					
				bullet_v_x = 0;
				bullet_v_y = 0;
				firing_1 = false;
				firing_2 = false;
				boom = true;
				std::cout << P1Name << " wins, and missed " << P1Shots - 1 << " times." << std::endl;
				tank2 = false;
			}
			else if (bullet_x < -1 || bullet_x > 1)
			{
				bullet_x = -2;
				bullet_y = -2;
				bullet_v_x = 0;
				bullet_v_y = 0;
				firing_1 = false;
				firing_2 = false;
			}
			else if (bullet_x < 0)	//Remove bullet start
			{
				terrain_y = (b_grad * (b_xDelta)) + GeneratedTerrain[(int)ceil(((bullet_x + 1) / 2) * 10)]- 0.5;
				if (bullet_y < terrain_y)
				{
					exp_pos_x = bullet_x;
					exp_pos_y = bullet_y;
					
					bullet_v_x = 0;
					bullet_v_y = 0;
					firing_1 = false;
					firing_2 = false;
					boom = true;
				}
			}
			else if ((bullet_x > 0) && (bullet_x != 0.2f))
			{
				terrain_y = (b_grad * (b_xDelta)) + GeneratedTerrain[(int)ceil(((bullet_x + 1) / 2) * 10) - 1]- 0.5;
				if (bullet_y < terrain_y)
				{
					exp_pos_x = bullet_x;
					exp_pos_y = bullet_y;
					
					bullet_v_x = 0;
					bullet_v_y = 0;
					firing_1 = false;
					firing_2 = false;
					boom = true;
				}
			}
			else if (bullet_x == 0)
			{
				terrain_y = GeneratedTerrain[(int)ceil(((bullet_x + 1) / 2) * 10)]- 0.5;
				if (bullet_y < terrain_y)
				{
					exp_pos_x = bullet_x;
					exp_pos_y = bullet_y;
					
					bullet_v_x = 0;
					bullet_v_y = 0;
					firing_1 = false;
					firing_2 = false;
					boom = true;
				}
			}
			else if (bullet_x <= 0.21 && bullet_x >= 0.19)
			{
				terrain_y = GeneratedTerrain[(int)ceil(((bullet_x + 1) / 2) * 10)] -0.5;
				if (bullet_y < terrain_y)
				{
					exp_pos_x = bullet_x;
					exp_pos_y = bullet_y;
					
					bullet_v_x = 0;
					bullet_v_y = 0;
					firing_1 = false;
					firing_2 = false;
					boom = true;
				}
			}	//remove bullet end
		}

		int line_width = 5; //tanks start

		glLineWidth((GLfloat)line_width);
		
		if (tank1 == true)
		{
			glBegin(GL_LINES); //gun 
			glColor3f(0.f,0.f,0.f);
			glVertex2f(x,y + 0.065);
			glVertex2f(0.07 + gun_pos_x,0.065 + gun_pos_y);
			glLineWidth(10.f);
			glEnd();

			glBegin(GL_QUADS); //turret
			glColor3f( 0.f,0.f,1.f);
			glVertex2f(x - 0.02,y + 0.05);
			glVertex2f(x - 0.015,y + 0.08);
			glVertex2f(x + 0.01,y + 0.08);
			glVertex2f(x + 0.02,y + 0.05);
			glEnd();

			turretxpos1 = x;
			turretypos1 = y;

			turretxvel1 = (rand() % 20 - 10) / 100.f;
			turretyvel1 = (rand() % 25 + 25) / 100.f;
		}
		else
		{
			glBegin(GL_QUADS); //Deadturret1
			glColor3f( 0.f,0.f,1.f);
			glVertex2f(turretxpos1 - 0.02,turretypos1 + 0.05);
			glVertex2f(turretxpos1 - 0.015,turretypos1 + 0.08);
			glVertex2f(turretxpos1 + 0.01,turretypos1 + 0.08);
			glVertex2f(turretxpos1 + 0.02,turretypos1 + 0.05);
			glEnd();
			boom2 = true;
		}

		glBegin(GL_QUADS); //chassis
		glColor3f( 0.f,0.f,1.f);
		glVertex2f(x - 0.05,y + 0.05);
		glVertex2f(x + 0.04,y + 0.05);
		glVertex2f(x + 0.05,y + 0.01);
		glVertex2f(x - 0.045,y + 0.01);
		glEnd();

		glBegin(GL_QUADS); //tracks
		glColor3f(0.f,0.f,0.f);
		glVertex2f(x - 0.035,y + 0);
		glVertex2f(x + 0.035,y + 0);
		glVertex2f(x + 0.045,y + 0.0175);
		glVertex2f(x - 0.045,y + 0.0175);
		glEnd();
		glBegin(GL_QUADS);
		glColor3f(0.f,0.f,0.f);
		glVertex2f(x - 0.045,y + 0.0175);
		glVertex2f(x + 0.045,y + 0.0175);
		glVertex2f(x + 0.035,y + 0.035);
		glVertex2f(x - 0.035,y + 0.035);
		glEnd();
		
		if (tank2 == true) //tank2 start
		{
			glBegin(GL_LINES); //gun2 
			glColor3f(0.f,0.f,0.f);
			glVertex2f(x2,y2 + 0.065);
			glVertex2f(0.07 + gun_pos_x_2,0.065 + gun_pos_y_2);
			glLineWidth(10.f);
			glEnd();
			
			glBegin(GL_QUADS); //turret2
			glColor3f( 1.f,0.5f,0.f);
			glVertex2f(x2 + 0.02,y2 + 0.05);
			glVertex2f(x2 + 0.015,y2 + 0.08);
			glVertex2f(x2 - 0.01,y2 + 0.08);
			glVertex2f(x2 - 0.02,y2 + 0.05);
			glEnd();

			turretxpos2 = x2;
			turretypos2 = y2;

			turretxvel2 = (rand() % 20 - 10) / 100.f;
			turretyvel2 = (rand() % 25 + 25) / 100.f;
		}
		else
		{
			glBegin(GL_QUADS); //Deadturret2
			glColor3f( 1.f,0.5f,0.f);
			glVertex2f(turretxpos2 + 0.02,turretypos2 + 0.05);
			glVertex2f(turretxpos2 + 0.015,turretypos2 + 0.08);
			glVertex2f(turretxpos2 - 0.01,turretypos2 + 0.08);
			glVertex2f(turretxpos2 - 0.02,turretypos2 + 0.05);
			glEnd();
			boom2 = true;
		}

		glBegin(GL_QUADS); //chassis2
		glColor3f( 1.f,0.5f,0.f);
		glVertex2f(x2 + 0.05,y2 + 0.05);
		glVertex2f(x2 - 0.04,y2 + 0.05);
		glVertex2f(x2 - 0.05,y2 + 0.01);
		glVertex2f(x2 + 0.045,y2 + 0.01);
		glEnd();

		glBegin(GL_QUADS); //tracks2
		glColor3f(0.f,0.f,0.f);
		glVertex2f(x2 + 0.035,y2 + 0);
		glVertex2f(x2 - 0.035,y2 + 0);
		glVertex2f(x2 - 0.045,y2 + 0.0175);
		glVertex2f(x2 + 0.045,y2 + 0.0175);
		glEnd();
		glBegin(GL_QUADS);
		glColor3f(0.f,0.f,0.f);
		glVertex2f(x2 + 0.045,y2 + 0.0175);
		glVertex2f(x2 - 0.045,y2 + 0.0175);
		glVertex2f(x2 - 0.035,y2 + 0.035);
		glVertex2f(x2 + 0.035,y2 + 0.035);
		glEnd();

		if (firing_1 == true || firing_2 == true)
		{
			glBegin(GL_QUADS); //bullet
			glVertex2f(bullet_x - 0.005,bullet_y + 0.005 * 16/9);
			glVertex2f(bullet_x + 0.005,bullet_y + 0.005 * 16/9);
			glVertex2f(bullet_x + 0.005,bullet_y - 0.005 * 16/9);
			glVertex2f(bullet_x - 0.005,bullet_y - 0.005 * 16/9);
			glEnd();
		}
		else
			boom == true;

		gun_pos_y = y + 0.07 * sin(gun_angle_1) * 16/9; //y axis
		gun_pos_x = x + 0.07 * cos(gun_angle_1) - 0.07; //x axis

		gun_pos_y_2 = y2 + 0.07 * sin(gun_angle_2) * 16/9; //y axis
		gun_pos_x_2 = x2 + 0.07 * cos(gun_angle_2) - 0.07; //x axis

		glEnable(GL_TEXTURE_2D);
		bitmapFont.Use(0);

		//FontRendering
		glBegin (GL_QUADS);
		glTexCoord2f (0.0, 0.0);
		glVertex3f (0.0, 0.0, 0.0);
		glTexCoord2f (1.0, 0.0);
		glVertex3f (1.0, 0.0, 0.0);
		glTexCoord2f (1.0, 1.0);
		glVertex3f (1.0, 1.0, 0.0);
		glTexCoord2f (0.0, 1.0);
		glVertex3f (0.0, 1.0, 0.0);
		glEnd();

		glDisable(GL_TEXTURE_2D);

		if (boom == true )//&& firing_1 == false)
		{
			glBegin(GL_POLYGON); //boom
			glColor3f(1.f, 0.568f, 0);
			glVertex2f(exp_pos_x - exp_rad,exp_pos_y + exp_rad * 16/9);
			glVertex2f(exp_pos_x + exp_rad,exp_pos_y + exp_rad * 16/9);
			glVertex2f(exp_pos_x + exp_rad,exp_pos_y - exp_rad * 16/9);
			glVertex2f(exp_pos_x - exp_rad,exp_pos_y - exp_rad * 16/9);
			glEnd();
		}

        glfwSwapBuffers(window);
        glfwPollEvents();

		if (firing_1 == true || firing_2 == true)
		{
			bullet_x = bullet_x + (DTime * bullet_v_x);
			bullet_y = bullet_y + (DTime * bullet_v_y); //- 0.5 * (((2*9.81)/200)/2);
			bullet_v_y -= DTime * (9.81/100) * 16/9;
		}
		if (boom == true && exp_rad <= 0.05 && exp_rad >= 0 && expcont == false) //expand
		{
			exp_rad = exp_rad + ((DTime * exp_v)/10.f);
		}
		if(boom == true && exp_rad >= 0.05 && exp_rad >= 0)
		{
			expcont = true;
		}
		if(expcont == true) //contract 
		{
			exp_rad = exp_rad + ((-1 * DTime * exp_v)/10.f);
		}
		if(boom == true && exp_rad < 0) //remove
		{
			bullet_y = 1;
			boom = false;
			exp_rad = 0;
			expcont = false;
		}
		if (tank2 == false);
		{
			exp_pos_x_t = x;
			exp_pos_y_t = y + 0.05;

			turretxpos2 = turretxpos2 + (DTime * turretxvel2);
			turretypos2 = turretypos2 + (DTime * turretyvel2);
			turretyvel2 -= DTime * (9.81/100) * 16/9;
		}
		if (tank1 == false);
		{
			exp_pos_x_t = x2;
			exp_pos_y_t = y2 + 0.05;

			turretxpos1 = turretxpos1 + (DTime * turretxvel1);
			turretypos1 = turretypos1 + (DTime * turretyvel1);
			turretyvel1 -= DTime * (9.81/100) * 16/9;
		}

		if (exp_rad > 0.05)
		{
			boom = false;
		}
    }

    glfwDestroyWindow(window);
    glfwTerminate();
    exit(EXIT_SUCCESS);
}