[英]Rotate a GLUT bitmap/stroke string around its center?
As you can see on the pictures the string rotates around its origin.正如你在图片上看到的,绳子绕着它的原点旋转。
Changing the RasterPos or translate it does not change this at all.更改 RasterPos 或翻译它根本不会改变这一点。 I tried glutStrokeString and glutBitmapString .
我试过glutStrokeString和glutBitmapString 。 The code for the example:
示例代码:
gl.glColor4f((float) 1, (float) 0, (float) 0, 1.0f);
gl.glScalef(0.0015f, 0.0015f, 0.0015f);
gl.glRotatef(-angleHorizontal, 0, 1, 0);
glut.glutStrokeString(GLUT.STROKE_ROMAN, "ABCDEF");
You can't.你不能。 It makes use of the (outdated, deprecated, legacy) OpenGL bitmap operations, which are always aligned to the pixel grid.
它利用(过时的、弃用的、遗留的)OpenGL 位图操作,这些操作始终与像素网格对齐。
These are just regular line segments that transform through the fixed function pipeline;这些只是通过固定功能管道转换的规则线段; or if you're in a compatibility profile through an early GLSL version shader program that uses the set of built-in variables to access the fixed function pipeline state.
或者,如果您通过早期 GLSL 版本着色器程序处于兼容性配置文件中,该程序使用内置变量集访问固定函数管道状态。 In one of my codesamples programs (which I wrote to explain how the projection frustum works) I have some helper function to draw arrows with annotations.
在我的一个代码示例程序(我编写它来解释投影平截头体的工作原理)中,我有一些辅助函数来绘制带注释的箭头。 You can find the full code here https://github.com/datenwolf/codesamples/blob/master/samples/OpenGL/frustum/frustum.c the relevant function starts in line 114.
你可以在这里找到完整的代码https://github.com/datenwolf/codesamples/blob/master/samples/OpenGL/frustum/frustum.c相关函数从第 114 行开始。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.