Jump to content

  • Log In with Google      Sign In   
  • Create Account


Why do I fail to create a window?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
9 replies to this topic

#1 LiziPizi   Members   -  Reputation: 74

Like
0Likes
Like

Posted 16 May 2014 - 12:25 PM

Hello everyone,

 

can someone please tell me the problem, couse I tryed to find why but it looks like it have'nt happen to anyone alse then me... (so unlucky..)

Here is the code:

#include <stdio.h>
#include <stdlib.h>
#include <GL\glew.h>
#include <GLFW\glfw3.h>

int main(){

	if (glfwInit() == false)
	{
		fprintf(stderr, "Failed to initialize GLFW");
		return -1;
	}

	glfwWindowHint(GLFW_SAMPLES, 4);
	glfwWindowHint(GLFW_VERSION_MAJOR, 3);
	glfwWindowHint(GLFW_VERSION_MINOR, 3);
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

	GLFWwindow* window;
	window = glfwCreateWindow(1024, 768, "yaniv's game", NULL, NULL);
	if (window == NULL)
	{
		fprintf(stderr, "Failed to create a GLFW window");
		glfwTerminate();
		return -1;
	}


Sponsor:

#2 mark ds   Members   -  Reputation: 1124

Like
-3Likes
Like

Posted 16 May 2014 - 01:04 PM

Never used glfw, but try

 

window = new glfwCreateWindow(1024, 768, "yaniv's game", NULL, NULL);



#3 Promit   Moderators   -  Reputation: 6332

Like
0Likes
Like

Posted 16 May 2014 - 01:13 PM

Never used glfw, but try

 

window = new glfwCreateWindow(1024, 768, "yaniv's game", NULL, NULL);

Absolutely not.

 

Considering there's not a lot of code there, try commenting out all the window hints. Maybe you're asking for a profile version or antialiasing setting you can't get.



#4 LiziPizi   Members   -  Reputation: 74

Like
0Likes
Like

Posted 16 May 2014 - 01:30 PM

I just deleted those 4 hints and it work. 



#5 KaiserJohan   Members   -  Reputation: 1085

Like
4Likes
Like

Posted 16 May 2014 - 04:51 PM

Don't you have the major/minor version macros wrong?

 

This is what I use:

 

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
 
Note the difference
 
If it dosn't work, run the GLEW example tool which finds your highest supported OpenGL and all possible extensions and use that as hint

Edited by KaiserJohan, 16 May 2014 - 04:53 PM.


#6 Gooey   Members   -  Reputation: 237

Like
0Likes
Like

Posted 17 May 2014 - 03:03 AM

As KaiserJohan said the version hints you used are from the last glfw you are using glfw 3 by the look of it which uses
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
Instead of the old way from 2.7.3 and below of
glfwWindowHint(GLFW_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_VERSION_MINOR, 3);

Edited by Gooey, 17 May 2014 - 03:06 AM.


#7 rip-off   Moderators   -  Reputation: 7964

Like
1Likes
Like

Posted 17 May 2014 - 05:02 AM

I haven't used GLFW myself, but a quick google indicates it has an error callback facility, which might help diagnose such issues.

#8 LiziPizi   Members   -  Reputation: 74

Like
0Likes
Like

Posted 17 May 2014 - 09:15 AM

Hey guys I done what u guys said about the glew_context_version but still I fail to create a window becouse: 

glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

is making all the problem, when ever I delete this line of code I can create the window.



#9 Gooey   Members   -  Reputation: 237

Like
0Likes
Like

Posted 17 May 2014 - 11:06 AM

Check what version of open gl you can use maybe your card doesn't support 3.3

#10 Gooey   Members   -  Reputation: 237

Like
0Likes
Like

Posted 17 May 2014 - 11:23 AM

Sorry a quick check of glfw3's documentation says that
glfwWindowHint(GLFW_OPENGL_ANY_PROFILE, GLFW_OPENGL_CORE_PROFILE);
Is the new way you can check out the documentation at http://www.glfw.org/docs/latest/window.html




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS