Hello community,
Oh... today I've a really huge problem!
I've a function called draw_forest() with the following prototype:
void draw_forest(GLubyte color[], int color_variation, float max_height, float min_height);
The function calls another function to draw several trees in the screen with a color variation and with the height between min_height and max_height.
If color[]={100, 100, 100} (colors in the 0-255 range) and color_variation=30 then the tree should be drawn with color components in the range 70-130.
Well, for the height I've this code:
float height_range = height_max - height_min;
float height_temp = height_min + (rand()%height_range);
This solution doesn't work because rand() doesn't accept floats.
rand() also doesn't return negative numbers so I'm having trouble with the colors, too.
Does anyone have some tips on how to solve this?
Thanks a lot!