I wrote a program that displays points expressed in 3D in a 2D canvas, using perspective projection. The aim is to display a cube. Each face of the cube is drawn by linearly interpolating the points that define it. My cube can be translated, scaled and rotated thanks to transformation matrices.
For the moment, my program is not paralelized at all and uses CPU to make the various computations (e.g. : projection of 3D points into the 2D canvas using perspective projection, matrices computations, product of a point by a matrix, drawing cube's faces with linear interpolation).
There is a speed problem. I described it below :
Linear interpolation as I wrote it, which never calculates duplicates, costs a lot of accesses to RAM. Applied to each face, it requires also a lot of computations.
My cube's faces should be drawn thanks to a linear interpolation with a very very small step (e.g. :
0.001) to be beautiful. However, it's simply a utopia. It would require too many computations and accesses to RAM. My program would freeze.
A given transformation matrice is multiplied by point N°
1, then by N°
2, then by N°
k, then by N°
8. Obviously, the matrices are not multiplied by the interpolated points ! (it implies a gain in computation speed).
Without using any API :
Are GPU util to paralelize linear interpolations ? If I remember well my courses, yes. So : how could I send my points and my linear interpolation function to GPU ? Note that I would be disapointed if I must use linear interpolation program of the GPU (if it exists) instead of mine.
How could I draw beautiful cube's faces without using a linear interpolation's step of
Less important : is it possible to increase computation speed in making the product of a sequence of points with a matrice ?