Hello,
I have a tree image which I am billboarding.
I want to be able to draw this tree around 20 times randomly along my plane
The above will draw one instance of my tree, I tried to loop it and have that run 20 time...
But the above code gives me a totally wacked out tree..as in one really wide tree...
I have a tree image which I am billboarding.
I want to be able to draw this tree around 20 times randomly along my plane
Code:
glBegin( GL_POLYGON );
{
glTexCoord2f(0.0f, 0.0f);
glVertex3f(-1.f, -1.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3f(1.0f, -1.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3f(1.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(-1.0f, 1.0f, 0.0f);
}
glEnd();
The above will draw one instance of my tree, I tried to loop it and have that run 20 time...
Code:
for (float x=1.0f;x<100;x+=5.0f){
glBegin( GL_POLYGON );
{
glTexCoord2f(0.0f, 0.0f);
glVertex3f(-x, -xf, 0.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3f(x, -xf, 0.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3f(x, xf, 0.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(-x, xf, 0.0f);
}
glEnd();
}
But the above code gives me a totally wacked out tree..as in one really wide tree...