资源简介
axes.zip

代码片段和文件信息
#include “axes.h“
Axes::Axes(QWidget *parent) : QOpenGLWidget(parent) _eye(0 0 20) _center(0 0 0) _up(0 1 0)
{
}
void Axes::initializeGL()
{
initializeOpenGLFunctions();
// glClearColor(0.75 0.75 0.75 1.0);
glClearColor(0.0 0.0 0.0 1.0);
glPolygonMode(GL_FRONT_AND_BACK GL_FILL);
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
glColorMaterial(GL_FRONT_AND_BACK GL_AMBIENT_AND_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_LIGHT0);
glDisable(GL_LIGHTING);
// We need a valid OpenGL context before building the 3D font display lists.
float glyphWidth = 3;
int numGlyphs = 256;
QFont font = QFont(“Sans“ 20 QFont::Normal);
_textRender.setFont(font glyphWidth numGlyphs);
}
void Axes::resizeGL(int w int h)
{
glViewport(0 0 width() height());
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
perspective(10 float(w) / h 2 200);
glMatrixMode(GL_MODELVIEW);
}
void Axes::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
lookAt(_eye _center _up);
DrawSpaceAxes();
}
void Axes::DrawSpaceAxes()
{
GLdouble axesLen = 0.1;
GLdouble radius = 0.03;
GLdouble base = 0.01;
GLdouble top = 0.01;
GLdouble baseRadius = 0.03;
GLdouble topRadius = 0.0;
GLUquadricObj *objCylinder = gluNewQuadric();
//---------------------------------------------------------------------z
glPushMatrix();
glColor3f(1.0f 0.0f 0.0f);
glutSolidSphere(radius66);
glColor3f(0.0f0.0f 1.0f);
gluCylinder(objCylinderbase top axesLen 10 5); //Z
glTranslatef(00axesLen);
gluCylinder(objCylinderbaseRadius topRadius baseRadius 10 5); //Z
glPopMatrix();
glPushMatrix();
glTranslatef(0 axesLen / 2axesLen);
DrawSpaceText(“Z“);
glPopMatrix();
//---------------------------------------------------------------------y
glPushMatrix();
glColor3f(0.0f1.0f 0.0f);
glRotatef(-901.00.00.0);
gluCylinder(objCylinderbase top axesLen 10 5); //Y
glTranslatef(00axesLen);
gluCylinder(objCylinderbaseRadius topRadius baseRadius 10 5); //Y
glPopMatrix();
glPushMatrix();
glTranslatef(axesLen / 2axesLen0);
DrawSpaceText(“Y“);
glPopMatrix();
//---------------------------------------------------------------------x
glPushMatrix();
glColor3f(1.0f0.0f 0.0f);
glRotatef(900.01.00.0);
gluCylinder(objCylinderbase top axesLen 10 5); //X
glTranslatef(00axesLen);
gluCylinder(objCylinderbaseRadius topRadius baseRadius 10 5); //X
glPopMatrix();
glPushMatrix();
glTranslatef(axesLenaxesLen / 20);
DrawSpaceText(“X“);
glPopMatrix();
}
void Axes::DrawSpaceText(QString text)
{
// Draw 3D text.
QVector3D position(0 0 0);
int align = Qt::AlignHCenter | Qt::Al
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2020-12-03 07:54 axes\
文件 4981 2019-03-18 15:06 axes\QtFont3D.cpp
文件 1539 2019-03-18 15:06 axes\QtFont3D.h
文件 7381 2020-12-03 07:54 axes\axes.cpp
文件 1251 2020-12-03 15:57 axes\axes.h
文件 1166 2020-12-03 05:25 axes\axes.pro
文件 24192 2020-12-03 05:41 axes\axes.pro.user
目录 0 2020-12-03 07:54 axes\build\
文件 739 2020-12-03 04:53 axes\build\.qmake.stash
文件 25180 2020-12-03 05:25 axes\build\Makefile
文件 919608 2020-12-03 04:59 axes\build\QtFont3D.o
文件 1321504 2020-12-03 07:54 axes\build\axes
文件 784248 2020-12-03 07:54 axes\build\axes.o
文件 914232 2020-12-03 07:54 axes\build\main.o
文件 2614 2020-12-03 07:54 axes\build\moc_axes.cpp
文件 826992 2020-12-03 07:54 axes\build\moc_axes.o
文件 13992 2020-12-03 04:59 axes\build\moc_predefs.h
文件 347 2020-12-03 05:55 axes\main.cpp
相关资源
- PID_AutoTune_v0.rar
- vspd7.2.308.zip
- 价值2k的H漫画小说系统
- Pythonamp;课堂amp;笔记(高淇amp;400;集第
- ddos压力测试工具99657
- UML建模大全
- 开源1A锂电池充电板TP4056原理图+PCB
- m1卡 ic卡可选择扇区初始化加密软件
- TSCC.exe
- FTP课程设计(服务端+客户端)
- 计算机图形学 边填充算法实现代码
- 电力系统潮流计算程序集合
- oracle数据迁移项目实施方案
- Web Api 通过文件流 文件到本地
- Visio图标-最新最全的网络通信图标库
- Spire API文档
- OpenGL参考手册
- Python中Numpy库最新教程
- SPD博士V5.3.exe
- 直流无刷电机方波驱动 stm32 例程代码
- layui后台管理模板
- 仿知乎界面小程序源代码
- 云平台-阿里云详细介绍
- photoshop经典1000例
- scratch垃圾分类源码(最终版本).sb
- IAR ARM 7.8破解
- TI CCS V5.4 安装步骤及破解文件
- 松下plc FP-XH的驱动
- 局域网硬件信息收集工具
- 加快Windows XP操作系统开机速度
评论
共有 条评论