修改 OpenGL 轴系 [英] Modifying OpenGL axis system

查看:17
本文介绍了修改 OpenGL 轴系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 OpenGL 与 gluPerspective 一起使用,我需要做什么才能使其使用原点位于左上角而不是左下角的轴系统?

I'm using OpenGL with gluPerspective, what would I need to do to make it use an axis-system which the origin is top left instead of bottom left?

推荐答案

我会说直接对投影矩阵进行操作是这种操作的一种干净的方式.但是,如果您有任何机会需要替代方案:

I would say direct operating on the projection matrix is a clean way for this operation. But if by any chance you need an alternative:

你可以使用 glScalef(1.f, -1.f, 1.f) 来翻转轴.

You can just use glScalef(1.f, -1.f, 1.f) to flip the axis.

这也只是对 GL_MODELVIEW 或 GL_PROJECTION 矩阵(无论当前处于活动状态)的操作.

This is also just an operation on the GL_MODELVIEW or GL_PROJECTION matrix (whatever is currently active).

这篇关于修改 OpenGL 轴系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆