Jump to content

  • Log In with Google      Sign In   
  • Create Account

crashes at glGenBuffers, run time error says "Unhandled exception at 0x53930647 (nvoglv32.dll)"


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
2 replies to this topic

#1 sobeit   Members   -  Reputation: 440

Like
0Likes
Like

Posted 29 April 2013 - 01:54 AM

Hi, 

 

I'm learning OpenGL, and using glfw and glew. but after searching all over the internet I still don't know why my program crashes every time at the call of glGenBuffers. it pops up the run time error "Unhandled exception at 0x54C00647 (nvoglv32.dll) in OpenglGLFW.exe: 0xC0000005: Access violation writing location 0x003D5000."

 

I cannot move on without fixing this bug. So can someone help detect the problem of my program? Thanks very much!

 

following is my code snippet:

if( !glfwInit() )
	{
		exit( EXIT_FAILURE );
	}
	// Open an OpenGL window
	if( !glfwOpenWindow( 640, 480, 0,0,0,0,0,0, GLFW_WINDOW ) )
	{
		glfwTerminate();
		exit( EXIT_FAILURE );
	}
	
	glewExperimental = GL_TRUE;
	GLenum glewErr = glewInit();
	if (GLEW_OK != glewErr)
	{
		std::cerr << "Failed to initialize GLEW." << std::endl;
		std::cerr << glewGetErrorString(glewErr) << std::endl;
	}

	if(!glewIsSupported("GL_ARB_vertex_buffer_object GL_ARB_vertex_array_object"))
	{
		std::cerr << "some extensions are not supported!" << std::endl;
	}

	//initializing shaders
	shaderProg = initShaderProgram(2, "shaders/shader0.vert", "shaders/shader0.frag");

	glGenVertexArrays(1, &avao);
	glGenBuffers(GL_ARRAY_BUFFER, &vertBO);
	
	glBindVertexArray(avao);
	glBindBuffer(GL_ARRAY_BUFFER, vertBO);
	glBufferData(GL_ARRAY_BUFFER, sizeof(vertexPositions), vertexPositions, GL_STATIC_DRAW);
	glBindBuffer(GL_ARRAY_BUFFER, 0);

 

 



Sponsor:

#2 dave j   Members   -  Reputation: 599

Like
2Likes
Like

Posted 29 April 2013 - 02:12 AM

The first parameter to glGenBuffers should be the number of buffers you want to generate not GL_ARRAY_BUFFER.

#3 sobeit   Members   -  Reputation: 440

Like
0Likes
Like

Posted 29 April 2013 - 02:13 AM

The first parameter to glGenBuffers should be the number of buffers you want to generate not GL_ARRAY_BUFFER.

OMG, sorry to post such a silly question here. Thanks.






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