Question: Construct a complex 3 D object using at least two basic 3 D shapes. The object you construct should replicate one of the complex objects

Construct a complex 3D object using at least two basic 3D shapes. The object you construct should replicate one of the complex objects from your 2D image. You may want to apply different colors to the 3D shapes to better visualize the different parts of the replicated object. Remember, the following basic 3D shapes are available: use are as follows:
Box
Cone
Cylinder
Plane
Prism
Pyramid
Sphere
Tapered cylinder
Torus
Apply transformations so shapes are scaled, rotated, and translated (placed) correctly. This work should be relative to the 2D reference image. For example, if you are working with a cylinder, should it be standing up or lying on its side, based on the image you are referencing? If you are also creating a box, where should you place it relative to the cylinder? What sizes are the two objects when compared to each other? Applying transformations will be easier if you complete these transformations in the right order for your specific object. In general, you should scale first, then rotate, and then translate. Your process will follow this order in most cases, though not always.
Create code that follows a logical flow without syntax errors. The code you create needs to be executable. All the code that is included will have to be reached by the execution. You dont need to write everything as a single function. Your work should be well modularized.
Apply coding best practices in your creations. Pay particular attention to the way you format and comment your code. Program code should be easy to read and follow industry-standard code formatting practices, such as indentation and spacing. The source code should be brief and clear. Use descriptive comments.
Add the answer to ///////////////////////////////////////////////////////////////////////////////
// shadermanager.cpp
//============
/
///////////////////////////////////////////////////////////////////////////////
#include "SceneManager.h"
#ifndef STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#endif
#include
// declaration of global variables
namespace
{
const char* g_ModelName = "model";
const char* g_ColorValueName = "objectColor";
const char* g_TextureValueName = "objectTexture";
const char* g_UseTextureName = "bUseTexture";
const char* g_UseLightingName = "bUseLighting";
}
/***********************************************************
* SceneManager()
*
* The constructor for the class
***********************************************************/
SceneManager::SceneManager(ShaderManager *pShaderManager)
{
m_pShaderManager = pShaderManager;
m_basicMeshes = new ShapeMeshes();
}
/***********************************************************
* ~SceneManager()
*
* The destructor for the class
***********************************************************/
SceneManager::~SceneManager()
{
m_pShaderManager = NULL;
delete m_basicMeshes;
m_basicMeshes = NULL;
}
/***********************************************************
* CreateGLTexture()
*
* This method is used for loading textures from image files,
* configuring the texture mapping parameters in OpenGL,
* generating the mipmaps, and loading the read texture into
* the next available texture slot in memory.
***********************************************************/
bool SceneManager::CreateGLTexture(const char* filename, std::string tag)
{
int width =0;
int height =0;
int colorChannels =0;
GLuint textureID =0;
// indicate to always flip images vertically when loaded
stbi_set_flip_vertically_on_load(true);
// try to parse the image data from the specified image file
unsigned char* image = stbi_load(
filename,
&width,
&height,
&colorChannels,
0);
// if the image was successfully read from the image file
if (image)
{
std::cout << "Successfully loaded image:" << filename <<", width:" << width <<", height:" << height <<", channels:" << colorChannels << std::endl;
glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_2D, textureID);
// set the texture wrapping parameters
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
// set texture filtering parameters
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
// if the loaded image is in RGB format
if (colorChannels ==3)
glTexImage2D(GL_TEXTURE_2D,0, GL_RGB8, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image);
// if the loaded image is in RGBA format - it supports transparency
else if (colorChannels ==4)
glTexImage2D(GL_TEXTURE_2D,0, GL_RGBA8, withis code
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#include
#include
#include
#include "ShaderManager.h"
/*************************

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!