在OpenGL中,仅使用OpenGL3 +方法创建透视图的最简单方法是什么? [英] In OpenGL, what is the simplest way to create a perspective view using only OpenGL3+ methods?

查看:106
本文介绍了在OpenGL中,仅使用OpenGL3 +方法创建透视图的最简单方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

乍一看这听起来很懒,但是我已经研究了2天.

This might sound lazy at first, but I've been researching it for 2 days.

我有一个绘制原始图元的SDL + GLEW应用程序.我想以不同的角度制作一些视口.我看到了四个视口,但无法更改视角.

I have an SDL+GLEW app that draws a primitive. I wanted to make a few viewports in different perspectives. I see the four viewports but I can't change the the perspectives.

假设你有

draw();
swapbuffers();

在OpenGL3 +规范中,最简单的方法是创建透视视口(或理想情况下是多个视口)?

What is the simplest way - in OpenGL3+ spec - to create a perspective viewport (or ideally several ones)?

推荐答案

最简单的方法就是唯一的方法.计算自己(使用一些lib,普通数学等)的投影矩阵,然后将其上载到顶点着色器中的制服中,然后在其中进行转换.

The simplest is the only way. Calculate yourself (with some lib, plain math, etc) a projection matrix, and upload it to a uniform in your vertex shader, and do the transformation there.

这篇关于在OpenGL中,仅使用OpenGL3 +方法创建透视图的最简单方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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