Royal University of Phnom Penh CG: Lab 3 Faculty of Engineering Lecture: Kor Sokchea
Royal University of Phnom Penh CG: Lab 3 Faculty of Engineering Lecture: Kor Sokchea
Royal University of Phnom Penh CG: Lab 3 Faculty of Engineering Lecture: Kor Sokchea
Lab 3:
In this lab, you will enhance your application that you have done in Lab 2 by adding a menu.
When the user clicks on the right-button of the mouse, a menu called color will appear on the
screen. Under this menu, it contains 3 submenu Blue, Green, and Yellow.
In order to create menu, we will use GLUT utility library as follows:
Create variable in order to store menu
int submenu;
int menu;
Create submenu
submenu = glutCreateMenu(selectAxisColor)
// the selectColor is the function that will will create in
order to response when the user select on each item on the
menu
glutAddMenuEntry(Blue, 1); // add the blue at the first row of the submenu
glutAddMenuEntry(green, 2); // add the green at the second row of the submenu
glutAddMenuEntry(yellow, 3); // add the green at the second row of the submenu
Bronze Challenge: Changing the color of the both x-axis and y-axis to the selected
color.
Silver Challenge: Adding two more submenu called unit color and geometric type.
Under unit color, it consists of Brown, Cyan, White. Under geometric type
submenu, it has Point and Line Strip or Line Loop. It depends on which one you use
to draw sine wave. When the user selects one color under unit color submenu, the
unit label will change color corresponding to what the user selected. The same for
geometric type.
Golden Challenge: draw a nice star shape and color it with different color on each
section.