- 博客(0)
- 资源 (2)
空空如也
opengl2D图像文字
#include <windows.h> // Windows的头文件
#include "glew.h" // 包含最新的gl.h,glu.h库
//#include <glut.h> // 包含OpenGL实用库
#include <stdio.h> // 标准输入/输出库的头文件
#include <math.h> // 数学库函数
#include "glaux.h" // GLaux库的头文件
2009-06-03
字体移动以及漂浮font
这个是关于字移动的OPENGL的源代码
int DrawGLScene(GLvoid) // 从这里开始进行所有的绘制
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // 清除屏幕和深度缓存
glLoadIdentity(); // 重置当前的模型观察矩阵
/***********************************新添的代码***********************************************************************************/
glTranslatef(0.0f,0.0f,-1.0f); // 移入屏幕一个单位
// 根据字体位置设置颜色
glColor3f(1.0f*float(cos(cnt1)),1.0f*float(sin(cnt2)),1.0f-0.5f*float(cos(cnt1+cnt2)));
// 设置光栅化位置,即字体的位置
glRasterPos2f(-0.45f+0.05f*float(cos(cnt1)), 0.35f*float(sin(cnt2)));
glPrint("Active OpenGL Text With NeHe - %3.2f", cnt1); // 输出文字到屏幕
rot+=0.5f;
cnt1+=0.051f; // 增加计数器值
cnt2+=0.005f; // 增加计数器值
/********************************************************************************************************************************/
return TRUE; // 一切 OK
}
2009-05-18
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人