Original Post
i am making am arkanoid game and at the start i want my ball and paddle to move together across the screen together. so i set the x coordinates to equal eachother.
ball.x = paddle.x;
here is the code that draws them
glLoadIdentity();
glTranslatef(0.0f,-6.5f,-20.0f);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(PaddleWidth + paddle.x , 0.0f + paddle.y, 2.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3f(-0.0f + paddle.x , 0.0f + paddle.y, 2.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3f(-0.0f + paddle.x , PaddleHeight + paddle.y, 2.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(PaddleWidth + paddle.x ,PaddleHeight + paddle.y,2.0f);
glEnd(); // Done Drawing The paddle
glBindTexture(GL_TEXTURE_2D, texture[1]);
glTranslatef(0.0,-6.5f,-20.0f);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(0.7f + ball.x , 0.7f + ball.y , 0.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3f(-0.7f + ball.x , 0.7f + ball.y, 0.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3f(-0.7f + ball.x , -0.7f + ball.y, 0.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(0.7f + ball.x , -0.7f + ball.y, 0.0f);
glEnd(); // Done Drawing The ball
but them i move them across the screen the ball never stays in the same place as the paddle it stays behind it.
i have printed the x ordinates to the screen and they are the same so i dont know thats wrong with it..
any help. newbie to opengl.