Jump to content

View more

Image of the Day

The beast has a mighty searchlight of evil! #screenshotsaturday https://t.co/bzKepOojDL
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Why do I fail to create a window?

4: Adsense

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 Elgauly   Members   

154
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;
	}


#2 mark ds   Members   

1767
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   Senior Moderators   

13108
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.


SlimDX | Shark Eaters for iOS | Ventspace Blog | Twitter | Proud supporter of diversity and inclusiveness in game development

#4 Elgauly   Members   

154
Like
0Likes
Like

Posted 16 May 2014 - 01:30 PM

I just deleted those 4 hints and it work. 



#5 KaiserJohan   Members   

2269
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   

2177
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   

10897
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 Elgauly   Members   

154
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   

2177
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   

2177
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.