glThreads in OpenGL + C

hello I trying to draw many objects (ball) in a scene in the same time but a can’t,

?¿?¿

something help about glthread to draw many objects in a scene?¿
please help


draw loop {
  for each ball to draw {
    drawBall(ball.parameters);
  }
  swapbuffers()
}

Why do you want threads ?

hi :O)… thanks for answer.

I need threads because I want draw many objects in the some time,
I have a function that draw a ball animation of one point to another, THen I want call to that function 5 times with differents objects at the same time have draw all this objects in the scene.

You can not do that.
You have to split your monolithic function into parts, to fit that inside the draw loop I wrote above.

MMMM,.
jjejeje
thankssss…

but if someone have a example to use pthreads with opengl…
i will give thanks, because i am in my work … please

If you use threads with OpenGL, you will have to mutex the hell of it, so it will becomes completely serialized instead of parallel.
A complete waste of time.

The GPU can not take commands in parallel.

Good luck.

ZBuffer is right, an openGl application can use only one context attached to the viewport.
Using multiple thread to draw is like printing 5 word documents at the same time (in the same printer).
You can use some technique to render on a offline texture, but is too complex and the performance gain is so little (the GPU is still the same) that is better to spend your time doing an efficient single thread render queue.

thans for the help…
I am thinking use 2 hilos o thread uno para dibujo y otro para el glClear…

para usar hilos porque tengo que si o si usar hilos … para dibujar objetos en paralelo.