Jump to content
  • Advertisement
Sign in to follow this  
sobeit

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

This topic is 1969 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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);

 

 

Share this post


Link to post
Share on other sites
Advertisement

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!