cheers for that although i’m afraid i’m very new to this and don’t quite get it- do I put all that code into the display function or does the top bit go in the main function or what?
i’m using this reshape function which might be causing the problem and i’ve put the other functions i’m using below? do I just alter this? I’m doing 3d but as 2d slices if you see what I mean so the array goes array[i][j][slice]
which bits of my code do I need to change??
cheers!
Kate
void reshape(int w,int h)
{
glViewport(0,0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-50.0,50.0,-50.0, 50.0,-50.0,50.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void init(void)
{
glClearColor(0.0, 0.0, 0.0, 0.0) ;
glShadeModel(GL_FLAT);
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glRotatef(spin, 0.0, 1.0, 1.0);
glColor3f(6,1,1);
//draw valve
growValve();
glBegin(GL_POINTS);
for(i=0;i<xMAX*2;i++)
for(j=0;j<yMAX*2;j++)
if(valve[i][j][0]==2){
glVertex2f(i-xMAX,j-yMAX);
}
glEnd();
glPopMatrix();
glutSwapBuffers();
glFlush();
}
int main(int argc, char** argv)
{
int x;
GrowthCounter = 0;
glutInit (&argc, argv) ;
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB) ;
glutInitWindowSize (250, 250) ;
glutInitWindowPosition (400, 400) ;
glutCreateWindow (argv[0]) ;
init() ;
initialiseTemplateValve();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMouseFunc(mouse);
x= pointLineTest(2.06,5.07);
printf("
Result: %d", x);
glutMainLoop();
return 0 ;
}