The code below is a function to draw a '3d' version of the Sierpinski sieve at the moment it just draws a 2d scene with 3dperspective, the plotting of the points is all there to create a 3d model but i have no idea what needs to be implemented to get this going, should i be creating more surfaces or something? and lighting direction i suppose but maybe running before can walk.

i have posted a screenshot of how it looks after a couple of iterations so you get an idea

thanks for any suggestions.

Code:

void DrawScene(SDL_Surface *screen)
{
int count;
int maxrand = 5;
int num;
// verticies of the "3d" triangle
int v1acr = 200; int v1dwn = 25; // top middle point
int v2acr = 360; int v2dwn = 250; // right corner
int v3acr = 40; int v3dwn = 250; // left corner
int v4acr = 200; int v4dwn = 300; // bottom middle point
int v5acr = 200; int v5dwn = 250; // back middle point
int plotacr, plotdwn; // variables to store x & y coordinates //
int currentacr = 275;
int currentdwn = 112;
srand(time(NULL));
SDL_WM_SetCaption("3D-ish Sierpinski Gasket","3D-ish Sierpinski Gasket" );
for (count = 0; count < 20000; count++)
{
num = rand() % maxrand;
switch(num)
{
case 0:
plotacr = v1acr + currentacr / 2; plotdwn = v1dwn + currentdwn / 2;
break;
case 1:
plotacr = v2acr + currentacr / 2; plotdwn = v2dwn + currentdwn / 2;
break;
case 2:
plotacr = v3acr + currentacr / 2; plotdwn = v3dwn + currentdwn / 2;
break;
case 3:
plotacr = v4acr + currentacr / 2; plotdwn = v4dwn + currentdwn / 2;
break;
case 4:
plotacr = v5acr + currentacr / 2; plotdwn = v5dwn + currentdwn / 2;
break;
}
DrawPixel(screen, plotacr,plotdwn,100,50,50);
currentacr = plotacr; currentdwn = plotdwn; //set last point to new start point
}
Sulock(screen);
SDL_Flip(screen);
}