Question: Before changes the program displays two artifacts with block shape. You are to make changes related to transformations applied to the artifacts. The first artifact
Before changes the program displays two artifacts with block shape. You are to make changes related to transformations applied to the artifacts.
The first artifact
Scale by in the x direction, in the y direction, and in the z direction
Translate by in the x direction, in the y direction, and in the z direction
The center of the animation rotation should be the top of the object
The animation rotation axis should be the xaxis
The rotation rate should be pi
The second artifact
Scale by in the x direction, in the y direction, and in the z direction
Translate by in the x direction, in the y direction, and in the z direction
Set the world transform rotation angle to pi
The center of the animation rotation should be the center of the object
The animation rotation axis should be the y axis
The rotation rate should be pi
The code source is the following:
#include GLMgtctypeptrhpp
#include
#include "learnopenglshaderh
#include
#include
#include
#include csbufferutilities.h
static Shader shader;
static std::vector artifactlist;
void initvoid
shader new ShaderproblemAvertexshader.glslproblemAfragmentshader.glsl;
glUseProgramshaderID;
glEnableGLDEPTHTEST;
cs::shape block new cs::block;
auto artf new cs::artifactrotating;
artftheshape block;
artifactlist.pushbackartf;
artf new cs::artifactrotating;
artftheshape block;
artifactlist.pushbackartf;
cs::initbuffersshaderID artifactlist, bposition", bcolor";
void render
static auto lasttime ;
auto time glfwGetTime;
auto deltatime time lasttime;
lasttime time;
for auto artf : artifactlist
artfanimatetime deltatime;
auto modelmatrix artfanimationtransform.matrix
artfworldtransform.matrix;
shadersetMatutransform", modelmatrix;
glDrawArraysGLTRIANGLES, artftheshapebufferstart, artftheshapebuffersize;
int
mainint argc, char argv
glfwInit;
cs::setopenglversion;
GLFWwindow window cs::setupwindowProblem A;
gladLoadGLglfwGetProcAddress;
init;
while glfwWindowShouldClosewindow
glClearBufferfvGLCOLOR, cs::x::grayasfloatarray;
glClearGLDEPTHBUFFERBIT;
render;
glfwSwapBufferswindow;
glfwPollEvents;
glfwDestroyWindowwindow;
glfwTerminate;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
