Hi, I want to create a kind of a simulation. It should display the certain position of a fish/shark/orca (not real ones, they are set up randomly). My Simulation can display the starting situation:
glOrtho(0, breite, 0, hoehe, 0, 1);
glClearColor(0, 0, 1, 0);
glClear(GL_COLOR_BUFFER_BIT);
//Besetzen der Felder
srand(time(0));
NSMutableArray* Wator = [NSMutableArray new];
for(int y = 0; y < hoehe; y++){
for(int x = 0; x < breite; x++){
NSInteger r = rand() % 100;
if (r < fishPer) {
[Wator addObject:[[[Fish alloc]init]autorelease]];
drawAFish(x,y);
}else {
if (r < sharkPer + fishPer) {
[Wator addObject:[[[Shark alloc]init]autorelease]];
drawAShark(x, y);
}else {
if (r < orcaPer + sharkPer + fishPer) {
[Wator addObject:[[[Orca alloc]init]autorelease]];
drawAOrca(x, y);
}
}
}
}
}
glFlush();
It works fine. drawAFish/drawAShark ... draw a simple Quad:
static void drawAOrca (int x, int y)
{
glColor3f(1.0f, 1.0f, 0.0f);
glBegin(GL_QUADS);
{
glVertex3i( x, y, 0);
glVertex3i( x+1, y, 0);
glVertex3i( x+1, y+1, 0);
glVertex3i( x, y+1, 0);
}
glEnd();
}
So my question is: How can I redraw the scene?
There are not many helpful information at google or in the documentation.
thanks for your help
Marcel