so I should refactor the following code.
void drawBug_one(int i)
{
Bug bug;
bug.bug_x = -10.0f;
bug.bug_y = 90.0f;
bug.bugWidth = 10.0f;
bug.bugHeight = 10.0f;
bugs.push_back(bug);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture[12]);
glBegin(GL_POLYGON);
glTexCoord3f(0.0f, 0.0f, 0.0f);
glVertex3f(bugs[i].bug_x, bugs[i].bug_y, 0.0f);
glTexCoord3f(1.0f, 0.0f, 0.0f);
glVertex3f(bugs[i].bug_x, bugs[i].bug_y + bugs[i].bugHeight, 0.0f);
glTexCoord3f(1.0f, 1.0f, 0.0f);
glVertex3f(bugs[i].bug_x + bugs[i].bugWidth, bugs[i].bug_y + bugs[i].bugHeight, 0.0f);
glTexCoord3f(0.0f, 1.0f, 0.0f);
glVertex3f(bugs[i].bug_x + bugs[i].bugWidth, bugs[i].bug_y, 0.0f);
glEnd();
glDisable(GL_TEXTURE_2D);
}
void drawBug_two(int i)
{
Bug bug;
bug.bug_x = -10.0f;
bug.bug_y = 90.0f;
bug.bugWidth = 10.0f;
bug.bugHeight = 10.0f;
bugs.push_back(bug);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture[8]);
glBegin(GL_POLYGON);
glTexCoord3f(0.0f, 0.0f, 0.0f);
glVertex3f(bugs[i].bug_x, bugs[i].bug_y, 0.0f);
glTexCoord3f(1.0f, 0.0f, 0.0f);
glVertex3f(bugs[i].bug_x, bugs[i].bug_y + bugs[i].bugHeight, 0.0f);
glTexCoord3f(1.0f, 1.0f, 0.0f);
glVertex3f(bugs[i].bug_x + bugs[i].bugWidth, bugs[i].bug_y + bugs[i].bugHeight, 0.0f);
glTexCoord3f(0.0f, 1.0f, 0.0f);
glVertex3f(bugs[i].bug_x + bugs[i].bugWidth, bugs[i].bug_y, 0.0f);
glEnd();
glDisable(GL_TEXTURE_2D);
}