Drawing two paddles

I am doing a simple pong game using glfw3 and glew and opengl 3.3. I am able to draw one paddle but not the other my problem is that glBufferData only draws one paddle at a time.

	static const GLfloat g_vertex_buffer_data[] = {
		1.0f, 0.25f, 0.0f,
		0.87f, 0.25f, 0.0f,
		0.87f, -0.25f, 0.0f,

	static const GLfloat g_vertex_buffer_data_one[] = {

	GLuint vertexbuffer;
	glGenBuffers(1, &vertexbuffer);
	glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
	glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data_one), g_vertex_buffer_data_one, GL_STATIC_DRAW);
	glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_STATIC_DRAW);

sorry but I have already solved my problem

void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
	if (key == GLFW_KEY_UP && action == GLFW_PRESS)
	paddle += 0.1f;

I am trying to move a paddle but with no success.

does glfw have a command like glutPostRedisplay()?

It doesn’t need one. GLUT owns the main loop, so you have to tell it to redisplay. In GLFW, you control the main loop, so if you want to draw something, you just draw something.

I am trying to move the paddle with the paddle variable but for some reason it does not move it.

can I get some help on this problem.

You’re effectively asking someone to help debug your code. That would require having your code. Which we don’t.

I mean presumably, at some point in your code, you do something that causes the paddle to appear in one location. You set some state in OpenGL during your rendering, for example. OK, so put a breakpoint there and see when it gets hit. If it’s not getting hit when you try to “move it”, then that means you aren’t properly redrawing it. If it does get hit, look at the value in the debugger. If the value isn’t what you expect it to be, then that means you probably have some problems in your routine that updates the paddle’s position. And so forth.

Through techniques like this, you ought to be able to localize and repair the problem. Even if you don’t have a true debugger (and if you don’t, you really need to re-evaluate your programming toolchain), printf-style debugging (inserting statements that print values of things to std-out) would help track the issue down.

well when I put in a exit(0) function in the keyboard function it exits the program so I know the keyboard function is getting accessed properly.

well after much work I solved my problem.