I'm currently trying to color some rectangles to represent collision boxes for my game character. The issue is the color I'm trying to apply ONLY to the rectangles are being applied to my character and background textures as well. So if I draw a rect using the following code:
void DrawRect(v2f MinPoint, v2f MaxPoint)
{
glBegin(GL_QUADS);
glColor3f(1.0f, 0.0f, 0.0f); //Red color
glVertex2f(MaxPoint.x, MaxPoint.y);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex2f(MinPoint.x, MaxPoint.y);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex2f(MinPoint.x, MinPoint.y);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex2f(MaxPoint.x, MinPoint.y);
glEnd();
glFlush();
}
Then right after draw my background texture:
void DrawBackground(ui32 TextureID, Drawable_Rect BackgroundImage, v2f MinUV, v2f MaxUV)
{
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, TextureID);
glBegin(GL_QUADS);
glTexCoord2f(MinUV.x, MinUV.y);
glVertex2f(BackgroundImage.BottomLeft.x, BackgroundImage.BottomLeft.y);
glTexCoord2f(MaxUV.x, MinUV.y);
glVertex2f(BackgroundImage.BottomRight.x, BackgroundImage.BottomRight.y);
glTexCoord2f(MaxUV.x, MaxUV.y);
glVertex2f(BackgroundImage.TopRight.x, BackgroundImage.TopRight.y);
glTexCoord2f(MinUV.x, MaxUV.y);
glVertex2f(BackgroundImage.TopLeft.x, BackgroundImage.TopLeft.y);
glEnd();
glFlush();
glDisable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, 0);
}
Then both my rectangle AND my background are red instead of just my rectangle. Why is the color being applied to both my rectangle and my texture?