Advertisement

creating new polygon

Started by June 01, 2006 11:51 AM
0 comments, last by Demus79 18 years, 4 months ago
hi. i have this random function that draws a shape whenever it's runed. int callrandom() { struct object normal; normal.x=0.0f; normal.y=0.0f; srand((unsigned)time(0)); int rann = (rand()%6)+1; if(rann==1){shapeone(normal);} if(rann==2){shapetwo(normal);} if(rann==3){shapethree(normal);} if(rann==4){shapefour(normal);} if(rann==5){shapefive(normal);} if(rann==6){shapesix(normal);} return rann; } as you can see, rann is the number randomly picked and normal contains the coordinate for each shape by the way, the shape is 2D. when i call this function in DrawGLScene(GLvoid) the shape is replaced, so that it changes. i want to make it so that shape draws on each other, without replacing the previous shape drawn. any advice will be helpful. thanks in advance.

Well, you have some options.

- Either you don't clear screen (might be slightly problematic since normally you use several back buffers)
Perhaps, using a texture as a render target could work ?

- Store the random number to a buffer and render all the previous shapes too. This will eventually make your program go really slow :)

Hope this helps.

This topic is closed to new replies.

Advertisement