Jump to content
  • Advertisement
MarcusAseth

GLFW/GLAD/OpenGL failing to start

Recommended Posts

Hi guys, noob question, I wanted to try and follow this tutorial https://learnopengl.com/Getting-started/Hello-Window, I've followed all the previous steps and I got this:

#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <iostream>

int main()
{
	glfwInit();
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
	glfwWindowHint(GLFW_VERSION_MINOR, 3);
	//glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

	GLFWwindow* window = glfwCreateWindow(800, 600, "LearnOpenGL", NULL, NULL);
	if (window == NULL)
	{
		std::cout << "Failed to create window" << std::endl;
		glfwTerminate();
	}

	return 0;
}

Which succesfully creates the window, but as soon as I uncomment the line

glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);


the build still succed, but the window creation fails (window variable is NULL)...
I followed all the steps so I am scratching my head on what could be wrong...help ^_^'

Edited by MarcusAseth

Share this post


Link to post
Share on other sites
Advertisement

thanks for the help @1024, though I ended up solving it right away as soon I watched the code now that I woked up, so I guess I was simply tired x_x

It was a typo. In the second glfwWindowHint call I had wrote GLFW_VERSION_MINOR rather than GLFW_CONTEXT_VERSION_MINOR.

Hurray for naming! :D

Edited by MarcusAseth

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!