Removing drawPolygon

Hi all,

I have drawn a person using the drawPPolgon and drawTriangles commands etc while storing the coridinates in an array. The person is drawn at runtime so it is in the programme from the start. However I have a cube that moves towards the person (the cube moves by incrementing a variable) and when the cube comes into contact with the person then I want the person to be uncreated.

I believe the coding would be based upon the value of the variable, so say once the cube hits the person the variable will be at 100. So once the variable reaches 100 i want the person to disappear. Do you have any idea how i can achieve this? Thanks for any help :slight_smile:

Oh btw, im not sure if this is important but the person is a stationary and in 2D.

Hi !

Not sure what you are using on top of OpenGL, but OpenGL does not save anything, each frame is created from scratch so it is all very simple.

For each frame you render what is visible depending on the state of the application, so when you want something do no longer vi visible you no longer render it.


Im using glut. It is being coded in C using Visual Studio 6

I think i understand what you mean. Basically the person is created in its own function and i think that the function is being constantly called . But if i put a function call in an if statement like

if(variable < 100){

Then she should stopped being drawn. I cant test this now as im no longer on the computer with the programme on, but if I cant get it working then i’ll let you know. Thanks a lot for the reply mate :slight_smile: