本文整理汇总了C++中ShaderLoader::Loader方法的典型用法代码示例。如果您正苦于以下问题:C++ ShaderLoader::Loader方法的具体用法?C++ ShaderLoader::Loader怎么用?C++ ShaderLoader::Loader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShaderLoader
的用法示例。
在下文中一共展示了ShaderLoader::Loader方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startup
bool TestApplication::startup() {
// create a basic window
createWindow("AIE OpenGL Application", 1280, 720);
// start the gizmo system that can draw basic shapes
Gizmos::create();
terrain = new Terrain(64, 50);
// create a camera
m_camera = new Camera(glm::pi<float>() * 0.25f, 16 / 9.f, 0.1f, 1000.f);
m_camera->setLookAtFrom(vec3(-10, 100, -10), vec3(100, 0, 100));
//////////////////////////////////////////////////////////////////////////
// YOUR STARTUP CODE HERE
//////////////////////////////////////////////////////////////////////////
m_pickPosition = glm::vec3(0);
shaders.Loader(m_program, "./src/Shader.vert", "./src/Shader.frag");
glfwSetMouseButtonCallback(m_window, OnMouseButton);
glfwSetCursorPosCallback(m_window, OnMousePosition);
glfwSetScrollCallback(m_window, OnMouseScroll);
glfwSetKeyCallback(m_window, OnKey);
glfwSetCharCallback(m_window, OnChar);
glfwSetWindowSizeCallback(m_window, OnWindowResize);
TwInit(TW_OPENGL_CORE, nullptr);
TwWindowSize(1280, 720);
m_bar = TwNewBar("my bar");
TwAddVarRW(m_bar, "clear colour", TW_TYPE_COLOR4F, &m_clearColour, "");
TwAddVarRW(m_bar, "snow height", TW_TYPE_FLOAT, &textureBlend, "group=terrain");
TwAddVarRW(m_bar, "light direction", TW_TYPE_DIR3F, &light, "group=light");
TwAddVarRW(m_bar, "light colour", TW_TYPE_DIR3F, &lightColour, "group=light");
return true;
}
示例2: update
bool TestApplication::update(float deltaTime) {
// close the application if the window closes
if (glfwWindowShouldClose(m_window) ||
glfwGetKey(m_window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
return false;
// update the camera's movement
m_camera->update(deltaTime);
// clear the gizmos out for this frame
Gizmos::clear();
//////////////////////////////////////////////////////////////////////////
// YOUR UPDATE CODE HERE
//////////////////////////////////////////////////////////////////////////
// an example of mouse picking
if (glfwGetMouseButton(m_window, 0) == GLFW_PRESS) {
double x = 0, y = 0;
glfwGetCursorPos(m_window, &x, &y);
// plane represents the ground, with a normal of (0,1,0) and a distance of 0 from (0,0,0)
glm::vec4 plane(0, 1, 0, 0);
m_pickPosition = m_camera->pickAgainstPlane((float)x, (float)y, plane);
}
if (glfwGetKey(m_window, GLFW_KEY_L) == GLFW_PRESS)
{
shaders.Loader(m_program, "./src/Shader.vert", "./src/Shader.frag");
}
Gizmos::addTransform(glm::translate(m_pickPosition));
terrain->light = light;
terrain->lightColour = lightColour;
terrain->textureBlend = textureBlend;
// return true, else the application closes
return true;
}