【发布时间】:2011-07-29 15:44:41
【问题描述】:
我想在 OpenGL 中特定坐标位置的游戏屏幕上显示文本。
例如,玩家在坐标(5,5) 得分"Player Score:" 10。
我该怎么做?
【问题讨论】:
-
您有纯 OpenGL 还是使用某种框架/引擎?
标签: opengl text-rendering
我想在 OpenGL 中特定坐标位置的游戏屏幕上显示文本。
例如,玩家在坐标(5,5) 得分"Player Score:" 10。
我该怎么做?
【问题讨论】:
标签: opengl text-rendering
在正交视图下使用名为 GLFont 的工具可以输出类似的文本
glFontBegin(&font);
glScalef(8.0, 8.0, 8.0);
glTranslatef(30, 30, 0);
glFontTextOut("Test", 5, 5, 0);
glFontEnd();
glFlush();
你可以在这里找到它http://students.cs.byu.edu/~bfish/glfontdl.php
我记得opengl下也有可以在屏幕上显示文本的功能。 检查这个: http://www.opengl.org/resources/features/fontsurvey/
编辑:也检查此链接http://mycodelog.com/2010/03/23/printw/
使用就像调用printf一样简单:
printf( "char: %c, decimal: %d, float: %f, string: %s", 'X', 1618, 1.618, "text");
printw(x, y, z, "char: %c, decimal: %d, float: %f, string: %s", 'X', 1618, 1.618, "text");
【讨论】: