PDA

View Full Version : General understanding of the GL Pipeline



uwi2k2
02-21-2012, 12:13 AM
hi all,

i just like to understand how the data is processed.

so lets say i am drawing 2 quads one in front of the other.

1. i draw the one in the back
2. i draw the one in front

how is it processed ? after i draw the first one, is it processed through the complete pipeline and after that the same happens for the second quad,
OR
are both quads stored into some temp buffer first and than somehow together proccesd through the pipeline ...

thanx for input :-)

cu
uwi

Kopelrativ
02-21-2012, 12:33 AM
See http://en.wikipedia.org/wiki/OpenGL for more information. Especially, look at the picture: http://upload.wikimedia.org/wikipedia/commons/b/bb/Pipeline_OpenGL_%28en%29.png

Kopelrativ
02-21-2012, 01:06 AM
To add a little more information:

There is a depth buffer, that keeps track of the distance to every pixel on the screen. When you draw something, it will usually be discarded if it has a depth value greater than the previous pixel at that position. Being discarded in this case means being removed from the "rest of the pipeline".

If you sort you objects, roughly, according to distance, then it can improve the rendering speed.

The pipeline is long and complex, but you could say a simplified view of it is the vertex shader and the fragment shader. Your quads need to go through the vertex shader, which will transform coordinates to screen coordinates. After that, the fragment shader is run for each pixel of your quad (to compute the colour). Before the fragment shader, the depth buffer is used to detect pixels that will not be shown, and thus can be ignored.

This is the default behaviour, but is configurable in any way imaginable.

uwi2k2
02-21-2012, 01:50 AM
Hi,
thanx for the feedback.
I know about what the pipeline does and the shaders.
i just like to know is it done for every 'draw' command.
ob somehow by the end of each frame ?
so quad by quad or all together ?

cu
uwi

V-man
02-21-2012, 06:21 AM
That kind of thing is not described by the GL pipeline. The GL pipeline doesn't say when drawing takes place and how. Implementation details are left to the implementor of the driver.

But in practical terms, the GL driver buffers commands. That means it stores commands in a buffer in RAM. When sufficient commands are piled up, it sends it to the GPU. That way, bus traffic is reduced (whether the bus is PCI or AGP or PCI express or something else).

uwi2k2
02-21-2012, 07:13 AM
ok,

great, that was the answer for me !!

thanx

uwi