In this assignment, you will use the seen in the pervious assignment/Lab. You will implement multi texturing mapping to the cube or pyramid . You will use different textures, one for each face of the cube/ pyramid. You will also add light source, material and shading characteristics to the scene. The light source should be placed in a default position and orientation. The users then provides incremental changes to modify the camera and light source parameters such as location, light color, brightness and whether its infinite or global .
Implementation suggestion
• Your program must support keyboard commands to control light rotation and orientation. The user can adjust the light using the following keystrokes:
§ SHIFT+RIGHT / SHIFT+LEFT increase/decrease LIGHT X location by small amount (e.g. 0.1)
§ SHIFT+UP/ SHIFT+DOWN increase/decrease LIGHT Y location by small amount (e.g. 0.1)
§ RIGHT/LEFT increase/decrease CAMERA X location by small amount (e.g. 0.1)
§ UP/DOWN increase/decrease CAMERA Y location by small amount (e.g. 0.1)
§ +/- increase/decrease the brightness (color pigment) of light source by small a mount (apply on all properties of light source- Ambient, diffusive and specular)
e.g.
-----------------
Switch case if + è
If A_Red and A_Green , A_Blue < 1è A_Red+=0.1 , A_Green+=0.1 and A_Blue+=0.1 Elseèassign initial value A_Red=0.2 , A_Green=0.2 and A_Blue=0.2
-----------------
The values will be updated anywhere you call the light_ambiant array glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambiant);
Note: Do this for all arrays (Ambient, diffusive and specular) to increase their brightness
float A_Red = 0.2, A_Green= 0.2, A_Blue= 0.2 ;
GLfloat light_ambiant [] = { A_Red, A_Green, A_Green, 1.0};
§ ‘C’/’c’ change the light source color to a random color (apply on all properties of light source - Ambient, diffusive and specular)
e.g.
float C_Red, C_Green, C_Blue;
GLfloat light_ambiant [] = { A_Red, A_Green, A_Green, 1.0};
-----------------
Switch case if C è
//Generate Random color (use srand (time(NULL); in main before using rand() func); ) C_Red = (float) rand()/RAND_MAX ;
C_Green = (float) rand()/RAND_MAX; C_Blue = (float) rand()/RAND_MAX ;
// reassign value for ambient and other arrays
A_Red= C_Green, A_Green= C_Green and A_Blue= C_Green;
//For Diffusive and speculare you might want to increase the brightness of the initial color e.g. D_Red= C_Green + 0.2 , D_Green= C_Green+ 0.2 and D_Blue= C_Green+ 0.2;
-----------------
//The values will be updated anywhere you call the light_ambiant array glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambiant);
§ ‘G’/’g’ change light source from infinite to global and vise versa (apply on all properties of light source- ambient, diffusive and specular)
e.g.
-----------------
Switch case if G è
If A_global ==1.0èA_global =0.0 Else è A_global=1.0
§ ESCAP exit the program
• When the user changes the light source setting, the program should update the light sorce and redraw the seen.
• Be creative.
Writing a c++ program , You will implement multi texturing mapping to the cube or pyramid . You will use different textures, one for each face of the cube/ pyramid. You will also add light source, material and shading characteristics to the scene. The light source should be placed in a default position and orientation. The users then provides incremental changes to modify the camera and light source parameters such as location, light color, brightness and whether its infinite or global .Implementation suggestion• Your program must support keyboard commands to control light rotation and orientation. The user can adjust the light using the following keystrokes:§ SHIFT+RIGHT / SHIFT+LEFT increase/decrease LIGHT X location by small amount (e.g. 0.1)§ SHIFT+UP/ SHIFT+DOWN increase/decrease LIGHT Y location by small amount (e.g. 0.1)§ RIGHT/LEFT increase/decrease CAMERA X location by small amount (e.g. 0.1)§ UP/DOWN increase/decrease CAMERA Y location by small amount (e.g. 0.1)§ +/- increase/decrease the brightness (color pigment) of light source by small a mount (apply on all properties of light source- Ambient, diffusive and specular)e.g.-----------------Switch case if + èIf A_Red and A_Green , A_Blue < 1è A_Red+=0.1 , A_Green+=0.1 and A_Blue+=0.1 Elseèassign initial value A_Red=0.2 , A_Green=0.2 and A_Blue=0.2-----------------The values will be updated anywhere you call the light_ambiant array glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambiant);Note: Do this for all arrays (Ambient, diffusive and specular) to increase their brightness float A_Red = 0.2, A_Green= 0.2, A_Blue= 0.2 ;GLfloat light_ambiant [] = { A_Red, A_Green, A_Green, 1.0};§ ‘C’/’c’ change the light source color to a random color (apply on all properties of light source - Ambient, diffusive and specular)e.g.float C_Red, C_Green, C_Blue;GLfloat light_ambiant [] = { A_Red, A_Green, A_Green, 1.0};-----------------Switch case if C è//Generate Random color (use srand (time(NULL); in main before using rand() func); ) C_Red = (float) rand()/RAND_MAX ;C_Green = (float) rand()/RAND_MAX; C_Blue = (float) rand()/RAND_MAX ;// reassign value for ambient and other arraysA_Red= C_Green, A_Green= C_Green and A_Blue= C_Green;//For Diffusive and speculare you might want to increase the brightness of the initial color e.g. D_Red= C_Green + 0.2 , D_Green= C_Green+ 0.2 and D_Blue= C_Green+ 0.2;-----------------//The values will be updated anywhere you call the light_ambiant array glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambiant);§ ‘G’/’g’ change light source from infinite to global and vise versa (apply on all properties of light source- ambient, diffusive and specular)e.g.-----------------Switch case if G èIf A_global ==1.0èA_global =0.0 Else è A_global=1.0§ ESCAP exit the program• When the user changes the light source setting, the program should update the light sorce and redraw the seen.
Implementation suggestion
• Your program must support keyboard commands to control light rotation and orientation. The user can adjust the light using the following keystrokes:
§ SHIFT+RIGHT / SHIFT+LEFT increase/decrease LIGHT X location by small amount (e.g. 0.1)
§ SHIFT+UP/ SHIFT+DOWN increase/decrease LIGHT Y location by small amount (e.g. 0.1)
§ RIGHT/LEFT increase/decrease CAMERA X location by small amount (e.g. 0.1)
§ UP/DOWN increase/decrease CAMERA Y location by small amount (e.g. 0.1)
§ +/- increase/decrease the brightness (color pigment) of light source by small a mount (apply on all properties of light source- Ambient, diffusive and specular)
e.g.
-----------------
Switch case if + è
If A_Red and A_Green , A_Blue < 1è A_Red+=0.1 , A_Green+=0.1 and A_Blue+=0.1 Elseèassign initial value A_Red=0.2 , A_Green=0.2 and A_Blue=0.2
-----------------
The values will be updated anywhere you call the light_ambiant array glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambiant);
Note: Do this for all arrays (Ambient, diffusive and specular) to increase their brightness
float A_Red = 0.2, A_Green= 0.2, A_Blue= 0.2 ;
GLfloat light_ambiant [] = { A_Red, A_Green, A_Green, 1.0};
§ ‘C’/’c’ change the light source color to a random color (apply on all properties of light source - Ambient, diffusive and specular)
e.g.
float C_Red, C_Green, C_Blue;
GLfloat light_ambiant [] = { A_Red, A_Green, A_Green, 1.0};
-----------------
Switch case if C è
//Generate Random color (use srand (time(NULL); in main before using rand() func); ) C_Red = (float) rand()/RAND_MAX ;
C_Green = (float) rand()/RAND_MAX; C_Blue = (float) rand()/RAND_MAX ;
// reassign value for ambient and other arrays
A_Red= C_Green, A_Green= C_Green and A_Blue= C_Green;
//For Diffusive and speculare you might want to increase the brightness of the initial color e.g. D_Red= C_Green + 0.2 , D_Green= C_Green+ 0.2 and D_Blue= C_Green+ 0.2;
-----------------
//The values will be updated anywhere you call the light_ambiant array glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambiant);
§ ‘G’/’g’ change light source from infinite to global and vise versa (apply on all properties of light source- ambient, diffusive and specular)
e.g.
-----------------
Switch case if G è
If A_global ==1.0èA_global =0.0 Else è A_global=1.0
§ ESCAP exit the program
• When the user changes the light source setting, the program should update the light sorce and redraw the seen.
In this assignment, you will use the seen in the pervious assignment/Lab. You will implement multi texturing mapping to
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
In this assignment, you will use the seen in the pervious assignment/Lab. You will implement multi texturing mapping to
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!