You can draw a rectangle that is not filled this way:
glBegin(GL_LINES); glVertex2d(top_left_x, top_left_y); glVertex2d( top_right_x, top_right_y); glVertex2d( bottom_right_x,bottom_right_y); glVertex2d(bottom_left_x,bottom_left_y); glVertex2d(top_left_x, top_left_y); glEnd();
OpenGL uses a state machine. So, to change the color just put:
glColor3f (R, G, B);
in front of your drawing primitives.
So, mixing it, your step should be:
- select fill color
- draw fill rect with glRectf
- choose border color
- draw an empty rectangle with the code that I posted
These steps are repeated for every rectangle you draw, of course.
source share