Hi,
I’m just starting out with OpenGL, and have only coded a few introductory level programs. I’ve already run into a little problem, which will probably sound dumb, but that’s why I’m in the beginners coding area… :eek:
Anyway, I’m trying to make successive calls to one of my own user-written methods using glutDisplayFunc(), and it doesn’t seem to be working.
I noticed that glutDisplayFunc() only likes to take a single parameter. So, I can pass one method to it. Multiple calls of glutDisplayFunc() in main do not seem to call the method numerous times.
This works fine for most programs where I only have one method that I wish to pass. However, in my current program, I wrote a method called parameterizedHouse, which has several parameters which determine what the house looks like when it’s drawn. I want to call this method a few times with different parameters so that the houses are drawn multiple times, and look different, but I’ll be darned if I can figure out how.
This is what I have (note that the functional code for the parameterizedHouse method is elsewhere in the program):
//myDisplay
void myDisplay(void)
{
GLintPoint aPoint;
aPoint.x = 100;
aPoint.y = 150;
parameterizedHouse(aPoint, 100, 200);
GLintPoint bPoint;
bPoint.x = 200;
bPoint.y = 300;
parameterizedHouse(bPoint, 150, 275);
glFlush();
}
Then, in the main function, I pass myDisplay to glutDisplayFunc:
glutDisplayFunc(myDisplay); // Register redraw function
This works for other programs, but like I said, it doesn’t seem to work for this since I’m calling parameterizedHouse more than once. Only the last house in myDisplay shows up; it’s like the first call to parameterizedHouse doesn’t register or something.
What am I doing wrong? Sorry for the long post, and thanks to anyone who can help. Please let me know if I need to provide any more information about this.