[fpc-pascal] FPC Graphics options?

Reimar Grabowski reimgrab at web.de
Thu May 18 14:42:55 CEST 2017


On Thu, 18 May 2017 09:02:45 +0100
Graeme Geldenhuys <mailinglists at geldenhuys.co.uk> wrote:

> On 2017-05-17 14:28, Reimar Grabowski wrote:
> > But I don't get why you have to *calculate* *all*.  
> 
> The CPU (your program) calculates all the 3D vertex points, as objects 
> (made out of vertex points) move through the scene. Lots of triangles 
> really.
Nonsense.
Most of the time you just load the vertex positions from file. No calculations at all.
And even if you calculate your objects most are static (meaning their vertex positions in object space do not change). So they are calculated once and then sent to the GPU once.
Animations are mostly done sending scalars/matrices/quaternions as uniforms to the corresponding shader.
Skeletal animation may be done on the CPU (if you need the fully transformed mesh for anything CPU side, but you seldom do).

> The GPU calculates the individual pixel colors based on those vertex 
> points (using shaders and textures).
You mean fragment colors not pixel colors.

> eg: CPU calculates 3 points of a 
> triangle. 
> The GPU calculates all the points between those 3 points, 
> making up the triangle color.
> The GPU also does clipping calculations 
> based on the viewpoint (camera position) in the 3D scene.
Camera position?
OpenGL has no concept of a camera.
Clipping is done based on the clip-space positions of the vertices after the last vertex processing stage.

> So if you work out how many vertex points there are,
Some million for a typical game scene, which makes it sound scary to calculate them all every frame when you only have 16ms to do user input processing/sound/physics/enemy AI/etc. if you target 60fps. Heck even 32ms is not much and that's as low as you can go.

> compared to 
> everything that the GPU has to do (a LOT more points and calculations), 
> the CPU does relatively little in comparison.
And still too much.

So the question remains:

Why do you have to *calculate* *all*?

R.



More information about the fpc-pascal mailing list