本文整理汇总了C++中Texture::GetMinificationFilter方法的典型用法代码示例。如果您正苦于以下问题:C++ Texture::GetMinificationFilter方法的具体用法?C++ Texture::GetMinificationFilter怎么用?C++ Texture::GetMinificationFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Texture
的用法示例。
在下文中一共展示了Texture::GetMinificationFilter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: displayTexFilerInfo
void displayTexFilerInfo()
{
char buff[255];
std::string tinfoMinification[] =
{
"Nearest",
"Bilinear"
};
std::string tinfoMagnification[] =
{
"Nearest",
"Bilinear",
"Nearest on closest mipmap",
"Bilinear on closest mipmap",
"Trilinear"
};
sprintf_s(buff, "Mag Filter: %s Min Filter: %s", tinfoMinification[tSnow.GetMagnificationFilter()].c_str(),
tinfoMagnification[tSnow.GetMinificationFilter() - 2].c_str());
SetWindowText(appMain.hWnd, buff);
}
示例2: RenderScene
void RenderScene(LPVOID lpParam)
{
// typecast lpParam to Render pointer
Render* glRender = (Render*)lpParam;
////Rendering happens here////
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
int iModelViewLoc = glGetUniformLocation(spShader.GetShaderProgramID(), "modelViewMatrix");
int iProjectionLoc = glGetUniformLocation(spShader.GetShaderProgramID(), "projectionMatrix");
glUniformMatrix4fv(iProjectionLoc, 1, GL_FALSE, glm::value_ptr(*glRender->GetProjectionMatrix()));
glm::mat4 mModelView = glm::lookAt(glm::vec3(0, 12, 27), glm::vec3(0, 0, 0), glm::vec3(0.0f, 1.0f, 0.0f));
glm::mat4 mCurrent;
glBindVertexArray(uVAO);
// texture binding set GL_ACTIVE_TEXTURE0, then tellfragment shader
// that Sampler variable will get data from GL_ACTIVE_TEXTURE0
int iSimplerLoc = glGetUniformLocation(spShader.GetShaderProgramID(), "gSampler");
glUniform1i(iSimplerLoc, 0);
tGold.BindTexture(0);
// render cube
mCurrent = glm::translate(mModelView, glm::vec3(-8.0f, 0.0f, 0.0f));
mCurrent = glm::scale(mCurrent, glm::vec3(10.0f, 10.0f, 10.0f));
mCurrent = glm::rotate(mCurrent, fRotationAngleCube, glm::vec3(1.0f, 0.0f, 0.0f));
glUniformMatrix4fv(iModelViewLoc, 1, GL_FALSE, glm::value_ptr(mCurrent));
glDrawArrays(GL_TRIANGLES, 0, 36);
// Rendering of pyramid
mCurrent = glm::translate(mModelView, glm::vec3(8.0f, 0.0f, 0.0f));
mCurrent = glm::scale(mCurrent, glm::vec3(10.0f, 10.0f, 10.0f));
mCurrent = glm::rotate(mCurrent, fRotationAnglePyramid, glm::vec3(0.0f, 1.0f, 0.0f));
glUniformMatrix4fv(iModelViewLoc, 1, GL_FALSE, glm::value_ptr(mCurrent));
glDrawArrays(GL_TRIANGLES, 36, 12);
// render ground
tSnow.BindTexture();
glUniformMatrix4fv(iModelViewLoc, 1, GL_FALSE, glm::value_ptr(mModelView));
glDrawArrays(GL_TRIANGLES, 48, 6);
// user control
if (Keys::Key(VK_UP))fCubeRotationSpeed -= appMain.sof(60.0f);
if (Keys::Key(VK_DOWN))fCubeRotationSpeed += appMain.sof(60.0f);
if (Keys::Key(VK_RIGHT))fPyramidRotationSpeed += appMain.sof(60.0f);
if (Keys::Key(VK_LEFT))fPyramidRotationSpeed -= appMain.sof(60.0f);
fRotationAngleCube += appMain.sof(fCubeRotationSpeed);
fRotationAnglePyramid += appMain.sof(fPyramidRotationSpeed);
// toggle FPS and V-Sync
if (Keys::OneKey(VK_F1))
{
bShowFPS = !bShowFPS;
if (!bShowFPS)
{
SetWindowText(appMain.hWnd, "Test Open GL Window");
}
}
if (Keys::OneKey(VK_F2))
{
bVSync = !bVSync;
glRender->SetVerticalSynchronization(bVSync);
}
else if (Keys::OneKey(VK_F3))
{
tGold.SetFiltering((tGold.GetMagnificationFilter() + 1) % 2, tGold.GetMinificationFilter());
tSnow.SetFiltering((tSnow.GetMagnificationFilter() + 1) % 2, tSnow.GetMinificationFilter());
displayTexFilerInfo();
}
else if (Keys::OneKey(VK_F4))
{
int newMinFilter = tSnow.GetMinificationFilter() == TEXTURE_FILTER_MIN_TRILINEAR ? TEXTURE_FILTER_MIN_NEAREST : tSnow.GetMinificationFilter() + 1;
tSnow.SetFiltering(tSnow.GetMagnificationFilter(), newMinFilter);
tGold.SetFiltering(tGold.GetMagnificationFilter(), newMinFilter);
displayTexFilerInfo();
}
if (bShowFPS)
{
char buff[55];
sprintf_s(buff, "FPS: %d, VSync: %s", glRender->GetFPS(), bVSync ? "On" : "Off");
SetWindowText(appMain.hWnd, buff);
}
if (Keys::OneKey(VK_ESCAPE))
//.........这里部分代码省略.........