本文整理汇总了C++中GLContext::renderString方法的典型用法代码示例。如果您正苦于以下问题:C++ GLContext::renderString方法的具体用法?C++ GLContext::renderString怎么用?C++ GLContext::renderString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLContext
的用法示例。
在下文中一共展示了GLContext::renderString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reportFPS
void InterfaceManager::reportFPS(void)
{
WavesGlobalState *wgs = WavesGlobalState::getInstance();
assert(wgs != NULL);
FPSMonitor &fpsMonitor = wgs->getFPSMonitor();
fpsMonitor.markRender(glutGet(GLUT_ELAPSED_TIME));
float fps = fpsMonitor.getFPS();
float bpm = wgs->getBpm();
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glPushAttrib(GL_CURRENT_BIT | GL_LINE_WIDTH);
glLineWidth(1.0f);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
GLContext *currContext = GLContext::getCurrentContext();
assert(currContext != NULL);
char str[16];
sprintf(str, "BPM: %3.1f", bpm);
glTranslatef(0.01f, 0.01f, 0.0f);
currContext->renderString(str, Vector2f(0.07f, 0.0125f));
sprintf(str, "FPS: %2.1f", fps);
glTranslatef(0.00f, 0.0175f, 0.0f);
currContext->renderString(str, Vector2f(0.0625f, 0.0125f));
glPopAttrib();
glPopMatrix();
}
示例2: render
/* PUBLIC MEMBER FUNCTIONS */
void TapButton::render(void)
{
Button::render();
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glTranslatef(position.getX(), position.getY(), 0.0f);
saveTransform();
glPushAttrib(GL_CURRENT_BIT | GL_LINE_BIT);
glLineWidth(1.0f);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
if(tapButtonDirty)
{
glNewList(tapButtonDisplayList, GL_COMPILE);
float textHeight = height * 0.15f;
float x = (width / 2.0f) - ((textHeight * tapText.size()) / 2.0f);
float y = (height / 2.0f) - (textHeight / 2.0f);
glTranslatef(x, y, 0.0f);
GLContext *currContext = GLContext::getCurrentContext();
assert(currContext != NULL);
currContext->renderString(tapText, Vector2f(textHeight * tapText.size(), textHeight));
glEndList();
tapButtonDirty = false;
}
glCallList(tapButtonDisplayList);
glPopAttrib();
glPopMatrix();
}