![]() |
Help with an openGL program
Ok so basically I've got an openGL program and currently I am having two problems. My first problem I am having is trying to make an array of references of a method that will draw a quads. The draw method to draw the quad is my Building.h header file and in my main.cpp I have a drawing function which repeatidly gets called and this is where I called my drawquad method. I have made an instance of the Building class called Building b;
:
Building bvoid DrawScene(void)My drawing code works but I am trying to draw multiple buildings and want to make multiple instances of the building class. I have done this before in C# but am unsure of how to do it in C++. I tried doing: :
Building b[6]; something to that affect and then scale up the x factors but I am not sure how to accomplish this. Another problem I am having is I am making a random number generator which generates a random height for the y values in the quad. :
srand((unsigned)time(0));but the problem is when I call my drawQuad method inside my draw function which repeatidly gets called, the drawQuad method continues to generate a random number and a random height and my quad grows and shrinks because the method is repeatidly called generating a new random number everytime. Any suggestions on how to fix these problems?? Quote:
|
Can you explain why you need multiple instances of the building class?. As for the random numbers being generated, you should calculate them on startup and just store them for use later on when they are needed.
|
| All times are GMT -5. The time now is 2:25 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC