[SOLVED] 代写 Project 3: Texture

30 $

File Name: 代写_Project_3:_Texture.zip
File Size: 235.5 KB

SKU: 0939647667 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


Project 3: Texture
Due Date: Jan 15, 2020, 23:59:59
1. In this project, you are going to learn import a mesh with textures, and then render the mesh. The code to load and create a texture is a below:
// load and create a texture
// ————————-
unsigned int texture;
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture); // all upcoming GL_TEXTURE_2D
operations now have effect on this texture object
// set the texture wrapping parameters glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
// set
texture wrapping to GL_REPEAT (default wrapping method) 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); // load image, create texture and generate mipmaps
int width, height, nrChannels;
// The FileSystem::getPath(…) is part of the GitHub repository so we can find
files on any IDE/platform; replace it with your own image path. unsigned char *data =
stbi_load(FileSystem::getPath(“resources/textures/container.jpg”).c_str(), &width, &height, &nrChannels, 0);
if (data) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
glGenerateMipmap(GL_TEXTURE_2D); }
else {
std::cout << “Failed to load texture” << std::endl; }stbi_image_free(data);And then, you need to render the whole scene, with setting the viewpoint and lighting. You are encouraged to use some advantage texturing methods, such as bump texture, displace texture, and multiple texture mapping.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] 代写 Project 3: Texture
30 $