I would like to reposition a circle, triangles, lines and an arc.
So you already did draw the scene and now want to change the position of the objects?
Well then, all you need to understand is, that OpenGL doesn't maintain a scene graph of sorts. After submitting a draw call, things get only updates on the target framebuffer and that's it. You want to change something? Clear the screen, redraw everything, but now with the adjustments applied.
Really, OpenGL just draws things, it's nothing more than sophisticated brushes (textures) and pencils (primitives) for some paper offered by the operating system (viewport/window).
EDIT due to comment
The usual interactive OpenGL graphics program with animations, programmed in a imperative programming language, is structured like this (pseudocode)
float T = 0
float alpha = 0, beta = 0
float red = 0, green = 0, blue = 0
paused = false
on_mousemove(mousemove):
alpha += mousemove.rel_x
beta += mousemove.rel_y
on_keypress(keypress):
switch keypress.key:
case Key_ESCAPE:
queue_event(Quit)
return
case Key_PAUSE:
paused = not paused
case Key_R:
red += 0.1
case Key_r:
red -= 0.1
case Key_G:
green += 0.1
case Key_g:
green -= 0.1
case Key_B:
blue += 0.1
case Key_b:
blue -= 0.1
queue_event(Redraw)
render()
glViewport(0, 0, window.width, window.height)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
apply_projection()
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
apply_modelview()
glColor3f(red, green, blue)
glRotatef(T * x_revolutions_per_second_factor, 1, 0, 0)
glRotatef(alpha, 0, 1, 0)
glRotate(beta, 0, 0, 1)
draw_object()
SwapBuffers()
main:
initialize_libraries()
load_resources()
create_window_and_OpenGL_context()
previous_loop = get_time()
loop 'eventloop':
event = peek_event()
switch event.type:
case MouseMove:
on_mousemove(event.mousemove)
case KeyPress:
on_keypress(event.keypress)
case Quit:
break 'eventloop'
case Redraw:
render()
break
case NoEvents:
fallthrough
default:
if not paused
render()
current_loop = get_time()
if not paused:
T += current_loop - previous_loop
previous_loop = current_loop