Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I cant seem to get my texture to go on top of the keyboard box. Please help * LoadSceneTextures ( ) void SceneManager::LoadSceneTextures ( )
I cant seem to get my texture to go on top of the keyboard box. Please help
LoadSceneTextures
void SceneManager::LoadSceneTextures
bool bReturn false;
bReturn CreateGLTexture
"textureswoodjpg "wood";
bReturn CreateGLTexture
"texturesglassjpg "glass;
bReturn CreateGLTexture
"texturesglassjpg "glass;
bReturn CreateGLTexture
"texturesglassjpg "glass;
bReturn CreateGLTexture
"texturesgoldjpg "gold";
bReturn CreateGLTexture
"textureskeyboardjpg "keyboard";
bReturn CreateGLTexture
"texturesstickynotejpg "stickynote";
BindGLTextures;
DefineObjectMaterials
void SceneManager::DefineObjectMaterials This function will set material properties such as diffuse, specular, ambient, etc.
OBJECTMATERIAL goldMaterial;
goldMaterial.ambientColor glm::vecfff;
goldMaterial.ambientStrength f;
goldMaterial.diffuseColor glm::vecfff;
goldMaterial.specularColor glm::vecfff;
goldMaterial.shininess ;
goldMaterial.tag "gold";
mobjectMaterials.pushbackgoldMaterial;
OBJECTMATERIAL woodMaterial;
woodMaterial.ambientColor glm::vecfff;
woodMaterial.ambientStrength f;
woodMaterial.diffuseColor glm::vecfff;
woodMaterial.specularColor glm::vecfff;
woodMaterial.shininess ;
woodMaterial.tag "wood";
mobjectMaterials.pushbackwoodMaterial;
OBJECTMATERIAL glassMaterial;
glassMaterial.ambientColor glm::vecfff;
glassMaterial.ambientStrength f;
glassMaterial.diffuseColor glm::vecfff;
glassMaterial.specularColor glm::vecfff;
glassMaterial.shininess ;
glassMaterial.tag "glass";
mobjectMaterials.pushbackglassMaterial;
OBJECTMATERIAL keyboardMaterial;
keyboardMaterial.ambientColor glm::vecfff;
keyboardMaterial.ambientStrength f;
keyboardMaterial.diffuseColor glm::vecfff;
keyboardMaterial.specularColor glm::vecfff;
keyboardMaterial.shininess ;
keyboardMaterial.tag "keyboard";
mobjectMaterials.pushbackkeyboardMaterial;
OBJECTMATERIAL stickynoteMaterial;
stickynoteMaterial.ambientColor glm::vecfff;
stickynoteMaterial.ambientStrength f;
stickynoteMaterial.diffuseColor glm::vecfff;
stickynoteMaterial.specularColor glm::vecfff;
stickynoteMaterial.shininess ;
stickynoteMaterial.tag "stickynote";
mobjectMaterials.pushbackstickynoteMaterial;
PrepareScene
void SceneManager::PrepareScene
load the textures for the D scene
LoadSceneTextures;
define the materials for objects in the scene
DefineObjectMaterials;
add and define the light sources for the scene
SetupSceneLights;
mbasicMeshesLoadPlaneMesh;
mbasicMeshesLoadBoxMesh;
mbasicMeshesLoadCylinderMesh;
mbasicMeshesLoadTaperedCylinderMesh;
mbasicMeshesLoadConeMesh;
RenderScene
void SceneManager::RenderScene
declare the variables for the transformations
glm::vec scaleXYZ;
float XrotationDegrees f;
float YrotationDegrees f;
float ZrotationDegrees f;
glm::vec positionXYZ;
glm::mat scale;
glm::mat rotation;
glm::mat rotation;
glm::mat translation;
glm::mat model;
Set needed transformations
set the XYZ scale for the mesh
scaleXYZ glm::vecfff;
set the XYZ rotation for the mesh
XrotationDegrees f;
YrotationDegrees f;
ZrotationDegrees f;
set the XYZ position for the mesh
positionXYZ glm::vecfff;
set the transformations into memory to be used on the drawn meshes
SetTransformations
scaleXYZ,
XrotationDegrees,
YrotationDegrees,
ZrotationDegrees,
positionXYZ;
SetShaderColor;
SetShaderTexturewood;
SetTextureUVScale;
SetShaderMaterialwood;
draw the mesh with transformation values
mbasicMeshesDrawPlaneMesh;
Draw the keyboard a box
set the XYZ scale for the mesh
scaleXYZ glm::vecfff;
set the XYZ rotation for the mesh
XrotationDegrees f;
YrotationDegrees f;
ZrotationDegrees f;
set the XYZ position for the mesh
positionXYZ glm::vecfff;
set the transformations into memory to be used on the drawn meshes
SetTransformations
scaleXYZ,
XrotationDegrees,
YrotationDegrees,
ZrotationDegrees,
positionXYZ;
SetShaderColor;
SetShaderTexturekeyboard;
SetTextureUVScale;
SetShaderMaterialKeyboard;
draw the mesh with transformation values
mbasicMeshesDrawBoxMesh;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started