本文整理汇总了C++中TextRenderer::RenderText方法的典型用法代码示例。如果您正苦于以下问题:C++ TextRenderer::RenderText方法的具体用法?C++ TextRenderer::RenderText怎么用?C++ TextRenderer::RenderText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextRenderer
的用法示例。
在下文中一共展示了TextRenderer::RenderText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
currentZ = cameraPos.z;
cameraPos += yVelocity * front;
cameraPos -= glm::normalize(glm::cross(cameraFront, cameraUp)) * xVelocity;
// Collision detection, reset to previous position if wall boundary is crossed
if ( (cameraPos.x-wallDistanceMargin) < -corridorWidth | (cameraPos.x + wallDistanceMargin)> corridorWidth)
cameraPos.x = currentX;
if ((cameraPos.z-wallDistanceMargin) < -corridorDepth | (cameraPos.z + wallDistanceMargin) > corridorDepth)
cameraPos.z = currentZ;
// Check reward zone entries
if (!inRewardZone && (cameraPos.z > rewardZoneLowZ && cameraPos.z < rewardZoneHighZ))
{
inRewardZone = true;
cout << "Reward zone ENTRY detected." << endl;
}
if (inRewardZone && (cameraPos.z < rewardZoneLowZ || cameraPos.z > rewardZoneHighZ))
{
inRewardZone = false;
cout << "Reward zone EXIT detected." << endl;
}
view = glm::lookAt(cameraPos, cameraPos + cameraFront, cameraUp);
// Draw the complete screen to the offscreen framebuffer
glfwMakeContextCurrent(initGlfw.window);
glBindFramebuffer(GL_FRAMEBUFFER, frameBufferObject);
glViewport(0, 0, fullWidth, initGlfw.windowInfo.height);
glEnable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (showFPS)
textRenderer.RenderText(textShaderProgram, fpsString, 0.0f, GLfloat(initGlfw.windowInfo.height - 20), 1.0, glm::vec3(0.8, 0.6, 0.6));
glUseProgram(defaultShaderProgram);
glUniformMatrix4fv(viewLocation, 1, GL_FALSE, glm::value_ptr(view));
glUniformMatrix4fv(projectionLocation, 1, GL_FALSE, glm::value_ptr(proj1));
glUniformMatrix4fv(modelLocation, 1, GL_FALSE, glm::value_ptr(idm));
glBindTexture(GL_TEXTURE_2D, texture);
frontWall.Draw();
backWall.Draw();
leftWall.Draw();
rightWall.Draw();
floorSquare.Draw();
glBindTexture(GL_TEXTURE_2D, blankTexture);
rewardZone.Draw();
glBindTexture(GL_TEXTURE_2D, 0);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
// First monitor drawing calls
//glfwMakeContextCurrent(initGlfw.window);
glClear(GL_COLOR_BUFFER_BIT);
glDisable(GL_DEPTH_TEST);
glViewport(0, 0, initGlfw.windowInfo.width, initGlfw.windowInfo.height);
glUseProgram(simpleShaderProgram);
glBindTexture(GL_TEXTURE_2D, frameBufferTexture);
glBindBuffer(GL_ARRAY_BUFFER, rightScreenVBO);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), (GLvoid*)0);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), (GLvoid*)(2 * sizeof(GLfloat)));
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glDrawArrays(GL_TRIANGLES, 0, 6);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glfwSwapBuffers(initGlfw.window);
// Second monitor drawing calls
glfwMakeContextCurrent(initGlfw.window2);
glClear(GL_COLOR_BUFFER_BIT);
glDisable(GL_DEPTH_TEST);
glUseProgram(simpleShaderProgram);
glBindTexture(GL_TEXTURE_2D, frameBufferTexture);
glBindBuffer(GL_ARRAY_BUFFER, leftScreenVBO);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), (GLvoid*)0);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), (GLvoid*)(2 * sizeof(GLfloat)));
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glDrawArrays(GL_TRIANGLES, 0, 6);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glfwSwapBuffers(initGlfw.window2);
// Check events
glfwPollEvents();
// Output information
++updateTick;
if (updateTick % 60 == 0)
{
cout << "Camera position: (" << cameraPos.x << ", " << cameraPos.y << ", " << cameraPos.z << ")" << endl;
updateTick = 0;
}
}
glfwTerminate();
// Clean up after exiting
glDeleteFramebuffers(1, &frameBufferObject);
return 0;
}