gl_ModelViewProjectionMatrix与gl_ModelViewMatrix [英] gl_ModelViewProjectionMatrix vs gl_ModelViewMatrix

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

问题描述

我是GLSL的初学者.我正在阅读顶点着色器代码,但我不理解这部分代码:

I am beginner at GLSL. I was reading a vertex shader code and I don't understande this part of code:

out vec3 position;
...
gl_Position=gl_ModelViewProjectionMatrix*gl_Vertex; 
position=vec3(gl_ModelViewMatrix*gl_Vertex); 

gl_ModelViewProjectionMatrix和gl_ModelViewMatrix有什么区别?

What are the differences between gl_ModelViewProjectionMatrix and gl_ModelViewMatrix?

gl_Position和位置之间有什么区别?

What are the differences between gl_Position and position?

推荐答案

您可能会怀疑,gl_ModelViewProjectionMatrix是gl_ModelViewMatrix,其中添加了投影-即透视相机的扭曲.

As you might suspect, gl_ModelViewProjectionMatrix is gl_ModelViewMatrix with the addition of the projection -- that is, the perspective camera distortion.

gl_Position是预定义的变量,表示此顶点着色器的投影结果"(需要所有顶点着色器为gl_Position分配一个值),而值"position"是附加的程序员定义的值,骑(为什么不能说,取决于整个着色器)

gl_Position is a predefined variable meaning "the projected result of this vertex shader" (all vertex shaders are required to assign a value to gl_Position), while the value "position" is an extra programmer-defined value that comes along for the ride (why is impossible to say, depends on the entire shader)

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

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